#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll N,M,L,cnt;
ll Sh[100002];
bool pro()
{
ll x,y;
cin>>x>>y;
ll x1,x2;
x1=*(lower_bound(Sh,Sh+N+1,x)-1);
x2=*lower_bound(Sh,Sh+N+1,x);
// printf("list:: %lld %lld ",x1,x2);
if(abs(x1-x)+y>L&&abs(x2-x)+y>L)
return 0;//(printf("unable\n"),0);
//printf("able\n");
return 1;
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cin>>N>>M>>L;
for(int i=1;i<=N;i++)cin>>Sh[i];
sort(Sh+1,Sh+N+1);
Sh[N+1]=1ll<<48;
Sh[0]=-(1ll<<48);
for(int i=0;i<M;i++)cnt+=pro();
printf("%lld",cnt);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
436 KB |
Output is correct |
2 |
Correct |
2 ms |
444 KB |
Output is correct |
3 |
Correct |
2 ms |
444 KB |
Output is correct |
4 |
Correct |
2 ms |
580 KB |
Output is correct |
5 |
Correct |
2 ms |
580 KB |
Output is correct |
6 |
Correct |
2 ms |
600 KB |
Output is correct |
7 |
Correct |
2 ms |
604 KB |
Output is correct |
8 |
Correct |
2 ms |
656 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
660 KB |
Output is correct |
2 |
Correct |
2 ms |
704 KB |
Output is correct |
3 |
Correct |
2 ms |
816 KB |
Output is correct |
4 |
Correct |
2 ms |
816 KB |
Output is correct |
5 |
Correct |
2 ms |
816 KB |
Output is correct |
6 |
Correct |
2 ms |
816 KB |
Output is correct |
7 |
Correct |
2 ms |
816 KB |
Output is correct |
8 |
Correct |
2 ms |
816 KB |
Output is correct |
9 |
Correct |
2 ms |
816 KB |
Output is correct |
10 |
Correct |
2 ms |
892 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
892 KB |
Output is correct |
2 |
Correct |
2 ms |
892 KB |
Output is correct |
3 |
Correct |
2 ms |
940 KB |
Output is correct |
4 |
Correct |
3 ms |
940 KB |
Output is correct |
5 |
Correct |
3 ms |
940 KB |
Output is correct |
6 |
Correct |
4 ms |
1008 KB |
Output is correct |
7 |
Correct |
3 ms |
1076 KB |
Output is correct |
8 |
Correct |
3 ms |
1136 KB |
Output is correct |
9 |
Correct |
3 ms |
1192 KB |
Output is correct |
10 |
Correct |
3 ms |
1284 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
50 ms |
3240 KB |
Output is correct |
2 |
Correct |
55 ms |
5348 KB |
Output is correct |
3 |
Correct |
59 ms |
7556 KB |
Output is correct |
4 |
Correct |
51 ms |
9268 KB |
Output is correct |
5 |
Correct |
72 ms |
11968 KB |
Output is correct |
6 |
Correct |
73 ms |
14756 KB |
Output is correct |
7 |
Correct |
77 ms |
17668 KB |
Output is correct |
8 |
Correct |
63 ms |
19620 KB |
Output is correct |
9 |
Correct |
77 ms |
22960 KB |
Output is correct |
10 |
Correct |
73 ms |
25624 KB |
Output is correct |