Submission #726214

# Submission time Handle Problem Language Result Execution time Memory
726214 2023-04-18T16:45:06 Z hollwo_pelw Mars (APIO22_mars) C++17
100 / 100
2702 ms 5728 KB
#include "mars.h"

#ifdef hollwo_pelw_local
#include "grader.cpp"
#endif

#include <bits/stdc++.h>
using namespace std;

const int N = 50;

#define pii pair<int, int> 
#define x first
#define y second

bool board[N][N];
int vis[N][N];
vector<pii> adj[N][N]; // boundary of 4 corners

const int dx[] = {-1, 0, +1, 0};
const int dy[] = {0, -1, 0, +1};

void dfs(int x, int y) {
	for (int d = 0; d < 4; d++) {
		int nx = x + dx[d], ny = y + dy[d];
		if (nx < 0 || ny < 0) continue;
		if (board[nx][ny] && vis[nx][ny] == -1)
			vis[nx][ny] = vis[x][y], dfs(nx, ny);
	}

	for (auto [nx, ny] : adj[x][y]) {
		if (board[nx][ny] && vis[nx][ny] == -1)
			vis[nx][ny] = vis[x][y], dfs(nx, ny);
	}
}

int decode(const string &s) {
	int v = 0, len = s.size();
	for (int i = 0; i < min(20, len); i++)
		v |= (s[i] == '1') << i;
	return v;
}

int decode(const string &s, int p, int len) {
	return decode(s.substr(p, len));
}

string encode(int len, int v) {
	string res(len, '0');
	for (int i = 0; i < min(20, len); i++)
		res[i] = "01"[v >> i & 1];
	return res;
}

