Submission #725583

# Submission time Handle Problem Language Result Execution time Memory
725583 2023-04-17T17:10:36 Z SanguineChameleon Mars (APIO22_mars) C++17
100 / 100
3170 ms 4944 KB
#include "mars.h"
#include <bits/stdc++.h>
using namespace std;
 
string process(vector<vector<string>> a, int cur_i, int cur_j, int cur_k, int n) {
	if (n == 1) {
		const vector<int> dx = {1, -1, 0, 0};
		const vector<int> dy = {0, 0, 1, -1};
		vector<vector<bool>> flag(3);
		for (int i = 0; i < 3; i++) {
			flag[i].resize(3);
		}
		int cnt = 0;
		for (int i = 0; i < 3; i++) {
			for (int j = 0; j < 3; j++) {
				if (!flag[i][j] && a[i][j][0] == '1') {
					flag[i][j] = true;
					deque<pair<int, int>> q = {{i, j}};
					cnt++;
					while (!q.empty()) {
						int cx = q.front().first;
						int cy = q.front().second;
						q.pop_front();
						for (int k = 0; k < 4; k++) {
							int nx = cx + dx[k];
							int ny = cy + dy[k];
							if (0 <= nx && nx < 3 && 0 <= ny && ny < 3 && a[nx][ny][0] == '1' && !flag[nx][ny]) {
								flag[nx][ny] = true;
								q.push_back({nx, ny});
							}
						}
					}
				}
			}
		}
		string res;
		while (cnt) {
			res += (char)('0' + (cnt & 1));
			cnt >>= 1;
		}
		res.resize(100, '0');
		return res;
	}
	vector<vector<pair<int, int>>> cur_off, nxt_off;
	cur_off.resize(n * 2 + 2);
	nxt_off.resize(n * 2 + 2);
	for (int i = 0; i < n * 2 + 2; i++) {
		cur_off[i].resize(n * 2 + 2);
		nxt_off[i].resize(n * 2 + 2);
	}
	for (int i = 0; i < n * 2 + 2; i++) {
		for (int j = 0; j < n * 2 + 2; j++) {
			cur_off[i][j] = {min(i * n / 2, i + cur_k * 2), min(j * n / 2, j + cur_k * 2)};
			nxt_off[i][j] = {min(i * n / 2, i + (cur_k + 1) * 2), min(j * n / 2, j + (cur_k + 1) * 2)};
		}
	}
	if (cur_k < n - 2) {
		string res(100, '0');
		for (int i = 0; i < 10; i++) {
			for (int j = 0; j < 10; j++) {
				for (int x = 0; x < 3; x++) {
					for (int y = 0; y < 3; y++) {
						int ni = nxt_off[cur_i][cur_j].first + i - cur_off[cur_i + x][cur_j + y].first;
						int nj = nxt_off[cur_i][cur_j].second + j - cur_off[cur_i + x][cur_j + y].second;
						if (0 <= ni && ni < 10 && 0 <= nj && nj < 10) {
							res[i * 10 + j] = a[x][y][ni * 10 + nj];
						}
					}
				}
			}
		}
		return res;
	}
	if (cur_k == n - 2) {
		if (cur_i % 2 == 1 || cur_j % 2 == 1) {
			return string(100, '0');
		}
		vector<vector<char>> corner(n + 1);
		for (int i = 0; i < n + 1; i++) {
			corner[i].resize(n + 1);
		}
		for (int x = 0; x < 3; x++) {
			for (int y = 0; y < 3; y++) {
				int lx = cur_off[cur_i + x][cur_j + y].first;
				int rx = cur_off[cur_i + x + 1][cur_j + y].first;
				int ly = cur_off[cur_i + x][cur_j + y].second;
				int ry = cur_off[cur_i + x][cur_j + y + 1].second;
				for (int i = lx; i < rx; i++) {
					for (int j = ly; j < ry; j++) {
						int ni = i - cur_off[cur_i][cur_j].first;
						int nj = j - cur_off[cur_i][cur_j].second;
						if (0 <= ni && ni < n + 1 && 0 <= nj && nj < n + 1) {
							corner[ni][nj] = a[x][y][(i - lx) * 10 + (j - ly)];
						}
					}
				}
			}
		}
		int border_row = (cur_i == 0 ? n : 0);
		int border_col = (cur_j == 0 ? n : 0);
		vector<pair<int, int>> border;
		string res3;
		for (int i = 0; i < n + 1; i++) {
			if (cur_i == cur_j) {
				for (int j = n; j >= 0; j--) {
					if (i == border_row || j == border_col) {
						border.push_back({i, j});
						res3 += corner[i][j];
					}
				}
			}
			else {
				for (int j = 0; j < n + 1; j++) {
					if (i == border_row || j == border_col) {
						border.push_back({i, j});
						res3 += corner[i][j];
					}
				}
			}
		}
		res3.resize(41, '0');
		const vector<int> dx = {1, -1, 0, 0};
		const vector<int> dy = {0, 0, 1, -1};
		vector<vector<int>> flag(n + 1);
		for (int i = 0; i < n + 1; i++) {
			flag[i].resize(n + 1);
		}
		int color = 0;
		int cnt = 0;
		for (int i = 0; i < n + 1; i++) {
			for (int j = 0; j < n + 1; j++) {
				if (!flag[i][j] && corner[i][j] == '1') {
					color++;
					flag[i][j] = color;
					bool on_border = false;
					deque<pair<int, int>> q = {{i, j}};
					while (!q.empty()) {
						int cx = q.front().first;
						int cy = q.front().second;
						if (cx == border_row || cy == border_col) {
							on_border = true;
						}
						q.pop_front();
						for (int k = 0; k < 4; k++) {
							int nx = cx + dx[k];
							int ny = cy + dy[k];
							if (0 <= nx && nx < n + 1 && 0 <= ny && ny < n + 1 && corner[nx][ny] == '1' && !flag[nx][ny]) {
								flag[nx][ny] = color;
								q.push_back({nx, ny});
							}
						}
					}
					if (!on_border) {
						cnt++;
					}
				}
			}
		}
		string res4;
		while (cnt) {
			res4 += (char)('0' + (cnt & 1));
			cnt >>= 1;
		}
		res4.resize(17, '0');
		vector<bool> open(n * 2 + 1);
		vector<bool> close(n * 2 + 1);
		string res1;
		string res2;
		for (int i = 0; i < n * 2 + 1; i++) {
			int cx = border[i].first;
			int cy = border[i].second;
			if (corner[cx][cy] == '0') {
				continue;
			}
			if (i > 0 && corner[border[i - 1].first][border[i - 1].second] == '1') {
				continue;
			}
			bool same = true;
			for (int j = i + 1; j < n * 2 + 1; j++) {
				int nx = border[j].first;
				int ny = border[j].second;
				same &= (corner[nx][ny] == '1');
				if (!same && flag[cx][cy] == flag[nx][ny]) {
					open[i] = true;
					close[j] = true;
					break;
				}
			}
			res1 += (char)('0' + open[i]);
			res2 += (char)('0' + close[i]);
		}
		res1.resize(21, '0');
		res2.resize(21, '0');
		return res1 + res2 + res3 + res4;
	}
	if (cur_k == n - 1) {
		vector<vector<char>> grid(n * 2 + 1);
		vector<vector<vector<pair<int, int>>>> adj(n * 2 + 1);
		for (int i = 0; i < n * 2 + 1; i++) {
			grid[i].resize(n * 2 + 1, '0');
			adj[i].resize(n * 2 + 1);
		}
		int cnt = 0;
		for (int x = 0; x < 2; x++) {
			for (int y = 0; y < 2; y++) {
				int off_x = x * n;
				int off_y = y * n;
				string res1 = a[x * 2][y * 2].substr(0, 21);
				string res2 = a[x * 2][y * 2].substr(21, 21);
				string res3 = a[x * 2][y * 2].substr(42, 41);
				string res4 = a[x * 2][y * 2].substr(83, 17);
				int border_row = (x == 0 ? n : 0);
				int border_col = (y == 0 ? n : 0);
				vector<pair<int, int>> border;
				for (int i = 0; i < n + 1; i++) {
					if (x == y) {
						for (int j = n; j >= 0; j--) {
							if (i == border_row || j == border_col) {
								border.push_back({i, j});
							}
						}
					}
					else {
						for (int j = 0; j < n + 1; j++) {
							if (i == border_row || j == border_col) {
								border.push_back({i, j});
							}
						}
					}
				}
				vector<pair<int, int>> open;
				int pt = -1;
				for (int i = 0; i < n * 2 + 1; i++) {
					int cx = border[i].first;
					int cy = border[i].second;
					grid[off_x + cx][off_y + cy] = res3[i];
					if (res3[i] == '0') {
						continue;
					}
					if (i > 0 && res3[i - 1] == '1') {
						continue;
					}
					pt++;
					if (res2[pt] == '1') {
						int nx = open.back().first;
						int ny = open.back().second;
						open.pop_back();
						adj[off_x + cx][off_y + cy].push_back({off_x + nx, off_y + ny});
						adj[off_x + nx][off_y + ny].push_back({off_x + cx, off_y + cy});
					}
					if (res1[pt] == '1') {
						open.push_back({cx, cy});
					}
				}
				for (int i = 0; i < 17; i++) {
					cnt += ((res4[i] - '0') << i);
				}
			}
		}
		vector<vector<bool>> flag(n * 2 + 1);
		for (int i = 0; i < n * 2 + 1; i++) {
			flag[i].resize(n * 2 + 1);
		}
		const vector<int> dx = {1, -1, 0, 0};
		const vector<int> dy = {0, 0, 1, -1};
		for (int i = 0; i < n * 2 + 1; i++) {
			for (int j = 0; j < n * 2 + 1; j++) {
				if (!flag[i][j] && grid[i][j] == '1') {
					flag[i][j] = true;
					deque<pair<int, int>> q = {{i, j}};
					cnt++;
					while (!q.empty()) {
						int cx = q.front().first;
						int cy = q.front().second;
						q.pop_front();
						for (auto p: adj[cx][cy]) {
							int nx = p.first;
							int ny = p.second;
							if (0 <= nx && nx < n * 2 + 1 && 0 <= ny && ny < n * 2 + 1 && grid[nx][ny] == '1' && !flag[nx][ny]) {
								flag[nx][ny] = true;
								q.push_back({nx, ny});
							}
						}
						for (int k = 0; k < 4; k++) {
							int nx = cx + dx[k];
							int ny = cy + dy[k];
							if (0 <= nx && nx < n * 2 + 1 && 0 <= ny && ny < n * 2 + 1 && grid[nx][ny] == '1' && !flag[nx][ny]) {
								flag[nx][ny] = true;
								q.push_back({nx, ny});
							}
						}
					}
				}
			}
		}
		string res;
		while (cnt) {
			res += (char)('0' + (cnt & 1));
			cnt >>= 1;
		}
		res.resize(100, '0');
		return res;
	}
	return string(100, '0');
}
# Verdict Execution time Memory Grader output
1 Correct 8 ms 2060 KB Output is correct
2 Correct 8 ms 2136 KB Output is correct
3 Correct 8 ms 2152 KB Output is correct
4 Correct 8 ms 2260 KB Output is correct
5 Correct 8 ms 1900 KB Output is correct
6 Correct 8 ms 1956 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 2060 KB Output is correct
2 Correct 8 ms 2136 KB Output is correct
3 Correct 8 ms 2152 KB Output is correct
4 Correct 8 ms 2260 KB Output is correct
5 Correct 8 ms 1900 KB Output is correct
6 Correct 8 ms 1956 KB Output is correct
7 Correct 14 ms 2200 KB Output is correct
8 Correct 20 ms 2184 KB Output is correct
9 Correct 22 ms 2220 KB Output is correct
10 Correct 16 ms 2320 KB Output is correct
11 Correct 19 ms 1916 KB Output is correct
12 Correct 23 ms 2236 KB Output is correct
13 Correct 23 ms 2012 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 2060 KB Output is correct
2 Correct 8 ms 2136 KB Output is correct
3 Correct 8 ms 2152 KB Output is correct
4 Correct 8 ms 2260 KB Output is correct
5 Correct 8 ms 1900 KB Output is correct
6 Correct 8 ms 1956 KB Output is correct
7 Correct 14 ms 2200 KB Output is correct
8 Correct 20 ms 2184 KB Output is correct
9 Correct 22 ms 2220 KB Output is correct
10 Correct 16 ms 2320 KB Output is correct
11 Correct 19 ms 1916 KB Output is correct
12 Correct 23 ms 2236 KB Output is correct
13 Correct 23 ms 2012 KB Output is correct
14 Correct 39 ms 2488 KB Output is correct
15 Correct 55 ms 2524 KB Output is correct
16 Correct 58 ms 2540 KB Output is correct
17 Correct 62 ms 2620 KB Output is correct
18 Correct 56 ms 2528 KB Output is correct
19 Correct 56 ms 2472 KB Output is correct
20 Correct 61 ms 2624 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 2060 KB Output is correct
2 Correct 8 ms 2136 KB Output is correct
3 Correct 8 ms 2152 KB Output is correct
4 Correct 8 ms 2260 KB Output is correct
5 Correct 8 ms 1900 KB Output is correct
6 Correct 8 ms 1956 KB Output is correct
7 Correct 14 ms 2200 KB Output is correct
8 Correct 20 ms 2184 KB Output is correct
9 Correct 22 ms 2220 KB Output is correct
10 Correct 16 ms 2320 KB Output is correct
11 Correct 19 ms 1916 KB Output is correct
12 Correct 23 ms 2236 KB Output is correct
13 Correct 23 ms 2012 KB Output is correct
14 Correct 39 ms 2488 KB Output is correct
15 Correct 55 ms 2524 KB Output is correct
16 Correct 58 ms 2540 KB Output is correct
17 Correct 62 ms 2620 KB Output is correct
18 Correct 56 ms 2528 KB Output is correct
19 Correct 56 ms 2472 KB Output is correct
20 Correct 61 ms 2624 KB Output is correct
21 Correct 91 ms 2588 KB Output is correct
22 Correct 151 ms 2736 KB Output is correct
23 Correct 135 ms 2716 KB Output is correct
24 Correct 146 ms 2776 KB Output is correct
25 Correct 135 ms 2700 KB Output is correct
26 Correct 148 ms 2768 KB Output is correct
27 Correct 145 ms 2700 KB Output is correct
28 Correct 141 ms 2828 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 2060 KB Output is correct
2 Correct 8 ms 2136 KB Output is correct
3 Correct 8 ms 2152 KB Output is correct
4 Correct 8 ms 2260 KB Output is correct
5 Correct 8 ms 1900 KB Output is correct
6 Correct 8 ms 1956 KB Output is correct
7 Correct 14 ms 2200 KB Output is correct
8 Correct 20 ms 2184 KB Output is correct
9 Correct 22 ms 2220 KB Output is correct
10 Correct 16 ms 2320 KB Output is correct
11 Correct 19 ms 1916 KB Output is correct
12 Correct 23 ms 2236 KB Output is correct
13 Correct 23 ms 2012 KB Output is correct
14 Correct 39 ms 2488 KB Output is correct
15 Correct 55 ms 2524 KB Output is correct
16 Correct 58 ms 2540 KB Output is correct
17 Correct 62 ms 2620 KB Output is correct
18 Correct 56 ms 2528 KB Output is correct
19 Correct 56 ms 2472 KB Output is correct
20 Correct 61 ms 2624 KB Output is correct
21 Correct 91 ms 2588 KB Output is correct
22 Correct 151 ms 2736 KB Output is correct
23 Correct 135 ms 2716 KB Output is correct
24 Correct 146 ms 2776 KB Output is correct
25 Correct 135 ms 2700 KB Output is correct
26 Correct 148 ms 2768 KB Output is correct
27 Correct 145 ms 2700 KB Output is correct
28 Correct 141 ms 2828 KB Output is correct
29 Correct 207 ms 2816 KB Output is correct
30 Correct 291 ms 2872 KB Output is correct
31 Correct 286 ms 2936 KB Output is correct
32 Correct 278 ms 2920 KB Output is correct
33 Correct 295 ms 2928 KB Output is correct
34 Correct 301 ms 3012 KB Output is correct
35 Correct 283 ms 2976 KB Output is correct
36 Correct 284 ms 2892 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 2060 KB Output is correct
2 Correct 8 ms 2136 KB Output is correct
3 Correct 8 ms 2152 KB Output is correct
4 Correct 8 ms 2260 KB Output is correct
5 Correct 8 ms 1900 KB Output is correct
6 Correct 8 ms 1956 KB Output is correct
7 Correct 14 ms 2200 KB Output is correct
8 Correct 20 ms 2184 KB Output is correct
9 Correct 22 ms 2220 KB Output is correct
10 Correct 16 ms 2320 KB Output is correct
11 Correct 19 ms 1916 KB Output is correct
12 Correct 23 ms 2236 KB Output is correct
13 Correct 23 ms 2012 KB Output is correct
14 Correct 39 ms 2488 KB Output is correct
15 Correct 55 ms 2524 KB Output is correct
16 Correct 58 ms 2540 KB Output is correct
17 Correct 62 ms 2620 KB Output is correct
18 Correct 56 ms 2528 KB Output is correct
19 Correct 56 ms 2472 KB Output is correct
20 Correct 61 ms 2624 KB Output is correct
21 Correct 91 ms 2588 KB Output is correct
22 Correct 151 ms 2736 KB Output is correct
23 Correct 135 ms 2716 KB Output is correct
24 Correct 146 ms 2776 KB Output is correct
25 Correct 135 ms 2700 KB Output is correct
26 Correct 148 ms 2768 KB Output is correct
27 Correct 145 ms 2700 KB Output is correct
28 Correct 141 ms 2828 KB Output is correct
29 Correct 207 ms 2816 KB Output is correct
30 Correct 291 ms 2872 KB Output is correct
31 Correct 286 ms 2936 KB Output is correct
32 Correct 278 ms 2920 KB Output is correct
33 Correct 295 ms 2928 KB Output is correct
34 Correct 301 ms 3012 KB Output is correct
35 Correct 283 ms 2976 KB Output is correct
36 Correct 284 ms 2892 KB Output is correct
37 Correct 392 ms 3140 KB Output is correct
38 Correct 506 ms 3336 KB Output is correct
39 Correct 538 ms 3380 KB Output is correct
40 Correct 507 ms 3408 KB Output is correct
41 Correct 547 ms 3520 KB Output is correct
42 Correct 558 ms 3384 KB Output is correct
43 Correct 542 ms 3280 KB Output is correct
44 Correct 517 ms 3348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 2060 KB Output is correct
2 Correct 8 ms 2136 KB Output is correct
3 Correct 8 ms 2152 KB Output is correct
4 Correct 8 ms 2260 KB Output is correct
5 Correct 8 ms 1900 KB Output is correct
6 Correct 8 ms 1956 KB Output is correct
7 Correct 14 ms 2200 KB Output is correct
8 Correct 20 ms 2184 KB Output is correct
9 Correct 22 ms 2220 KB Output is correct
10 Correct 16 ms 2320 KB Output is correct
11 Correct 19 ms 1916 KB Output is correct
12 Correct 23 ms 2236 KB Output is correct
13 Correct 23 ms 2012 KB Output is correct
14 Correct 39 ms 2488 KB Output is correct
15 Correct 55 ms 2524 KB Output is correct
16 Correct 58 ms 2540 KB Output is correct
17 Correct 62 ms 2620 KB Output is correct
18 Correct 56 ms 2528 KB Output is correct
19 Correct 56 ms 2472 KB Output is correct
20 Correct 61 ms 2624 KB Output is correct
21 Correct 91 ms 2588 KB Output is correct
22 Correct 151 ms 2736 KB Output is correct
23 Correct 135 ms 2716 KB Output is correct
24 Correct 146 ms 2776 KB Output is correct
25 Correct 135 ms 2700 KB Output is correct
26 Correct 148 ms 2768 KB Output is correct
27 Correct 145 ms 2700 KB Output is correct
28 Correct 141 ms 2828 KB Output is correct
29 Correct 207 ms 2816 KB Output is correct
30 Correct 291 ms 2872 KB Output is correct
31 Correct 286 ms 2936 KB Output is correct
32 Correct 278 ms 2920 KB Output is correct
33 Correct 295 ms 2928 KB Output is correct
34 Correct 301 ms 3012 KB Output is correct
35 Correct 283 ms 2976 KB Output is correct
36 Correct 284 ms 2892 KB Output is correct
37 Correct 392 ms 3140 KB Output is correct
38 Correct 506 ms 3336 KB Output is correct
39 Correct 538 ms 3380 KB Output is correct
40 Correct 507 ms 3408 KB Output is correct
41 Correct 547 ms 3520 KB Output is correct
42 Correct 558 ms 3384 KB Output is correct
43 Correct 542 ms 3280 KB Output is correct
44 Correct 517 ms 3348 KB Output is correct
45 Correct 682 ms 3432 KB Output is correct
46 Correct 878 ms 3548 KB Output is correct
47 Correct 885 ms 3696 KB Output is correct
48 Correct 890 ms 3564 KB Output is correct
49 Correct 867 ms 3600 KB Output is correct
50 Correct 856 ms 3952 KB Output is correct
51 Correct 874 ms 3476 KB Output is correct
52 Correct 893 ms 3440 KB Output is correct
53 Correct 877 ms 3608 KB Output is correct
54 Correct 880 ms 3528 KB Output is correct
55 Correct 833 ms 3640 KB Output is correct
56 Correct 888 ms 3624 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 2060 KB Output is correct
2 Correct 8 ms 2136 KB Output is correct
3 Correct 8 ms 2152 KB Output is correct
4 Correct 8 ms 2260 KB Output is correct
5 Correct 8 ms 1900 KB Output is correct
6 Correct 8 ms 1956 KB Output is correct
7 Correct 14 ms 2200 KB Output is correct
8 Correct 20 ms 2184 KB Output is correct
9 Correct 22 ms 2220 KB Output is correct
10 Correct 16 ms 2320 KB Output is correct
11 Correct 19 ms 1916 KB Output is correct
12 Correct 23 ms 2236 KB Output is correct
13 Correct 23 ms 2012 KB Output is correct
14 Correct 39 ms 2488 KB Output is correct
15 Correct 55 ms 2524 KB Output is correct
16 Correct 58 ms 2540 KB Output is correct
17 Correct 62 ms 2620 KB Output is correct
18 Correct 56 ms 2528 KB Output is correct
19 Correct 56 ms 2472 KB Output is correct
20 Correct 61 ms 2624 KB Output is correct
21 Correct 91 ms 2588 KB Output is correct
22 Correct 151 ms 2736 KB Output is correct
23 Correct 135 ms 2716 KB Output is correct
24 Correct 146 ms 2776 KB Output is correct
25 Correct 135 ms 2700 KB Output is correct
26 Correct 148 ms 2768 KB Output is correct
27 Correct 145 ms 2700 KB Output is correct
28 Correct 141 ms 2828 KB Output is correct
29 Correct 207 ms 2816 KB Output is correct
30 Correct 291 ms 2872 KB Output is correct
31 Correct 286 ms 2936 KB Output is correct
32 Correct 278 ms 2920 KB Output is correct
33 Correct 295 ms 2928 KB Output is correct
34 Correct 301 ms 3012 KB Output is correct
35 Correct 283 ms 2976 KB Output is correct
36 Correct 284 ms 2892 KB Output is correct
37 Correct 392 ms 3140 KB Output is correct
38 Correct 506 ms 3336 KB Output is correct
39 Correct 538 ms 3380 KB Output is correct
40 Correct 507 ms 3408 KB Output is correct
41 Correct 547 ms 3520 KB Output is correct
42 Correct 558 ms 3384 KB Output is correct
43 Correct 542 ms 3280 KB Output is correct
44 Correct 517 ms 3348 KB Output is correct
45 Correct 682 ms 3432 KB Output is correct
46 Correct 878 ms 3548 KB Output is correct
47 Correct 885 ms 3696 KB Output is correct
48 Correct 890 ms 3564 KB Output is correct
49 Correct 867 ms 3600 KB Output is correct
50 Correct 856 ms 3952 KB Output is correct
51 Correct 874 ms 3476 KB Output is correct
52 Correct 893 ms 3440 KB Output is correct
53 Correct 877 ms 3608 KB Output is correct
54 Correct 880 ms 3528 KB Output is correct
55 Correct 833 ms 3640 KB Output is correct
56 Correct 888 ms 3624 KB Output is correct
57 Correct 1118 ms 3992 KB Output is correct
58 Correct 1420 ms 4068 KB Output is correct
59 Correct 1414 ms 4068 KB Output is correct
60 Correct 1435 ms 4160 KB Output is correct
61 Correct 1406 ms 4176 KB Output is correct
62 Correct 1361 ms 4248 KB Output is correct
63 Correct 1382 ms 4204 KB Output is correct
64 Correct 1367 ms 4204 KB Output is correct
65 Correct 1379 ms 4216 KB Output is correct
66 Correct 1445 ms 4144 KB Output is correct
67 Correct 1379 ms 4112 KB Output is correct
68 Correct 1344 ms 4060 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 2060 KB Output is correct
2 Correct 8 ms 2136 KB Output is correct
3 Correct 8 ms 2152 KB Output is correct
4 Correct 8 ms 2260 KB Output is correct
5 Correct 8 ms 1900 KB Output is correct
6 Correct 8 ms 1956 KB Output is correct
7 Correct 14 ms 2200 KB Output is correct
8 Correct 20 ms 2184 KB Output is correct
9 Correct 22 ms 2220 KB Output is correct
10 Correct 16 ms 2320 KB Output is correct
11 Correct 19 ms 1916 KB Output is correct
12 Correct 23 ms 2236 KB Output is correct
13 Correct 23 ms 2012 KB Output is correct
14 Correct 39 ms 2488 KB Output is correct
15 Correct 55 ms 2524 KB Output is correct
16 Correct 58 ms 2540 KB Output is correct
17 Correct 62 ms 2620 KB Output is correct
18 Correct 56 ms 2528 KB Output is correct
19 Correct 56 ms 2472 KB Output is correct
20 Correct 61 ms 2624 KB Output is correct
21 Correct 91 ms 2588 KB Output is correct
22 Correct 151 ms 2736 KB Output is correct
23 Correct 135 ms 2716 KB Output is correct
24 Correct 146 ms 2776 KB Output is correct
25 Correct 135 ms 2700 KB Output is correct
26 Correct 148 ms 2768 KB Output is correct
27 Correct 145 ms 2700 KB Output is correct
28 Correct 141 ms 2828 KB Output is correct
29 Correct 207 ms 2816 KB Output is correct
30 Correct 291 ms 2872 KB Output is correct
31 Correct 286 ms 2936 KB Output is correct
32 Correct 278 ms 2920 KB Output is correct
33 Correct 295 ms 2928 KB Output is correct
34 Correct 301 ms 3012 KB Output is correct
35 Correct 283 ms 2976 KB Output is correct
36 Correct 284 ms 2892 KB Output is correct
37 Correct 392 ms 3140 KB Output is correct
38 Correct 506 ms 3336 KB Output is correct
39 Correct 538 ms 3380 KB Output is correct
40 Correct 507 ms 3408 KB Output is correct
41 Correct 547 ms 3520 KB Output is correct
42 Correct 558 ms 3384 KB Output is correct
43 Correct 542 ms 3280 KB Output is correct
44 Correct 517 ms 3348 KB Output is correct
45 Correct 682 ms 3432 KB Output is correct
46 Correct 878 ms 3548 KB Output is correct
47 Correct 885 ms 3696 KB Output is correct
48 Correct 890 ms 3564 KB Output is correct
49 Correct 867 ms 3600 KB Output is correct
50 Correct 856 ms 3952 KB Output is correct
51 Correct 874 ms 3476 KB Output is correct
52 Correct 893 ms 3440 KB Output is correct
53 Correct 877 ms 3608 KB Output is correct
54 Correct 880 ms 3528 KB Output is correct
55 Correct 833 ms 3640 KB Output is correct
56 Correct 888 ms 3624 KB Output is correct
57 Correct 1118 ms 3992 KB Output is correct
58 Correct 1420 ms 4068 KB Output is correct
59 Correct 1414 ms 4068 KB Output is correct
60 Correct 1435 ms 4160 KB Output is correct
61 Correct 1406 ms 4176 KB Output is correct
62 Correct 1361 ms 4248 KB Output is correct
63 Correct 1382 ms 4204 KB Output is correct
64 Correct 1367 ms 4204 KB Output is correct
65 Correct 1379 ms 4216 KB Output is correct
66 Correct 1445 ms 4144 KB Output is correct
67 Correct 1379 ms 4112 KB Output is correct
68 Correct 1344 ms 4060 KB Output is correct
69 Correct 1767 ms 4244 KB Output is correct
70 Correct 2160 ms 4456 KB Output is correct
71 Correct 2196 ms 4572 KB Output is correct
72 Correct 2237 ms 4428 KB Output is correct
73 Correct 2240 ms 4312 KB Output is correct
74 Correct 2166 ms 4352 KB Output is correct
75 Correct 2092 ms 4400 KB Output is correct
76 Correct 2217 ms 4404 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 2060 KB Output is correct
2 Correct 8 ms 2136 KB Output is correct
3 Correct 8 ms 2152 KB Output is correct
4 Correct 8 ms 2260 KB Output is correct
5 Correct 8 ms 1900 KB Output is correct
6 Correct 8 ms 1956 KB Output is correct
7 Correct 14 ms 2200 KB Output is correct
8 Correct 20 ms 2184 KB Output is correct
9 Correct 22 ms 2220 KB Output is correct
10 Correct 16 ms 2320 KB Output is correct
11 Correct 19 ms 1916 KB Output is correct
12 Correct 23 ms 2236 KB Output is correct
13 Correct 23 ms 2012 KB Output is correct
14 Correct 39 ms 2488 KB Output is correct
15 Correct 55 ms 2524 KB Output is correct
16 Correct 58 ms 2540 KB Output is correct
17 Correct 62 ms 2620 KB Output is correct
18 Correct 56 ms 2528 KB Output is correct
19 Correct 56 ms 2472 KB Output is correct
20 Correct 61 ms 2624 KB Output is correct
21 Correct 91 ms 2588 KB Output is correct
22 Correct 151 ms 2736 KB Output is correct
23 Correct 135 ms 2716 KB Output is correct
24 Correct 146 ms 2776 KB Output is correct
25 Correct 135 ms 2700 KB Output is correct
26 Correct 148 ms 2768 KB Output is correct
27 Correct 145 ms 2700 KB Output is correct
28 Correct 141 ms 2828 KB Output is correct
29 Correct 207 ms 2816 KB Output is correct
30 Correct 291 ms 2872 KB Output is correct
31 Correct 286 ms 2936 KB Output is correct
32 Correct 278 ms 2920 KB Output is correct
33 Correct 295 ms 2928 KB Output is correct
34 Correct 301 ms 3012 KB Output is correct
35 Correct 283 ms 2976 KB Output is correct
36 Correct 284 ms 2892 KB Output is correct
37 Correct 392 ms 3140 KB Output is correct
38 Correct 506 ms 3336 KB Output is correct
39 Correct 538 ms 3380 KB Output is correct
40 Correct 507 ms 3408 KB Output is correct
41 Correct 547 ms 3520 KB Output is correct
42 Correct 558 ms 3384 KB Output is correct
43 Correct 542 ms 3280 KB Output is correct
44 Correct 517 ms 3348 KB Output is correct
45 Correct 682 ms 3432 KB Output is correct
46 Correct 878 ms 3548 KB Output is correct
47 Correct 885 ms 3696 KB Output is correct
48 Correct 890 ms 3564 KB Output is correct
49 Correct 867 ms 3600 KB Output is correct
50 Correct 856 ms 3952 KB Output is correct
51 Correct 874 ms 3476 KB Output is correct
52 Correct 893 ms 3440 KB Output is correct
53 Correct 877 ms 3608 KB Output is correct
54 Correct 880 ms 3528 KB Output is correct
55 Correct 833 ms 3640 KB Output is correct
56 Correct 888 ms 3624 KB Output is correct
57 Correct 1118 ms 3992 KB Output is correct
58 Correct 1420 ms 4068 KB Output is correct
59 Correct 1414 ms 4068 KB Output is correct
60 Correct 1435 ms 4160 KB Output is correct
61 Correct 1406 ms 4176 KB Output is correct
62 Correct 1361 ms 4248 KB Output is correct
63 Correct 1382 ms 4204 KB Output is correct
64 Correct 1367 ms 4204 KB Output is correct
65 Correct 1379 ms 4216 KB Output is correct
66 Correct 1445 ms 4144 KB Output is correct
67 Correct 1379 ms 4112 KB Output is correct
68 Correct 1344 ms 4060 KB Output is correct
69 Correct 1767 ms 4244 KB Output is correct
70 Correct 2160 ms 4456 KB Output is correct
71 Correct 2196 ms 4572 KB Output is correct
72 Correct 2237 ms 4428 KB Output is correct
73 Correct 2240 ms 4312 KB Output is correct
74 Correct 2166 ms 4352 KB Output is correct
75 Correct 2092 ms 4400 KB Output is correct
76 Correct 2217 ms 4404 KB Output is correct
77 Correct 2132 ms 4440 KB Output is correct
78 Correct 3056 ms 4944 KB Output is correct
79 Correct 3059 ms 4852 KB Output is correct
80 Correct 3152 ms 4796 KB Output is correct
81 Correct 3170 ms 4820 KB Output is correct
82 Correct 3023 ms 4772 KB Output is correct
83 Correct 3106 ms 4912 KB Output is correct
84 Correct 3082 ms 4896 KB Output is correct