#include<stdio.h>
#include<stdlib.h>
#include<algorithm>
struct xy
{
int x, y;
};
int cmp(const xy &aa, const xy &bb)
{
return aa.x<bb.x || (aa.x==bb.x && aa.y<bb.y);
}
xy a[100002];
int n, m, l, g[100002];
int cnt;
int input()
{
int i;
scanf("%d %d %d",&m,&n,&l);
for(i=1 ; i<=m ; i++) scanf("%d",&g[i]);
for(i=1 ; i<=n ; i++) scanf("%d %d",&a[i].x,&a[i].y);
std::sort(g+1,g+1+m);
std::sort(a+1,a+1+n,cmp);
return 0;
}
int process()
{
int i=1, j=1, d;
while(j<=n)
{
while(g[i]+(g[i+1]-g[i])/2+(g[i+1]-g[i])%2<=a[j].x && i!=m) {i++;}
d=abs(a[j].x-g[i])+a[j].y;
if(d<=l) cnt++;
j++;
}
return 0;
}
int output()
{
printf("%d",cnt);
return 0;
}
int main()
{
input();
process();
output();
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
2264 KB |
Output is correct |
2 |
Correct |
0 ms |
2264 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
2264 KB |
Output is correct |
2 |
Correct |
0 ms |
2264 KB |
Output is correct |
3 |
Correct |
0 ms |
2264 KB |
Output is correct |
4 |
Correct |
0 ms |
2264 KB |
Output is correct |
5 |
Correct |
0 ms |
2264 KB |
Output is correct |
6 |
Correct |
0 ms |
2264 KB |
Output is correct |
7 |
Correct |
0 ms |
2264 KB |
Output is correct |
8 |
Correct |
0 ms |
2264 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
2264 KB |
Output is correct |
2 |
Correct |
0 ms |
2264 KB |
Output is correct |
3 |
Correct |
0 ms |
2264 KB |
Output is correct |
4 |
Correct |
0 ms |
2264 KB |
Output is correct |
5 |
Correct |
0 ms |
2264 KB |
Output is correct |
6 |
Correct |
0 ms |
2264 KB |
Output is correct |
7 |
Correct |
0 ms |
2264 KB |
Output is correct |
8 |
Correct |
0 ms |
2264 KB |
Output is correct |
9 |
Correct |
0 ms |
2264 KB |
Output is correct |
10 |
Correct |
0 ms |
2264 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
2264 KB |
Output is correct |
2 |
Correct |
0 ms |
2264 KB |
Output is correct |
3 |
Correct |
0 ms |
2264 KB |
Output is correct |
4 |
Correct |
0 ms |
2264 KB |
Output is correct |
5 |
Correct |
0 ms |
2264 KB |
Output is correct |
6 |
Correct |
0 ms |
2264 KB |
Output is correct |
7 |
Correct |
0 ms |
2264 KB |
Output is correct |
8 |
Correct |
0 ms |
2264 KB |
Output is correct |
9 |
Correct |
0 ms |
2264 KB |
Output is correct |
10 |
Correct |
0 ms |
2264 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
36 ms |
2264 KB |
Output is correct |
2 |
Correct |
52 ms |
2264 KB |
Output is correct |
3 |
Correct |
48 ms |
2264 KB |
Output is correct |
4 |
Correct |
48 ms |
2264 KB |
Output is correct |
5 |
Correct |
68 ms |
2264 KB |
Output is correct |
6 |
Correct |
64 ms |
2264 KB |
Output is correct |
7 |
Correct |
64 ms |
2264 KB |
Output is correct |
8 |
Correct |
52 ms |
2264 KB |
Output is correct |
9 |
Correct |
72 ms |
2264 KB |
Output is correct |
10 |
Correct |
64 ms |
2264 KB |
Output is correct |