Submission #5326

#TimeUsernameProblemLanguageResultExecution timeMemory
5326baneling100사냥꾼 (KOI13_hunter)C++98
100 / 100
88 ms2260 KiB
#include <stdio.h> #include <algorithm> using namespace std; int m, n, l, shoot[100001], x[100001], y[100001], ans; void input(void) { int i; scanf("%d %d %d",&m,&n,&l); for(i=1 ; i<=m ; i++) scanf("%d",&shoot[i]); sort(shoot+1,shoot+m+1); for(i=1 ; i<=n ; i++) scanf("%d %d",&x[i],&y[i]); } void process(void) { int i, a, b, left, right; for(i=1 ; i<=n ; i++) { a=x[i]-l+y[i]; b=x[i]+l-y[i]; left=lower_bound(&shoot[1],&shoot[m]+1,a)-shoot; right=upper_bound(&shoot[1],&shoot[m]+1,b)-shoot-1; if(left<=right) ans++; } } void output(void) { printf("%d",ans); } int main(void) { 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...