Submission #71668658


Source Code Expand

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#define debug(arg) cout << "[" << #arg << "]: " << arg << endl
#else
#define debug(arg) 42
#endif

using llu = uint64_t;
using ll = int64_t;

#define vec vector
#define pb push_back
#define all(n) begin(n), end(n)

void solv() {
	int n, q; cin >> n >> q;
	set<pair<int, int>> fish;
	int ans = 0;
	while (q--) {
		int x, y; cin >> x >> y;
		bool good = true;
		for (int i = 0; i < 4; ++i) good &= !fish.contains({x + (i&1), y + (i >> 1)});
		if (good) {
			++ans;
			for (int i = 0; i < 4; ++i) fish.insert({x + (i&1), y + (i >> 1)});
		}
	}
	cout << ans << '\n';
}

signed main() {
	ios_base::sync_with_stdio(0), cin.tie(0);
	int t = 1;
	//cin >> t;
	while (t--) solv();
	return 0;
}

Submission Info

Submission Time
Task C - 2x2 Placing
User fisher199
Language C++23 (Clang 21.1.0)
Score 300
Code Size 787 Byte
Status AC
Exec Time 533 ms
Memory 40588 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 36
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 02_random2_00.txt, 02_random2_01.txt, 02_random2_02.txt, 02_random2_03.txt, 02_random2_04.txt, 02_random2_05.txt, 02_random2_06.txt, 02_random2_07.txt, 02_random2_08.txt, 02_random2_09.txt, 02_random2_10.txt, 02_random2_11.txt, 02_random2_12.txt, 02_random2_13.txt, 02_random2_14.txt, 02_random2_15.txt, 03_handmade_00.txt, 03_handmade_01.txt, 03_handmade_02.txt, 03_handmade_03.txt, 03_handmade_04.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 2916 KiB
00_sample_01.txt AC 1 ms 2904 KiB
00_sample_02.txt AC 1 ms 2900 KiB
01_random_00.txt AC 29 ms 2936 KiB
01_random_01.txt AC 73 ms 2916 KiB
01_random_02.txt AC 69 ms 3076 KiB
01_random_03.txt AC 109 ms 3196 KiB
01_random_04.txt AC 80 ms 10292 KiB
01_random_05.txt AC 137 ms 4100 KiB
01_random_06.txt AC 233 ms 24188 KiB
01_random_07.txt AC 469 ms 38628 KiB
01_random_08.txt AC 251 ms 22328 KiB
01_random_09.txt AC 481 ms 40404 KiB
01_random_10.txt AC 74 ms 10744 KiB
01_random_11.txt AC 498 ms 40588 KiB
02_random2_00.txt AC 533 ms 40588 KiB
02_random2_01.txt AC 533 ms 40460 KiB
02_random2_02.txt AC 533 ms 40248 KiB
02_random2_03.txt AC 531 ms 39604 KiB
02_random2_04.txt AC 531 ms 39268 KiB
02_random2_05.txt AC 527 ms 38912 KiB
02_random2_06.txt AC 521 ms 38280 KiB
02_random2_07.txt AC 514 ms 37172 KiB
02_random2_08.txt AC 507 ms 36216 KiB
02_random2_09.txt AC 502 ms 34836 KiB
02_random2_10.txt AC 466 ms 32504 KiB
02_random2_11.txt AC 449 ms 29832 KiB
02_random2_12.txt AC 417 ms 25300 KiB
02_random2_13.txt AC 352 ms 19972 KiB
02_random2_14.txt AC 282 ms 12540 KiB
02_random2_15.txt AC 188 ms 3172 KiB
03_handmade_00.txt AC 72 ms 3092 KiB
03_handmade_01.txt AC 371 ms 21944 KiB
03_handmade_02.txt AC 405 ms 21808 KiB
03_handmade_03.txt AC 316 ms 21720 KiB
03_handmade_04.txt AC 263 ms 15636 KiB