Submission #76049

#TimeUsernameProblemLanguageResultExecution timeMemory
76049chunghan사냥꾼 (KOI13_hunter)C++14
0 / 100
99 ms1508 KiB
#include<iostream> #include<algorithm> #include<math.h> using namespace std; typedef pair<int, int> pii; int m, n, l, x[100000], cnt, c[100000]; pii ani[100000]; int dist(int a, int x) { return abs(x - ani[a].first) + ani[a].second; } void find() { int k = 0; for(int i = 0; i < n; i++) { if(abs(ani[i].first-x[k]) > abs(ani[i].first-x[k+1])) k++; c[i] = k; } } int main() { cin >> m >> n >> l; for(int i = 0; i < m; i++) cin >> x[i]; for(int i = 0, a, b; i < n; i++) { cin >> a >> b; ani[i] = pii(a, b); } sort(x, x+m); sort(ani, ani+n); find(); for(int i = 0; i < n; i++) if(dist(i, x[c[i]]) <= l) cnt++; cout << cnt; 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...