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<cstdio>
#include<algorithm>
#include<utility>
#define pi pair<int,int>
using namespace std;
const int max_n = 100100;
int n,d,l,x[max_n];
pi p[max_n];
inline int Abs(int x) {
return x>0?x:-x;
}
void input() {
scanf("%d %d %d",&n,&d,&l);
for(int i=0;i<n;i++) scanf("%d",&x[i]);
x[n] = 2000000001;
for(int i=0;i<d;i++) scanf("%d %d",&p[i].first, &p[i].second);
sort(x,x+n);
return;
}
int find(int front,int rear,int crit) {
if(front == rear) return front;
int mid = (front + rear + 1) / 2;
if(x[mid] >= crit) return find(front,mid-1,crit);
return find(mid,rear,crit);
}
void solve() {
int print = 0;
for(int i=0;i<d;i++) {
int close = find(0,n-1,p[i].first);
if(l-p[i].second >= Abs(p[i].first - x[close]) || l-p[i].second >= Abs(p[i].first-x[close+1])) print++;
}
printf("%d\n",print);
return;
}
int main() {
input();
solve();
return 0;
}
# | 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... |