#include <stdio.h>
#include <algorithm>
struct data{
int x,y;
bool operator<(const data&r)const{
return x<r.x;
}
}a[100010];
int x[100010],s;
int main(){
int i,j=0,m,n,l;
scanf("%d%d%d",&m,&n,&l);
for(i=0;i<m;i++)scanf("%d",&x[i]);
for(i=0;i<n;i++)scanf("%d%d",&a[i].x,&a[i].y);
std::sort(x,x+m);
std::sort(a,a+n);
for(i=0;i<n;++i){
for(;j<m&&x[j]<a[i].x;++j);
if((j>0&&a[i].x-x[j-1]+a[i].y<=l)||(j<m&&x[j]-a[i].x+a[i].y<=l))++s;
}
printf("%d",s);
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
2256 KB |
Output is correct |
2 |
Correct |
0 ms |
2256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
2256 KB |
Output is correct |
2 |
Correct |
0 ms |
2256 KB |
Output is correct |
3 |
Correct |
0 ms |
2256 KB |
Output is correct |
4 |
Correct |
0 ms |
2256 KB |
Output is correct |
5 |
Correct |
0 ms |
2256 KB |
Output is correct |
6 |
Correct |
0 ms |
2256 KB |
Output is correct |
7 |
Correct |
0 ms |
2256 KB |
Output is correct |
8 |
Correct |
0 ms |
2256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
2256 KB |
Output is correct |
2 |
Correct |
0 ms |
2256 KB |
Output is correct |
3 |
Correct |
0 ms |
2256 KB |
Output is correct |
4 |
Correct |
0 ms |
2256 KB |
Output is correct |
5 |
Correct |
0 ms |
2256 KB |
Output is correct |
6 |
Correct |
0 ms |
2256 KB |
Output is correct |
7 |
Correct |
0 ms |
2256 KB |
Output is correct |
8 |
Correct |
0 ms |
2256 KB |
Output is correct |
9 |
Correct |
0 ms |
2256 KB |
Output is correct |
10 |
Correct |
0 ms |
2256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
2256 KB |
Output is correct |
2 |
Correct |
0 ms |
2256 KB |
Output is correct |
3 |
Correct |
0 ms |
2256 KB |
Output is correct |
4 |
Correct |
0 ms |
2256 KB |
Output is correct |
5 |
Correct |
0 ms |
2256 KB |
Output is correct |
6 |
Correct |
0 ms |
2256 KB |
Output is correct |
7 |
Correct |
1 ms |
2256 KB |
Output is correct |
8 |
Correct |
1 ms |
2256 KB |
Output is correct |
9 |
Correct |
0 ms |
2256 KB |
Output is correct |
10 |
Correct |
0 ms |
2256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
40 ms |
2256 KB |
Output is correct |
2 |
Correct |
52 ms |
2256 KB |
Output is correct |
3 |
Correct |
45 ms |
2256 KB |
Output is correct |
4 |
Correct |
59 ms |
2256 KB |
Output is correct |
5 |
Correct |
73 ms |
2256 KB |
Output is correct |
6 |
Correct |
87 ms |
2256 KB |
Output is correct |
7 |
Correct |
71 ms |
2256 KB |
Output is correct |
8 |
Correct |
56 ms |
2256 KB |
Output is correct |
9 |
Correct |
90 ms |
2256 KB |
Output is correct |
10 |
Correct |
65 ms |
2256 KB |
Output is correct |