Submission #4994

#TimeUsernameProblemLanguageResultExecution timeMemory
4994ansol4328사냥꾼 (KOI13_hunter)C++98
100 / 100
72 ms2264 KiB
#include<stdio.h> #include<stdlib.h> #include<algorithm> struct xy { int x, y; }; int cmp(const xy &aa, const xy &bb) { return aa.x<bb.x || (aa.x==bb.x && aa.y<bb.y); } xy a[100002]; int n, m, l, g[100002]; int cnt; int input() { int i; scanf("%d %d %d",&m,&n,&l); for(i=1 ; i<=m ; i++) scanf("%d",&g[i]); for(i=1 ; i<=n ; i++) scanf("%d %d",&a[i].x,&a[i].y); std::sort(g+1,g+1+m); std::sort(a+1,a+1+n,cmp); return 0; } int process() { int i=1, j=1, d; while(j<=n) { while(g[i]+(g[i+1]-g[i])/2+(g[i+1]-g[i])%2<=a[j].x && i!=m) {i++;} d=abs(a[j].x-g[i])+a[j].y; if(d<=l) cnt++; j++; } return 0; } int output() { printf("%d",cnt); return 0; } int main() { input(); process(); output(); 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...