This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |