Submission #17597

#TimeUsernameProblemLanguageResultExecution timeMemory
17597Namnamseo사냥꾼 (KOI13_hunter)C++98
100 / 100
93 ms2256 KiB
#include <cstdio> #include <algorithm> #define x first #define y second using namespace std; pair<int,int> animal[100010]; int hunter[100010]; int n,m,l; int abs(int a) { return a>0?a:-a; } bool canCatch(int h,int a){ return abs(animal[a].x-h)+animal[a].y<=l; } int main() { scanf("%d%d%d",&m,&n,&l); int i,j; for(i=0;i<m;++i) scanf("%d",hunter+i); sort(hunter,hunter+m); for(i=0;i<n;++i) scanf("%d%d",&animal[i].first,&animal[i].second); int ans=0; int lb,rb; for(i=0;i<n;++i){ if(animal[i].y>l) continue; lb=animal[i].x+animal[i].y-l; rb=animal[i].x-animal[i].y+l; if(lower_bound(hunter,hunter+m,lb)<upper_bound(hunter,hunter+m,rb)) ++ans; } printf("%d\n",ans); 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...