#include <cstdio>
#include <algorithm>
#define AVG (s+e)/2
int search(int a[],int v,int err,int s, int e){
if(a[AVG]<=v+err && a[AVG]>=v-err) return 1;
if(s==e) return 0;
if(a[AVG]>v+err) return search(a,v,err,s,AVG);
if(a[AVG]<v-err) return search(a,v,err,AVG+1,e);
return search(a,v,err,AVG+1,e)+search(a,v,err,s,AVG);
}
int main(){
int m,n,l;
scanf("%d %d %d",&m,&n,&l);
int a[m],x,y,r=0;
for (int i=0; i<m; i++) {
scanf("%d",&a[i]);
}
std::sort(a,a+m);
for (int i=0; i<n; i++) {
scanf("%d %d",&x,&y);
if(search(a,x,l-y,0,m-1)) r++;
}
printf("%d",r);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1200 KB |
Output is correct |
2 |
Correct |
0 ms |
1200 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1200 KB |
Output is correct |
2 |
Correct |
0 ms |
1200 KB |
Output is correct |
3 |
Correct |
0 ms |
1200 KB |
Output is correct |
4 |
Correct |
0 ms |
1200 KB |
Output is correct |
5 |
Correct |
0 ms |
1200 KB |
Output is correct |
6 |
Correct |
0 ms |
1200 KB |
Output is correct |
7 |
Correct |
0 ms |
1200 KB |
Output is correct |
8 |
Correct |
0 ms |
1200 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1200 KB |
Output is correct |
2 |
Correct |
0 ms |
1200 KB |
Output is correct |
3 |
Correct |
0 ms |
1200 KB |
Output is correct |
4 |
Correct |
0 ms |
1200 KB |
Output is correct |
5 |
Correct |
0 ms |
1200 KB |
Output is correct |
6 |
Correct |
0 ms |
1200 KB |
Output is correct |
7 |
Correct |
0 ms |
1200 KB |
Output is correct |
8 |
Correct |
0 ms |
1200 KB |
Output is correct |
9 |
Correct |
0 ms |
1200 KB |
Output is correct |
10 |
Correct |
0 ms |
1200 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1200 KB |
Output is correct |
2 |
Correct |
0 ms |
1200 KB |
Output is correct |
3 |
Correct |
0 ms |
1200 KB |
Output is correct |
4 |
Correct |
0 ms |
1200 KB |
Output is correct |
5 |
Correct |
0 ms |
1200 KB |
Output is correct |
6 |
Correct |
0 ms |
1200 KB |
Output is correct |
7 |
Correct |
0 ms |
1200 KB |
Output is correct |
8 |
Correct |
0 ms |
1200 KB |
Output is correct |
9 |
Correct |
0 ms |
1200 KB |
Output is correct |
10 |
Correct |
0 ms |
1200 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
40 ms |
1268 KB |
Output is correct |
2 |
Correct |
56 ms |
1360 KB |
Output is correct |
3 |
Correct |
52 ms |
1400 KB |
Output is correct |
4 |
Correct |
44 ms |
1304 KB |
Output is correct |
5 |
Correct |
56 ms |
1368 KB |
Output is correct |
6 |
Correct |
72 ms |
1428 KB |
Output is correct |
7 |
Correct |
60 ms |
1440 KB |
Output is correct |
8 |
Correct |
52 ms |
1256 KB |
Output is correct |
9 |
Correct |
56 ms |
1448 KB |
Output is correct |
10 |
Correct |
60 ms |
1440 KB |
Output is correct |