이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |