Submission #276788

#TimeUsernameProblemLanguageResultExecution timeMemory
276788sean9892사냥꾼 (KOI13_hunter)C++14
100 / 100
70 ms4344 KiB
#include<bits/stdc++.h> using namespace std; int main(void){ ios::sync_with_stdio(0);cin.tie(0); int m,n,l; cin>>m>>n>>l; vector<int> h(m),x(n),y(n);//hunter, animal for(int i=0;i<m;i++){ cin>>h[i]; } for(int i=0;i<n;i++){ cin>>x[i]>>y[i]; } sort(h.begin(),h.end()); int cnt=0; for(int i=0;i<n;i++){ if(l<y[i])continue; int lb=lower_bound(h.begin(),h.end(),x[i])-h.begin(); int ub=lower_bound(h.begin(),h.end(),x[i])-h.begin(); if(lb!=ub){ cnt++; } else{ for(int j=ub-3;j<ub+4;j++){ if(j<0||j>=m)continue; if(abs(x[i]-h[j])+y[i]<=l){ cnt++; break; } } } } cout<<cnt; }
#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...