Submission #4547

#TimeUsernameProblemLanguageResultExecution timeMemory
4547cki86201사냥꾼 (KOI13_hunter)C++98
100 / 100
76 ms2260 KiB
#include<stdio.h> #include<algorithm> #include<string.h> #include<vector> #include<math.h> #include<stdlib.h> #include<set> #include<ctype.h> using namespace std; #define X first #define Y second typedef long long ll; typedef pair<int,int> Pi; int p[100010]; int a[100010],b[100010]; int n,m; int get_min(int x) { int st=1,en=n,mi,ret=0; while(st<=en){ mi=(st+en)>>1; if(p[mi]<=x)st=mi+1,ret=mi; else en=mi-1; } if(ret==0)return abs(p[1]-x); if(ret!=n)return min(abs(p[ret]-x),abs(p[ret+1]-x)); return abs(p[ret]-x); } int main() { int i,c=0,l; scanf("%d%d%d",&n,&m,&l); for(i=1;i<=n;i++)scanf("%d",p+i); sort(p+1,p+1+n); for(i=1;i<=m;i++)scanf("%d%d",a+i,b+i); for(i=1;i<=m;i++){ if(get_min(a[i])+b[i]<=l)c++; } printf("%d\n",c); 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...