Submission #544648

#TimeUsernameProblemLanguageResultExecution timeMemory
544648pokmui9909사냥꾼 (KOI13_hunter)C++17
100 / 100
50 ms4308 KiB
#include <bits/stdc++.h> using namespace std; #define x first #define y second int M, N, L; int H[100005]; pair<int, int> A[100005]; signed main() { cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false); cin >> M >> N >> L; for (int i = 0; i < M; i++) cin >> H[i]; for (int i = 0; i < N; i++) cin >> A[i].x >> A[i].y; sort(H, H + M); sort(A, A + N); int ans = 0; for (int i = 0; i < N; i++) { int r = lower_bound(H, H + M, A[i].x) - H; int l = r - 1; int ok = 0; if (0 <= l && l < M) { if (abs(A[i].x - H[l]) + A[i].y <= L) ok = 1; } if (0 <= r && r < M) { if (abs(A[i].x - H[r]) + A[i].y <= L) ok = 1; } if (ok) ans++; } cout << ans; }
#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...