0分求助QAQ
查看原帖
0分求助QAQ
1056027
LJQ_AJ楼主2023/9/9 23:24
#include <bits/stdc++.h>

using namespace std;
long long a[100007], b[100007], c[100007], n, ans;
int main(){
	scanf("%lld", &n);
	for(int i = 0; i < n; i++) scanf("%lld", &a[i]);
	for(int i = 0; i < n; i++) scanf("%lld", &b[i]);
	for(int i = 0; i < n; i++) scanf("%lld", &c[i]);
	sort(a, a + n); sort(b, b + n); sort(c, c + n);
	for(int i = 0; i < n; i++){
		int tx = lower_bound(a, a + n, b[i]) - a,
		    ty = upper_bound(c, c + n, b[i]) - c;
		if(a[tx] <= b[i] && c[ty] >= b[i]){
			ty = n - ty;
			ans += tx * ty;
		}
	}
	printf("%lld", ans);
	return 0;
}

各位大佬能不能帮帮我,谢谢

2023/9/9 23:24
加载中...