题目链接:https://cometoj.com/contest/68/problem/C?problem_id=3935 solution:
#include <bits/stdc++.h>
using namespace std
;
int Lx
[200000], Ly
[200000], Rx
[200000], Ry
[200000];
int main()
{
int n
, m
;
long long ans
= 0;
scanf("%d%d", &n
, &m
);
for (int i
= 0; i
< n
; ++i
)scanf("%d%d", &Lx
[i
], &Ly
[i
]);
for (int i
= 0; i
< m
; ++i
)scanf("%d%d", &Rx
[i
], &Ry
[i
]);
for (int i
= 0; i
< n
; ++i
){
ans
+= (upper_bound(Rx
, Rx
+ m
, Ly
[i
]) - Rx
) - (lower_bound(Ry
, Ry
+ m
, Lx
[i
]) - Ry
);
}
printf("%lld\n", ans
);
return 0;
}
转载请注明原文地址: https://mac.8miu.com/read-63134.html