string process(vector<vector<string>> s, int i, int j, int k, int n) {
	memset(vis, -1, sizeof vis);
	memset(board, 0, sizeof board);

	for (int i = 0; i <= 2 * n; i++) {
		for (int j = 0; j <= 2 * n; j++)
			adj[i][j].clear();
	}

	if (n == 1) {
		for (int i = 0; i <= 2 * n; i++) {
			for (int j = 0; j <= 2 * n; j++) {
				board[i][j] = s[i][j][0] == '1';
			}
		}

		int res = 0;
		for (int i = 0; i <= 2 * n; i++) for (int j = 0; j <= 2 * n; j++) {
			if (board[i][j] && vis[i][j] == -1) {
				vis[i][j] = res ++, dfs(i, j);
			}
		}

		return encode(100, res);

	}

	pii cur[N][N], nxt[N][N];


	for (int x = 0; x <= 2 * n; x++) {
		for (int y = 0; y <= 2 * n; y++) {
			cur[x][y] = {min(x * n / 2, x + 2 * k)      , min(y * n / 2, y + 2 * k)      };
			nxt[x][y] = {min(x * n / 2, x + 2 * (k + 1)), min(y * n / 2, y + 2 * (k + 1))};
		}
	}

	vector<pii> bound[4];
	for (int i = 0; i <= n; i++) {
		bound[0].push_back({n, i});
		bound[1].push_back({n, n * 2 - i});
		bound[2].push_back({n, i});
		bound[3].push_back({n, n * 2 - i});
	}
	for (int i = 1; i <= n; i++) {
		bound[0].push_back({n - i, n});
		bound[1].push_back({n - i, n});
		bound[2].push_back({n + i, n});
		bound[3].push_back({n + i, n});
	}

	if (k == n - 1) {
		// solve last step
		int res = 0;
		for (int fx : {0, 2}) for (int fy : {0, 2}) {
			auto curbound = bound[fx + fy / 2];

			string mask = s[fx][fy].substr(0, 41);
			string A = s[fx][fy].substr(41, 21);
			string B = s[fx][fy].substr(62, 21);
			res += decode(s[fx][fy], 83, 17);


			vector<int> comp;
			for (int i = 0; i <= 2 * n; i++) {
				if (mask[i] & 1) {
					auto [x, y] = curbound[i];
					board[x][y] = 1;
				}
				if ((mask[i] & 1) && (i == 0 || !(mask[i - 1] & 1)))
					comp.push_back(i);
			}

			vector<int> stk;


			for (int i = 0, m = comp.size(); i < m; i++) {
				if (A[i] & 1) {
					stk.push_back(i);
				} else {
					auto [x1, y1] = curbound[comp[stk.back()]];
					auto [x2, y2] = curbound[comp[i]];



					adj[x1][y1].push_back({x2, y2});
					adj[x2][y2].push_back({x1, y1});
				}

				if (B[i] & 1) {
					stk.pop_back();
				}
			}
		}

		for (int i = 0; i <= 2 * n; i++) for (int j = 0; j <= 2 * n; j++) {
			if (board[i][j] && vis[i][j] == -1) {
				vis[i][j] = ++ res, dfs(i, j);
			}
		}

		return encode(100, res);
	}
	if (k == n - 2) {
		// solve second last
		if (i % 2 == 1 || j % 2 == 1)
			return string(100, '0');
		auto curbound = bound[i + j / 2];
		int xl = 0, xr = n, yl = 0, yr = n;
		if (i) xl += n, xr += n;
		if (j) yl += n, yr += n;

		for (int x = xl; x <= xr; x++) for (int y = yl; y <= yr; y++) {
			bool ok = 0;
			for (int fx = 3; fx --; ) for (int fy = 3; fy -- && !ok; ) {
				int ox = x - cur[i + fx][j + fy].x;
				int oy = y - cur[i + fx][j + fy].y;
				if (ox < 0 || oy < 0 || ox >= 10 || oy >= 10)
					continue;
				board[x][y] = s[fx][fy][ox * 10 + oy] == '1', ok = 1;
			}
		}

		int cnt_oth = 0, cnt_bnd = 0;

		for (auto [x, y] : curbound) {
			if (board[x][y] && vis[x][y] == -1) {
				vis[x][y] = ++ cnt_bnd, dfs(x, y);
			}
		}

		for (int x = xl; x <= xr; x++) for (int y = yl; y <= yr; y++) {
			if (board[x][y] && vis[x][y] == -1)
				vis[x][y] = ++ cnt_oth, dfs(x, y);
		}


		assert((int) curbound.size() == 2 * n + 1);

		string mask(41, '0'), A(21, '0'), B(21, '0');
		
		vector<pair<int, int>> comp;

		for (int i = 0; i <= 2 * n; i++) {
			auto [x, y] = curbound[i];
			mask[i] = "01"[board[x][y]];
			if ((mask[i] & 1) && (i == 0 || !(mask[i - 1] & 1)))
				comp.push_back({i, vis[x][y]});
		}

		for (int i = 0, m = comp.size(); i < m; i++) {
			bool isA = 1, isB = 1;
			for (int j = 0; j < i; j++)
				isA &= comp[j].second != comp[i].second;
			for (int j = i + 1; j < m; j++)
				isB &= comp[j].second != comp[i].second;
			A[i] = "01"[isA], B[i] = "01"[isB];
		}
		// mask = component
		// A = open bracket
		// B = close bracket
		return mask + A + B + encode(17, cnt_oth);
	}
	// solve other case

	string res(100, '0');
	for (int x = 0; x < 10; x++) for (int y = 0; y < 10; y++) {
		bool ok = 0;
		for (int fx = 3; fx --; ) for (int fy = 3; fy -- && !ok; ) {
			int ox = x + nxt[i][j].x - cur[i + fx][j + fy].x;
			int oy = y + nxt[i][j].y - cur[i + fx][j + fy].y;

			if (ox < 0 || ox >= 10 || oy < 0 || oy >= 10)
				continue;

			res[x * 10 + y] = s[fx][fy][ox * 10 + oy], ok = 1;
		}
	}

	return res;
}
# Verdict Execution time Memory Grader output
1 Correct 8 ms 2672 KB Output is correct
2 Correct 8 ms 2720 KB Output is correct
3 Correct 8 ms 2716 KB Output is correct
4 Correct 8 ms 2760 KB Output is correct
5 Correct 8 ms 2696 KB Output is correct
6 Correct 8 ms 2716 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 2672 KB Output is correct
2 Correct 8 ms 2720 KB Output is correct
3 Correct 8 ms 2716 KB Output is correct
4 Correct 8 ms 2760 KB Output is correct
5 Correct 8 ms 2696 KB Output is correct
6 Correct 8 ms 2716 KB Output is correct
7 Correct 14 ms 2696 KB Output is correct
8 Correct 19 ms 2880 KB Output is correct
9 Correct 20 ms 2916 KB Output is correct
10 Correct 20 ms 2704 KB Output is correct
11 Correct 20 ms 2708 KB Output is correct
12 Correct 20 ms 2928 KB Output is correct
13 Correct 17 ms 2880 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 2672 KB Output is correct
2 Correct 8 ms 2720 KB Output is correct
3 Correct 8 ms 2716 KB Output is correct
4 Correct 8 ms 2760 KB Output is correct
5 Correct 8 ms 2696 KB Output is correct
6 Correct 8 ms 2716 KB Output is correct
7 Correct 14 ms 2696 KB Output is correct
8 Correct 19 ms 2880 KB Output is correct
9 Correct 20 ms 2916 KB Output is correct
10 Correct 20 ms 2704 KB Output is correct
11 Correct 20 ms 2708 KB Output is correct
12 Correct 20 ms 2928 KB Output is correct
13 Correct 17 ms 2880 KB Output is correct
14 Correct 38 ms 3020 KB Output is correct
15 Correct 56 ms 3380 KB Output is correct
16 Correct 54 ms 3376 KB Output is correct
17 Correct 55 ms 3360 KB Output is correct
18 Correct 61 ms 3368 KB Output is correct
19 Correct 62 ms 3344 KB Output is correct
20 Correct 59 ms 3356 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 2672 KB Output is correct
2 Correct 8 ms 2720 KB Output is correct
3 Correct 8 ms 2716 KB Output is correct
4 Correct 8 ms 2760 KB Output is correct
5 Correct 8 ms 2696 KB Output is correct
6 Correct 8 ms 2716 KB Output is correct
7 Correct 14 ms 2696 KB Output is correct
8 Correct 19 ms 2880 KB Output is correct
9 Correct 20 ms 2916 KB Output is correct
10 Correct 20 ms 2704 KB Output is correct
11 Correct 20 ms 2708 KB Output is correct
12 Correct 20 ms 2928 KB Output is correct
13 Correct 17 ms 2880 KB Output is correct
14 Correct 38 ms 3020 KB Output is correct
15 Correct 56 ms 3380 KB Output is correct
16 Correct 54 ms 3376 KB Output is correct
17 Correct 55 ms 3360 KB Output is correct
18 Correct 61 ms 3368 KB Output is correct
19 Correct 62 ms 3344 KB Output is correct
20 Correct 59 ms 3356 KB Output is correct
21 Correct 86 ms 3588 KB Output is correct
22 Correct 121 ms 3616 KB Output is correct
23 Correct 120 ms 3604 KB Output is correct
24 Correct 124 ms 3576 KB Output is correct
25 Correct 118 ms 3548 KB Output is correct
26 Correct 133 ms 3612 KB Output is correct
27 Correct 122 ms 3604 KB Output is correct
28 Correct 139 ms 3588 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 2672 KB Output is correct
2 Correct 8 ms 2720 KB Output is correct
3 Correct 8 ms 2716 KB Output is correct
4 Correct 8 ms 2760 KB Output is correct
5 Correct 8 ms 2696 KB Output is correct
6 Correct 8 ms 2716 KB Output is correct
7 Correct 14 ms 2696 KB Output is correct
8 Correct 19 ms 2880 KB Output is correct
9 Correct 20 ms 2916 KB Output is correct
10 Correct 20 ms 2704 KB Output is correct
11 Correct 20 ms 2708 KB Output is correct
12 Correct 20 ms 2928 KB Output is correct
13 Correct 17 ms 2880 KB Output is correct
14 Correct 38 ms 3020 KB Output is correct
15 Correct 56 ms 3380 KB Output is correct
16 Correct 54 ms 3376 KB Output is correct
17 Correct 55 ms 3360 KB Output is correct
18 Correct 61 ms 3368 KB Output is correct
19 Correct 62 ms 3344 KB Output is correct
20 Correct 59 ms 3356 KB Output is correct
21 Correct 86 ms 3588 KB Output is correct
22 Correct 121 ms 3616 KB Output is correct
23 Correct 120 ms 3604 KB Output is correct
24 Correct 124 ms 3576 KB Output is correct
25 Correct 118 ms 3548 KB Output is correct
26 Correct 133 ms 3612 KB Output is correct
27 Correct 122 ms 3604 KB Output is correct
28 Correct 139 ms 3588 KB Output is correct
29 Correct 179 ms 3652 KB Output is correct
30 Correct 225 ms 3736 KB Output is correct
31 Correct 245 ms 3748 KB Output is correct
32 Correct 245 ms 3880 KB Output is correct
33 Correct 262 ms 3740 KB Output is correct
34 Correct 241 ms 3732 KB Output is correct
35 Correct 258 ms 3744 KB Output is correct
36 Correct 250 ms 3688 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 2672 KB Output is correct
2 Correct 8 ms 2720 KB Output is correct
3 Correct 8 ms 2716 KB Output is correct
4 Correct 8 ms 2760 KB Output is correct
5 Correct 8 ms 2696 KB Output is correct
6 Correct 8 ms 2716 KB Output is correct
7 Correct 14 ms 2696 KB Output is correct
8 Correct 19 ms 2880 KB Output is correct
9 Correct 20 ms 2916 KB Output is correct
10 Correct 20 ms 2704 KB Output is correct
11 Correct 20 ms 2708 KB Output is correct
12 Correct 20 ms 2928 KB Output is correct
13 Correct 17 ms 2880 KB Output is correct
14 Correct 38 ms 3020 KB Output is correct
15 Correct 56 ms 3380 KB Output is correct
16 Correct 54 ms 3376 KB Output is correct
17 Correct 55 ms 3360 KB Output is correct
18 Correct 61 ms 3368 KB Output is correct
19 Correct 62 ms 3344 KB Output is correct
20 Correct 59 ms 3356 KB Output is correct
21 Correct 86 ms 3588 KB Output is correct
22 Correct 121 ms 3616 KB Output is correct
23 Correct 120 ms 3604 KB Output is correct
24 Correct 124 ms 3576 KB Output is correct
25 Correct 118 ms 3548 KB Output is correct
26 Correct 133 ms 3612 KB Output is correct
27 Correct 122 ms 3604 KB Output is correct
28 Correct 139 ms 3588 KB Output is correct
29 Correct 179 ms 3652 KB Output is correct
30 Correct 225 ms 3736 KB Output is correct
31 Correct 245 ms 3748 KB Output is correct
32 Correct 245 ms 3880 KB Output is correct
33 Correct 262 ms 3740 KB Output is correct
34 Correct 241 ms 3732 KB Output is correct
35 Correct 258 ms 3744 KB Output is correct
36 Correct 250 ms 3688 KB Output is correct
37 Correct 344 ms 3916 KB Output is correct
38 Correct 446 ms 4188 KB Output is correct
39 Correct 459 ms 4148 KB Output is correct
40 Correct 492 ms 4084 KB Output is correct
41 Correct 465 ms 4088 KB Output is correct
42 Correct 492 ms 4168 KB Output is correct
43 Correct 476 ms 4056 KB Output is correct
44 Correct 495 ms 4072 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 2672 KB Output is correct
2 Correct 8 ms 2720 KB Output is correct
3 Correct 8 ms 2716 KB Output is correct
4 Correct 8 ms 2760 KB Output is correct
5 Correct 8 ms 2696 KB Output is correct
6 Correct 8 ms 2716 KB Output is correct
7 Correct 14 ms 2696 KB Output is correct
8 Correct 19 ms 2880 KB Output is correct
9 Correct 20 ms 2916 KB Output is correct
10 Correct 20 ms 2704 KB Output is correct
11 Correct 20 ms 2708 KB Output is correct
12 Correct 20 ms 2928 KB Output is correct
13 Correct 17 ms 2880 KB Output is correct
14 Correct 38 ms 3020 KB Output is correct
15 Correct 56 ms 3380 KB Output is correct
16 Correct 54 ms 3376 KB Output is correct
17 Correct 55 ms 3360 KB Output is correct
18 Correct 61 ms 3368 KB Output is correct
19 Correct 62 ms 3344 KB Output is correct
20 Correct 59 ms 3356 KB Output is correct
21 Correct 86 ms 3588 KB Output is correct
22 Correct 121 ms 3616 KB Output is correct
23 Correct 120 ms 3604 KB Output is correct
24 Correct 124 ms 3576 KB Output is correct
25 Correct 118 ms 3548 KB Output is correct
26 Correct 133 ms 3612 KB Output is correct
27 Correct 122 ms 3604 KB Output is correct
28 Correct 139 ms 3588 KB Output is correct
29 Correct 179 ms 3652 KB Output is correct
30 Correct 225 ms 3736 KB Output is correct
31 Correct 245 ms 3748 KB Output is correct
32 Correct 245 ms 3880 KB Output is correct
33 Correct 262 ms 3740 KB Output is correct
34 Correct 241 ms 3732 KB Output is correct
35 Correct 258 ms 3744 KB Output is correct
36 Correct 250 ms 3688 KB Output is correct
37 Correct 344 ms 3916 KB Output is correct
38 Correct 446 ms 4188 KB Output is correct
39 Correct 459 ms 4148 KB Output is correct
40 Correct 492 ms 4084 KB Output is correct
41 Correct 465 ms 4088 KB Output is correct
42 Correct 492 ms 4168 KB Output is correct
43 Correct 476 ms 4056 KB Output is correct
44 Correct 495 ms 4072 KB Output is correct
45 Correct 651 ms 4148 KB Output is correct
46 Correct 851 ms 4348 KB Output is correct
47 Correct 867 ms 4364 KB Output is correct
48 Correct 818 ms 4304 KB Output is correct
49 Correct 805 ms 4284 KB Output is correct
50 Correct 865 ms 4324 KB Output is correct
51 Correct 815 ms 4296 KB Output is correct
52 Correct 841 ms 4320 KB Output is correct
53 Correct 819 ms 4368 KB Output is correct
54 Correct 757 ms 4264 KB Output is correct
55 Correct 753 ms 4296 KB Output is correct
56 Correct 751 ms 4260 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 2672 KB Output is correct
2 Correct 8 ms 2720 KB Output is correct
3 Correct 8 ms 2716 KB Output is correct
4 Correct 8 ms 2760 KB Output is correct
5 Correct 8 ms 2696 KB Output is correct
6 Correct 8 ms 2716 KB Output is correct
7 Correct 14 ms 2696 KB Output is correct
8 Correct 19 ms 2880 KB Output is correct
9 Correct 20 ms 2916 KB Output is correct
10 Correct 20 ms 2704 KB Output is correct
11 Correct 20 ms 2708 KB Output is correct
12 Correct 20 ms 2928 KB Output is correct
13 Correct 17 ms 2880 KB Output is correct
14 Correct 38 ms 3020 KB Output is correct
15 Correct 56 ms 3380 KB Output is correct
16 Correct 54 ms 3376 KB Output is correct
17 Correct 55 ms 3360 KB Output is correct
18 Correct 61 ms 3368 KB Output is correct
19 Correct 62 ms 3344 KB Output is correct
20 Correct 59 ms 3356 KB Output is correct
21 Correct 86 ms 3588 KB Output is correct
22 Correct 121 ms 3616 KB Output is correct
23 Correct 120 ms 3604 KB Output is correct
24 Correct 124 ms 3576 KB Output is correct
25 Correct 118 ms 3548 KB Output is correct
26 Correct 133 ms 3612 KB Output is correct
27 Correct 122 ms 3604 KB Output is correct
28 Correct 139 ms 3588 KB Output is correct
29 Correct 179 ms 3652 KB Output is correct
30 Correct 225 ms 3736 KB Output is correct
31 Correct 245 ms 3748 KB Output is correct
32 Correct 245 ms 3880 KB Output is correct
33 Correct 262 ms 3740 KB Output is correct
34 Correct 241 ms 3732 KB Output is correct
35 Correct 258 ms 3744 KB Output is correct
36 Correct 250 ms 3688 KB Output is correct
37 Correct 344 ms 3916 KB Output is correct
38 Correct 446 ms 4188 KB Output is correct
39 Correct 459 ms 4148 KB Output is correct
40 Correct 492 ms 4084 KB Output is correct
41 Correct 465 ms 4088 KB Output is correct
42 Correct 492 ms 4168 KB Output is correct
43 Correct 476 ms 4056 KB Output is correct
44 Correct 495 ms 4072 KB Output is correct
45 Correct 651 ms 4148 KB Output is correct
46 Correct 851 ms 4348 KB Output is correct
47 Correct 867 ms 4364 KB Output is correct
48 Correct 818 ms 4304 KB Output is correct
49 Correct 805 ms 4284 KB Output is correct
50 Correct 865 ms 4324 KB Output is correct
51 Correct 815 ms 4296 KB Output is correct
52 Correct 841 ms 4320 KB Output is correct
53 Correct 819 ms 4368 KB Output is correct
54 Correct 757 ms 4264 KB Output is correct
55 Correct 753 ms 4296 KB Output is correct
56 Correct 751 ms 4260 KB Output is correct
57 Correct 1027 ms 4756 KB Output is correct
58 Correct 1258 ms 4788 KB Output is correct
59 Correct 1525 ms 4724 KB Output is correct
60 Correct 1430 ms 4876 KB Output is correct
61 Correct 1456 ms 4748 KB Output is correct
62 Correct 1430 ms 4724 KB Output is correct
63 Correct 1546 ms 5096 KB Output is correct
64 Correct 1563 ms 4884 KB Output is correct
65 Correct 1412 ms 4764 KB Output is correct
66 Correct 1296 ms 4896 KB Output is correct
67 Correct 1308 ms 4956 KB Output is correct
68 Correct 1291 ms 5012 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 2672 KB Output is correct
2 Correct 8 ms 2720 KB Output is correct
3 Correct 8 ms 2716 KB Output is correct
4 Correct 8 ms 2760 KB Output is correct
5 Correct 8 ms 2696 KB Output is correct
6 Correct 8 ms 2716 KB Output is correct
7 Correct 14 ms 2696 KB Output is correct
8 Correct 19 ms 2880 KB Output is correct
9 Correct 20 ms 2916 KB Output is correct
10 Correct 20 ms 2704 KB Output is correct
11 Correct 20 ms 2708 KB Output is correct
12 Correct 20 ms 2928 KB Output is correct
13 Correct 17 ms 2880 KB Output is correct
14 Correct 38 ms 3020 KB Output is correct
15 Correct 56 ms 3380 KB Output is correct
16 Correct 54 ms 3376 KB Output is correct
17 Correct 55 ms 3360 KB Output is correct
18 Correct 61 ms 3368 KB Output is correct
19 Correct 62 ms 3344 KB Output is correct
20 Correct 59 ms 3356 KB Output is correct
21 Correct 86 ms 3588 KB Output is correct
22 Correct 121 ms 3616 KB Output is correct
23 Correct 120 ms 3604 KB Output is correct
24 Correct 124 ms 3576 KB Output is correct
25 Correct 118 ms 3548 KB Output is correct
26 Correct 133 ms 3612 KB Output is correct
27 Correct 122 ms 3604 KB Output is correct
28 Correct 139 ms 3588 KB Output is correct
29 Correct 179 ms 3652 KB Output is correct
30 Correct 225 ms 3736 KB Output is correct
31 Correct 245 ms 3748 KB Output is correct
32 Correct 245 ms 3880 KB Output is correct
33 Correct 262 ms 3740 KB Output is correct
34 Correct 241 ms 3732 KB Output is correct
35 Correct 258 ms 3744 KB Output is correct
36 Correct 250 ms 3688 KB Output is correct
37 Correct 344 ms 3916 KB Output is correct
38 Correct 446 ms 4188 KB Output is correct
39 Correct 459 ms 4148 KB Output is correct
40 Correct 492 ms 4084 KB Output is correct
41 Correct 465 ms 4088 KB Output is correct
42 Correct 492 ms 4168 KB Output is correct
43 Correct 476 ms 4056 KB Output is correct
44 Correct 495 ms 4072 KB Output is correct
45 Correct 651 ms 4148 KB Output is correct
46 Correct 851 ms 4348 KB Output is correct
47 Correct 867 ms 4364 KB Output is correct
48 Correct 818 ms 4304 KB Output is correct
49 Correct 805 ms 4284 KB Output is correct
50 Correct 865 ms 4324 KB Output is correct
51 Correct 815 ms 4296 KB Output is correct
52 Correct 841 ms 4320 KB Output is correct
53 Correct 819 ms 4368 KB Output is correct
54 Correct 757 ms 4264 KB Output is correct
55 Correct 753 ms 4296 KB Output is correct
56 Correct 751 ms 4260 KB Output is correct
57 Correct 1027 ms 4756 KB Output is correct
58 Correct 1258 ms 4788 KB Output is correct
59 Correct 1525 ms 4724 KB Output is correct
60 Correct 1430 ms 4876 KB Output is correct
61 Correct 1456 ms 4748 KB Output is correct
62 Correct 1430 ms 4724 KB Output is correct
63 Correct 1546 ms 5096 KB Output is correct
64 Correct 1563 ms 4884 KB Output is correct
65 Correct 1412 ms 4764 KB Output is correct
66 Correct 1296 ms 4896 KB Output is correct
67 Correct 1308 ms 4956 KB Output is correct
68 Correct 1291 ms 5012 KB Output is correct
69 Correct 1607 ms 5000 KB Output is correct
70 Correct 1792 ms 5160 KB Output is correct
71 Correct 1791 ms 4972 KB Output is correct
72 Correct 1807 ms 5276 KB Output is correct
73 Correct 1781 ms 5116 KB Output is correct
74 Correct 1821 ms 5020 KB Output is correct
75 Correct 1789 ms 5192 KB Output is correct
76 Correct 1771 ms 4960 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 2672 KB Output is correct
2 Correct 8 ms 2720 KB Output is correct
3 Correct 8 ms 2716 KB Output is correct
4 Correct 8 ms 2760 KB Output is correct
5 Correct 8 ms 2696 KB Output is correct
6 Correct 8 ms 2716 KB Output is correct
7 Correct 14 ms 2696 KB Output is correct
8 Correct 19 ms 2880 KB Output is correct
9 Correct 20 ms 2916 KB Output is correct
10 Correct 20 ms 2704 KB Output is correct
11 Correct 20 ms 2708 KB Output is correct
12 Correct 20 ms 2928 KB Output is correct
13 Correct 17 ms 2880 KB Output is correct
14 Correct 38 ms 3020 KB Output is correct
15 Correct 56 ms 3380 KB Output is correct
16 Correct 54 ms 3376 KB Output is correct
17 Correct 55 ms 3360 KB Output is correct
18 Correct 61 ms 3368 KB Output is correct
19 Correct 62 ms 3344 KB Output is correct
20 Correct 59 ms 3356 KB Output is correct
21 Correct 86 ms 3588 KB Output is correct
22 Correct 121 ms 3616 KB Output is correct
23 Correct 120 ms 3604 KB Output is correct
24 Correct 124 ms 3576 KB Output is correct
25 Correct 118 ms 3548 KB Output is correct
26 Correct 133 ms 3612 KB Output is correct
27 Correct 122 ms 3604 KB Output is correct
28 Correct 139 ms 3588 KB Output is correct
29 Correct 179 ms 3652 KB Output is correct
30 Correct 225 ms 3736 KB Output is correct
31 Correct 245 ms 3748 KB Output is correct
32 Correct 245 ms 3880 KB Output is correct
33 Correct 262 ms 3740 KB Output is correct
34 Correct 241 ms 3732 KB Output is correct
35 Correct 258 ms 3744 KB Output is correct
36 Correct 250 ms 3688 KB Output is correct
37 Correct 344 ms 3916 KB Output is correct
38 Correct 446 ms 4188 KB Output is correct
39 Correct 459 ms 4148 KB Output is correct
40 Correct 492 ms 4084 KB Output is correct
41 Correct 465 ms 4088 KB Output is correct
42 Correct 492 ms 4168 KB Output is correct
43 Correct 476 ms 4056 KB Output is correct
44 Correct 495 ms 4072 KB Output is correct
45 Correct 651 ms 4148 KB Output is correct
46 Correct 851 ms 4348 KB Output is correct
47 Correct 867 ms 4364 KB Output is correct
48 Correct 818 ms 4304 KB Output is correct
49 Correct 805 ms 4284 KB Output is correct
50 Correct 865 ms 4324 KB Output is correct
51 Correct 815 ms 4296 KB Output is correct
52 Correct 841 ms 4320 KB Output is correct
53 Correct 819 ms 4368 KB Output is correct
54 Correct 757 ms 4264 KB Output is correct
55 Correct 753 ms 4296 KB Output is correct
56 Correct 751 ms 4260 KB Output is correct
57 Correct 1027 ms 4756 KB Output is correct
58 Correct 1258 ms 4788 KB Output is correct
59 Correct 1525 ms 4724 KB Output is correct
60 Correct 1430 ms 4876 KB Output is correct
61 Correct 1456 ms 4748 KB Output is correct
62 Correct 1430 ms 4724 KB Output is correct
63 Correct 1546 ms 5096 KB Output is correct
64 Correct 1563 ms 4884 KB Output is correct
65 Correct 1412 ms 4764 KB Output is correct
66 Correct 1296 ms 4896 KB Output is correct
67 Correct 1308 ms 4956 KB Output is correct
68 Correct 1291 ms 5012 KB Output is correct
69 Correct 1607 ms 5000 KB Output is correct
70 Correct 1792 ms 5160 KB Output is correct
71 Correct 1791 ms 4972 KB Output is correct
72 Correct 1807 ms 5276 KB Output is correct
73 Correct 1781 ms 5116 KB Output is correct
74 Correct 1821 ms 5020 KB Output is correct
75 Correct 1789 ms 5192 KB Output is correct
76 Correct 1771 ms 4960 KB Output is correct
77 Correct 1829 ms 5228 KB Output is correct
78 Correct 2664 ms 5728 KB Output is correct
79 Correct 2662 ms 5536 KB Output is correct
80 Correct 2691 ms 5616 KB Output is correct
81 Correct 2632 ms 5672 KB Output is correct
82 Correct 2702 ms 5636 KB Output is correct
83 Correct 2639 ms 5680 KB Output is correct
84 Correct 2623 ms 5696 KB Output is correct