Submission #544648

# Submission time Handle Problem Language Result Execution time Memory
544648 2022-04-02T14:12:11 Z pokmui9909 사냥꾼 (KOI13_hunter) C++17
100 / 100
50 ms 4308 KB
#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 time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 0 ms 328 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 328 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 2 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 2 ms 340 KB Output is correct
8 Correct 1 ms 468 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 35 ms 2584 KB Output is correct
2 Correct 36 ms 3032 KB Output is correct
3 Correct 40 ms 3276 KB Output is correct
4 Correct 33 ms 3004 KB Output is correct
5 Correct 46 ms 3944 KB Output is correct
6 Correct 50 ms 4016 KB Output is correct
7 Correct 50 ms 4308 KB Output is correct
8 Correct 37 ms 3528 KB Output is correct
9 Correct 47 ms 4216 KB Output is correct
10 Correct 47 ms 4188 KB Output is correct