Submission #14678

#TimeUsernameProblemLanguageResultExecution timeMemory
14678Fakeable사냥꾼 (KOI13_hunter)C++98
100 / 100
90 ms2256 KiB
#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); sort(p,p+d); 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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...