Submission #774307

# Submission time Handle Problem Language Result Execution time Memory
774307 2023-07-05T13:53:37 Z LittleCube Mars (APIO22_mars) C++17
89 / 100
581 ms 4644 KB
#pragma GCC optimize("Ofast,unroll-loops")
#include "mars.h"
#ifndef EVAL
#include "mars_grader.cpp"
#endif
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
using namespace std;

int get_count(string s)
{
	int ans = 0;
	for (int i = 91; i <= 99; i++)
		ans = ans * 2 + (s[i] == '1');
	return ans;
}

struct DSU
{
	int dsu[400];
	void init(int n)
	{
		for (int i = 0; i <= n + 5; i++)
			dsu[i] = i;
	}
	int find(int k)
	{
		return dsu[k] == k ? k : dsu[k] = find(dsu[k]);
	}
	int merge(int u, int v)
	{
		u = find(u), v = find(v);
		if (u == v)
			return 0;
		dsu[u] = v;
		return 1;
	}
} dsu;

vector<int> parse_corner(int n, int &idx, string s)
{
	vector<int> res(2 * n - 1, 0), mono;
	int j = 0;
	bool firstleft = 0;
	for (int i = 0; i < 2 * n - 1; i++, j += 2)
	{
		while (s[j] == '0' && s[j + 1] == '1')
		{
			mono.pop_back();
			j += 2;
		}
		if (firstleft == 0 && s[j] == '1')
		{
			firstleft = 1;
			mono.emplace_back(++idx);
			res[i] = mono.back();
			j--;
		}
		else if (s[j] == '1' && s[j + 1] == '0')
		{
			mono.emplace_back(++idx);
			res[i] = mono.back();
		}
		else if (s[j] == '0' && s[j + 1] == '0')
			res[i] = 0;
		else if (s[j] == '1' && s[j + 1] == '1')
			res[i] = mono.back();
		// assert(j + 1 < 90);
	}
	return res;
}

vector<int> parse_edge(int n, int &idx, string s)
{
	vector<int> res(n, 0), mono;
	for (int i = 0, j = 0; i < n; i++, j++)
	{
		if (s[j] == '0')
			res[i] = 0;
		else
		{
			if (i && s[j - 1] == '1')
				res[i] = res[i - 1];
			else
				res[i] = ++idx;
		}
	}
	return res;
}

// for corner:
// new: 10, end: 01, continue: 11, zero: 00
// for edge:
// has: 1, no: 0, last 10 bits: count
// first 66 bits: record side, last 10 bits: count
// only border cells in charge, others record themselves

string merge_edge(int n, bool add, string edge)
{
	int tot = get_count(edge) + (edge[0] == '0' && add);

	string ans = string(100, '0');

	for (int i = n; i >= 1; i--)
		ans[i] = edge[i - 1];
	ans[0] = (add ? '1' : '0');

	for (int i = 99; i > 90; i--)
	{
		if (tot % 2)
			ans[i] = '1';
		tot /= 2;
	}
	return ans;
}

string merge_corner(int n, string before, string corner, string after, string middle)
{
	int idx = 0, tot = get_count(before) + get_count(corner) + get_count(after) + get_count(middle);

	dsu.init(4 * n);

	vector<int> cor = parse_corner(n, idx, corner),
				bef = parse_edge(n, idx, before),
				aft = parse_edge(n, idx, after),
				res(2 * n + 1, 0);

	int mid = (middle[0] == '1' ? ++idx : 0);
	reverse(bef.begin(), bef.end());
	for (int i = 0; i < n; i++)
		if (cor[i] && bef[i])
			tot -= dsu.merge(cor[i], bef[i]);
	for (int i = 0; i < n; i++)
		if (cor[i + n - 1] && aft[i])
			tot -= dsu.merge(cor[i + n - 1], aft[i]);
	if (bef[n - 1] && mid)
		tot -= dsu.merge(bef[n - 1], mid);
	if (aft[0] && mid)
		tot -= dsu.merge(aft[0], mid);
	for (int i = 0; i < n; i++)
		res[i] = dsu.find(bef[i]);
	res[n] = dsu.find(mid);
	for (int i = 0; i < n; i++)
		res[n + 1 + i] = dsu.find(aft[i]);

	string ans = string(100, '0');
	vector<int> mono, vis(4 * n + 5, 0);
	bool firstleft = 0;
	for (int i = 0, j = 0; i < 2 * n + 1; i++, j += 2)
	{
		if (res[i] == 0)
			ans[j] = ans[j + 1] = '0';
		else
		{
			if (vis[res[i]] == 0)
			{
				vis[res[i]] = 1;
				mono.emplace_back(res[i]);
				if (firstleft == 0)
				{
					firstleft = 1;
					ans[j] = '1';
					j--;
				}
				else
					ans[j] = '1', ans[j + 1] = '0';
			}
			else
			{
				while (mono.back() != res[i])
				{
					mono.pop_back();
					ans[j] = '0', ans[j + 1] = '1';
					j += 2;
				}
				ans[j] = '1', ans[j + 1] = '1';
			}
		}
	}
	for (int i = 99; i > 89; i--)
	{
		// assert(ans[i] == '0');
		if (tot % 2)
			ans[i] = '1';
		tot /= 2;
	}
	// for (int i : bef)
	// 	cerr << i << ' ';
	// cerr << '\n';
	// for (int i : cor)
	// 	cerr << i << ' ';
	// cerr << '\n';
	// for (int i : aft)
	// 	cerr << i << ' ';
	// cerr << '\n';
	// cerr << mid << ' ';
	// cerr << '\n';
	// cerr << "merge into\n";
	// for (int i : res)
	// 	cerr << i << ' ';
	// cerr << '\n';
	// idx = 0;
	// res = parse_corner(n + 1, idx, ans);
	// cerr << "decode as\n";
	// for (int i : res)
	// 	cerr << i << ' ';
	// cerr << '\n';
	// cerr << '\n';
	return ans;
}

string process(vector<vector<string>> a, int i, int j, int k, int n)
{
	k++;
	i += k, j += k;
	if (k == 1)
	{
		for (int x = 0; x < 3; x++)
			for (int y = 0; y < 3; y++)
			{
				if (a[x][y][0] == '1')
					a[x][y][0] = '1', a[x][y][1] = '0', a[x][y][2] = '0', a[x][y][3] = '1', a[x][y][99] = '1';
			}
	}
	// return answer
	if (k == n)
	{
		int idx = 0, tot = 0;
		for (int x = 0; x < 3; x++)
			for (int y = 0; y < 3; y++)
				tot += get_count(a[x][y]);
		// cerr << tot << '\n';
		dsu.init(9 * n + 5);

		vector<int> ul = parse_corner(n, idx, a[0][0]),
					ur = parse_corner(n, idx, a[0][2]),
					dr = parse_corner(n, idx, a[2][2]),
					dl = parse_corner(n, idx, a[2][0]),
					l = parse_edge(n, idx, a[1][0]),
					r = parse_edge(n, idx, a[1][2]),
					u = parse_edge(n, idx, a[0][1]),
					d = parse_edge(n, idx, a[2][1]);
		int mid = (a[1][1][0] == '1' ? ++idx : 0);

#define merge1(a, b)            \
	for (int p = 0; p < n; p++) \
		if (a[p] && b[p])       \
			tot -= dsu.merge(a[p], b[p]);
#define merge2(a, b)              \
	for (int p = 0; p < n; p++)   \
		if (a[p + n - 1] && b[p]) \
			tot -= dsu.merge(a[p + n - 1], b[p]);

		merge2(ul, u);
		merge2(ur, r);
		merge2(dr, d);
		merge2(dl, l);

		if (mid && l[0])
			tot -= dsu.merge(mid, l[0]);
		if (mid && r[0])
			tot -= dsu.merge(mid, r[0]);
		if (mid && d[0])
			tot -= dsu.merge(mid, d[0]);
		if (mid && u[0])
			tot -= dsu.merge(mid, u[0]);

		reverse(l.begin(), l.end());
		reverse(r.begin(), r.end());
		reverse(d.begin(), d.end());
		reverse(u.begin(), u.end());

		merge1(ul, l);
		merge1(ur, u);
		merge1(dr, r);
		merge1(dl, d);

		string ans = string(100, '0');
		for (int p = 0; p < 10; p++)
		{
			if (tot % 2)
				ans[p] = '1';
			tot /= 2;
		}
		return ans;
	}
	int sz = k;
	// top left
	if (i == k && j == k)
		return merge_corner(sz, a[1][0], a[0][0], a[0][1], a[1][1]);
	// top right
	if (i == k && j + k == 2 * n)
		return merge_corner(sz, a[0][1], a[0][2], a[1][2], a[1][1]);
	// bottom left
	if (i + k == 2 * n && j == k)
		return merge_corner(sz, a[2][1], a[2][0], a[1][0], a[1][1]);
	// bottom right
	if (i + k == 2 * n && j + k == 2 * n)
		return merge_corner(sz, a[1][2], a[2][2], a[2][1], a[1][1]);
	// top
	if (i == k)
		return merge_edge(sz, a[1][1][0] == '1', a[0][1]);
	// left
	if (j == k)
		return merge_edge(sz, a[1][1][0] == '1', a[1][0]);
	// bottom
	if (i + k == 2 * n)
		return merge_edge(sz, a[1][1][0] == '1', a[2][1]);
	// right
	if (j + k == 2 * n)
		return merge_edge(sz, a[1][1][0] == '1', a[1][2]);

	return a[1][1];
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2160 KB Output is correct
2 Correct 6 ms 2056 KB Output is correct
3 Correct 8 ms 1964 KB Output is correct
4 Correct 6 ms 1792 KB Output is correct
5 Correct 7 ms 2088 KB Output is correct
6 Correct 4 ms 1900 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2160 KB Output is correct
2 Correct 6 ms 2056 KB Output is correct
3 Correct 8 ms 1964 KB Output is correct
4 Correct 6 ms 1792 KB Output is correct
5 Correct 7 ms 2088 KB Output is correct
6 Correct 4 ms 1900 KB Output is correct
7 Correct 8 ms 1736 KB Output is correct
8 Correct 9 ms 2224 KB Output is correct
9 Correct 8 ms 2076 KB Output is correct
10 Correct 8 ms 2000 KB Output is correct
11 Correct 11 ms 1812 KB Output is correct
12 Correct 8 ms 1880 KB Output is correct
13 Correct 8 ms 2060 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2160 KB Output is correct
2 Correct 6 ms 2056 KB Output is correct
3 Correct 8 ms 1964 KB Output is correct
4 Correct 6 ms 1792 KB Output is correct
5 Correct 7 ms 2088 KB Output is correct
6 Correct 4 ms 1900 KB Output is correct
7 Correct 8 ms 1736 KB Output is correct
8 Correct 9 ms 2224 KB Output is correct
9 Correct 8 ms 2076 KB Output is correct
10 Correct 8 ms 2000 KB Output is correct
11 Correct 11 ms 1812 KB Output is correct
12 Correct 8 ms 1880 KB Output is correct
13 Correct 8 ms 2060 KB Output is correct
14 Correct 16 ms 2568 KB Output is correct
15 Correct 26 ms 2584 KB Output is correct
16 Correct 26 ms 2524 KB Output is correct
17 Correct 24 ms 2556 KB Output is correct
18 Correct 24 ms 2680 KB Output is correct
19 Correct 26 ms 2676 KB Output is correct
20 Correct 24 ms 2528 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2160 KB Output is correct
2 Correct 6 ms 2056 KB Output is correct
3 Correct 8 ms 1964 KB Output is correct
4 Correct 6 ms 1792 KB Output is correct
5 Correct 7 ms 2088 KB Output is correct
6 Correct 4 ms 1900 KB Output is correct
7 Correct 8 ms 1736 KB Output is correct
8 Correct 9 ms 2224 KB Output is correct
9 Correct 8 ms 2076 KB Output is correct
10 Correct 8 ms 2000 KB Output is correct
11 Correct 11 ms 1812 KB Output is correct
12 Correct 8 ms 1880 KB Output is correct
13 Correct 8 ms 2060 KB Output is correct
14 Correct 16 ms 2568 KB Output is correct
15 Correct 26 ms 2584 KB Output is correct
16 Correct 26 ms 2524 KB Output is correct
17 Correct 24 ms 2556 KB Output is correct
18 Correct 24 ms 2680 KB Output is correct
19 Correct 26 ms 2676 KB Output is correct
20 Correct 24 ms 2528 KB Output is correct
21 Correct 35 ms 2664 KB Output is correct
22 Correct 47 ms 2724 KB Output is correct
23 Correct 56 ms 2708 KB Output is correct
24 Correct 52 ms 2900 KB Output is correct
25 Correct 53 ms 2744 KB Output is correct
26 Correct 51 ms 2660 KB Output is correct
27 Correct 52 ms 2788 KB Output is correct
28 Correct 51 ms 2768 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2160 KB Output is correct
2 Correct 6 ms 2056 KB Output is correct
3 Correct 8 ms 1964 KB Output is correct
4 Correct 6 ms 1792 KB Output is correct
5 Correct 7 ms 2088 KB Output is correct
6 Correct 4 ms 1900 KB Output is correct
7 Correct 8 ms 1736 KB Output is correct
8 Correct 9 ms 2224 KB Output is correct
9 Correct 8 ms 2076 KB Output is correct
10 Correct 8 ms 2000 KB Output is correct
11 Correct 11 ms 1812 KB Output is correct
12 Correct 8 ms 1880 KB Output is correct
13 Correct 8 ms 2060 KB Output is correct
14 Correct 16 ms 2568 KB Output is correct
15 Correct 26 ms 2584 KB Output is correct
16 Correct 26 ms 2524 KB Output is correct
17 Correct 24 ms 2556 KB Output is correct
18 Correct 24 ms 2680 KB Output is correct
19 Correct 26 ms 2676 KB Output is correct
20 Correct 24 ms 2528 KB Output is correct
21 Correct 35 ms 2664 KB Output is correct
22 Correct 47 ms 2724 KB Output is correct
23 Correct 56 ms 2708 KB Output is correct
24 Correct 52 ms 2900 KB Output is correct
25 Correct 53 ms 2744 KB Output is correct
26 Correct 51 ms 2660 KB Output is correct
27 Correct 52 ms 2788 KB Output is correct
28 Correct 51 ms 2768 KB Output is correct
29 Correct 70 ms 2772 KB Output is correct
30 Correct 103 ms 2880 KB Output is correct
31 Correct 87 ms 2872 KB Output is correct
32 Correct 90 ms 2856 KB Output is correct
33 Correct 91 ms 2844 KB Output is correct
34 Correct 107 ms 2860 KB Output is correct
35 Correct 92 ms 2896 KB Output is correct
36 Correct 93 ms 2864 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2160 KB Output is correct
2 Correct 6 ms 2056 KB Output is correct
3 Correct 8 ms 1964 KB Output is correct
4 Correct 6 ms 1792 KB Output is correct
5 Correct 7 ms 2088 KB Output is correct
6 Correct 4 ms 1900 KB Output is correct
7 Correct 8 ms 1736 KB Output is correct
8 Correct 9 ms 2224 KB Output is correct
9 Correct 8 ms 2076 KB Output is correct
10 Correct 8 ms 2000 KB Output is correct
11 Correct 11 ms 1812 KB Output is correct
12 Correct 8 ms 1880 KB Output is correct
13 Correct 8 ms 2060 KB Output is correct
14 Correct 16 ms 2568 KB Output is correct
15 Correct 26 ms 2584 KB Output is correct
16 Correct 26 ms 2524 KB Output is correct
17 Correct 24 ms 2556 KB Output is correct
18 Correct 24 ms 2680 KB Output is correct
19 Correct 26 ms 2676 KB Output is correct
20 Correct 24 ms 2528 KB Output is correct
21 Correct 35 ms 2664 KB Output is correct
22 Correct 47 ms 2724 KB Output is correct
23 Correct 56 ms 2708 KB Output is correct
24 Correct 52 ms 2900 KB Output is correct
25 Correct 53 ms 2744 KB Output is correct
26 Correct 51 ms 2660 KB Output is correct
27 Correct 52 ms 2788 KB Output is correct
28 Correct 51 ms 2768 KB Output is correct
29 Correct 70 ms 2772 KB Output is correct
30 Correct 103 ms 2880 KB Output is correct
31 Correct 87 ms 2872 KB Output is correct
32 Correct 90 ms 2856 KB Output is correct
33 Correct 91 ms 2844 KB Output is correct
34 Correct 107 ms 2860 KB Output is correct
35 Correct 92 ms 2896 KB Output is correct
36 Correct 93 ms 2864 KB Output is correct
37 Correct 129 ms 3232 KB Output is correct
38 Correct 174 ms 3412 KB Output is correct
39 Correct 157 ms 3268 KB Output is correct
40 Correct 167 ms 3376 KB Output is correct
41 Correct 178 ms 3228 KB Output is correct
42 Correct 165 ms 3300 KB Output is correct
43 Correct 166 ms 3320 KB Output is correct
44 Correct 164 ms 3384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2160 KB Output is correct
2 Correct 6 ms 2056 KB Output is correct
3 Correct 8 ms 1964 KB Output is correct
4 Correct 6 ms 1792 KB Output is correct
5 Correct 7 ms 2088 KB Output is correct
6 Correct 4 ms 1900 KB Output is correct
7 Correct 8 ms 1736 KB Output is correct
8 Correct 9 ms 2224 KB Output is correct
9 Correct 8 ms 2076 KB Output is correct
10 Correct 8 ms 2000 KB Output is correct
11 Correct 11 ms 1812 KB Output is correct
12 Correct 8 ms 1880 KB Output is correct
13 Correct 8 ms 2060 KB Output is correct
14 Correct 16 ms 2568 KB Output is correct
15 Correct 26 ms 2584 KB Output is correct
16 Correct 26 ms 2524 KB Output is correct
17 Correct 24 ms 2556 KB Output is correct
18 Correct 24 ms 2680 KB Output is correct
19 Correct 26 ms 2676 KB Output is correct
20 Correct 24 ms 2528 KB Output is correct
21 Correct 35 ms 2664 KB Output is correct
22 Correct 47 ms 2724 KB Output is correct
23 Correct 56 ms 2708 KB Output is correct
24 Correct 52 ms 2900 KB Output is correct
25 Correct 53 ms 2744 KB Output is correct
26 Correct 51 ms 2660 KB Output is correct
27 Correct 52 ms 2788 KB Output is correct
28 Correct 51 ms 2768 KB Output is correct
29 Correct 70 ms 2772 KB Output is correct
30 Correct 103 ms 2880 KB Output is correct
31 Correct 87 ms 2872 KB Output is correct
32 Correct 90 ms 2856 KB Output is correct
33 Correct 91 ms 2844 KB Output is correct
34 Correct 107 ms 2860 KB Output is correct
35 Correct 92 ms 2896 KB Output is correct
36 Correct 93 ms 2864 KB Output is correct
37 Correct 129 ms 3232 KB Output is correct
38 Correct 174 ms 3412 KB Output is correct
39 Correct 157 ms 3268 KB Output is correct
40 Correct 167 ms 3376 KB Output is correct
41 Correct 178 ms 3228 KB Output is correct
42 Correct 165 ms 3300 KB Output is correct
43 Correct 166 ms 3320 KB Output is correct
44 Correct 164 ms 3384 KB Output is correct
45 Correct 207 ms 3264 KB Output is correct
46 Correct 260 ms 3420 KB Output is correct
47 Correct 251 ms 3360 KB Output is correct
48 Correct 265 ms 3608 KB Output is correct
49 Correct 253 ms 3344 KB Output is correct
50 Correct 236 ms 3368 KB Output is correct
51 Correct 269 ms 3468 KB Output is correct
52 Correct 269 ms 3372 KB Output is correct
53 Correct 258 ms 3392 KB Output is correct
54 Correct 264 ms 3416 KB Output is correct
55 Correct 261 ms 3432 KB Output is correct
56 Correct 256 ms 3540 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2160 KB Output is correct
2 Correct 6 ms 2056 KB Output is correct
3 Correct 8 ms 1964 KB Output is correct
4 Correct 6 ms 1792 KB Output is correct
5 Correct 7 ms 2088 KB Output is correct
6 Correct 4 ms 1900 KB Output is correct
7 Correct 8 ms 1736 KB Output is correct
8 Correct 9 ms 2224 KB Output is correct
9 Correct 8 ms 2076 KB Output is correct
10 Correct 8 ms 2000 KB Output is correct
11 Correct 11 ms 1812 KB Output is correct
12 Correct 8 ms 1880 KB Output is correct
13 Correct 8 ms 2060 KB Output is correct
14 Correct 16 ms 2568 KB Output is correct
15 Correct 26 ms 2584 KB Output is correct
16 Correct 26 ms 2524 KB Output is correct
17 Correct 24 ms 2556 KB Output is correct
18 Correct 24 ms 2680 KB Output is correct
19 Correct 26 ms 2676 KB Output is correct
20 Correct 24 ms 2528 KB Output is correct
21 Correct 35 ms 2664 KB Output is correct
22 Correct 47 ms 2724 KB Output is correct
23 Correct 56 ms 2708 KB Output is correct
24 Correct 52 ms 2900 KB Output is correct
25 Correct 53 ms 2744 KB Output is correct
26 Correct 51 ms 2660 KB Output is correct
27 Correct 52 ms 2788 KB Output is correct
28 Correct 51 ms 2768 KB Output is correct
29 Correct 70 ms 2772 KB Output is correct
30 Correct 103 ms 2880 KB Output is correct
31 Correct 87 ms 2872 KB Output is correct
32 Correct 90 ms 2856 KB Output is correct
33 Correct 91 ms 2844 KB Output is correct
34 Correct 107 ms 2860 KB Output is correct
35 Correct 92 ms 2896 KB Output is correct
36 Correct 93 ms 2864 KB Output is correct
37 Correct 129 ms 3232 KB Output is correct
38 Correct 174 ms 3412 KB Output is correct
39 Correct 157 ms 3268 KB Output is correct
40 Correct 167 ms 3376 KB Output is correct
41 Correct 178 ms 3228 KB Output is correct
42 Correct 165 ms 3300 KB Output is correct
43 Correct 166 ms 3320 KB Output is correct
44 Correct 164 ms 3384 KB Output is correct
45 Correct 207 ms 3264 KB Output is correct
46 Correct 260 ms 3420 KB Output is correct
47 Correct 251 ms 3360 KB Output is correct
48 Correct 265 ms 3608 KB Output is correct
49 Correct 253 ms 3344 KB Output is correct
50 Correct 236 ms 3368 KB Output is correct
51 Correct 269 ms 3468 KB Output is correct
52 Correct 269 ms 3372 KB Output is correct
53 Correct 258 ms 3392 KB Output is correct
54 Correct 264 ms 3416 KB Output is correct
55 Correct 261 ms 3432 KB Output is correct
56 Correct 256 ms 3540 KB Output is correct
57 Correct 317 ms 3828 KB Output is correct
58 Correct 362 ms 4184 KB Output is correct
59 Correct 409 ms 4012 KB Output is correct
60 Correct 392 ms 4084 KB Output is correct
61 Correct 392 ms 4136 KB Output is correct
62 Correct 387 ms 3968 KB Output is correct
63 Correct 377 ms 4148 KB Output is correct
64 Correct 394 ms 4056 KB Output is correct
65 Correct 352 ms 4004 KB Output is correct
66 Correct 382 ms 4132 KB Output is correct
67 Correct 373 ms 4168 KB Output is correct
68 Correct 383 ms 4220 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2160 KB Output is correct
2 Correct 6 ms 2056 KB Output is correct
3 Correct 8 ms 1964 KB Output is correct
4 Correct 6 ms 1792 KB Output is correct
5 Correct 7 ms 2088 KB Output is correct
6 Correct 4 ms 1900 KB Output is correct
7 Correct 8 ms 1736 KB Output is correct
8 Correct 9 ms 2224 KB Output is correct
9 Correct 8 ms 2076 KB Output is correct
10 Correct 8 ms 2000 KB Output is correct
11 Correct 11 ms 1812 KB Output is correct
12 Correct 8 ms 1880 KB Output is correct
13 Correct 8 ms 2060 KB Output is correct
14 Correct 16 ms 2568 KB Output is correct
15 Correct 26 ms 2584 KB Output is correct
16 Correct 26 ms 2524 KB Output is correct
17 Correct 24 ms 2556 KB Output is correct
18 Correct 24 ms 2680 KB Output is correct
19 Correct 26 ms 2676 KB Output is correct
20 Correct 24 ms 2528 KB Output is correct
21 Correct 35 ms 2664 KB Output is correct
22 Correct 47 ms 2724 KB Output is correct
23 Correct 56 ms 2708 KB Output is correct
24 Correct 52 ms 2900 KB Output is correct
25 Correct 53 ms 2744 KB Output is correct
26 Correct 51 ms 2660 KB Output is correct
27 Correct 52 ms 2788 KB Output is correct
28 Correct 51 ms 2768 KB Output is correct
29 Correct 70 ms 2772 KB Output is correct
30 Correct 103 ms 2880 KB Output is correct
31 Correct 87 ms 2872 KB Output is correct
32 Correct 90 ms 2856 KB Output is correct
33 Correct 91 ms 2844 KB Output is correct
34 Correct 107 ms 2860 KB Output is correct
35 Correct 92 ms 2896 KB Output is correct
36 Correct 93 ms 2864 KB Output is correct
37 Correct 129 ms 3232 KB Output is correct
38 Correct 174 ms 3412 KB Output is correct
39 Correct 157 ms 3268 KB Output is correct
40 Correct 167 ms 3376 KB Output is correct
41 Correct 178 ms 3228 KB Output is correct
42 Correct 165 ms 3300 KB Output is correct
43 Correct 166 ms 3320 KB Output is correct
44 Correct 164 ms 3384 KB Output is correct
45 Correct 207 ms 3264 KB Output is correct
46 Correct 260 ms 3420 KB Output is correct
47 Correct 251 ms 3360 KB Output is correct
48 Correct 265 ms 3608 KB Output is correct
49 Correct 253 ms 3344 KB Output is correct
50 Correct 236 ms 3368 KB Output is correct
51 Correct 269 ms 3468 KB Output is correct
52 Correct 269 ms 3372 KB Output is correct
53 Correct 258 ms 3392 KB Output is correct
54 Correct 264 ms 3416 KB Output is correct
55 Correct 261 ms 3432 KB Output is correct
56 Correct 256 ms 3540 KB Output is correct
57 Correct 317 ms 3828 KB Output is correct
58 Correct 362 ms 4184 KB Output is correct
59 Correct 409 ms 4012 KB Output is correct
60 Correct 392 ms 4084 KB Output is correct
61 Correct 392 ms 4136 KB Output is correct
62 Correct 387 ms 3968 KB Output is correct
63 Correct 377 ms 4148 KB Output is correct
64 Correct 394 ms 4056 KB Output is correct
65 Correct 352 ms 4004 KB Output is correct
66 Correct 382 ms 4132 KB Output is correct
67 Correct 373 ms 4168 KB Output is correct
68 Correct 383 ms 4220 KB Output is correct
69 Correct 463 ms 4248 KB Output is correct
70 Correct 544 ms 4248 KB Output is correct
71 Correct 522 ms 4308 KB Output is correct
72 Correct 523 ms 4312 KB Output is correct
73 Correct 516 ms 4292 KB Output is correct
74 Correct 581 ms 4312 KB Output is correct
75 Correct 567 ms 4412 KB Output is correct
76 Correct 538 ms 4644 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2160 KB Output is correct
2 Correct 6 ms 2056 KB Output is correct
3 Correct 8 ms 1964 KB Output is correct
4 Correct 6 ms 1792 KB Output is correct
5 Correct 7 ms 2088 KB Output is correct
6 Correct 4 ms 1900 KB Output is correct
7 Correct 8 ms 1736 KB Output is correct
8 Correct 9 ms 2224 KB Output is correct
9 Correct 8 ms 2076 KB Output is correct
10 Correct 8 ms 2000 KB Output is correct
11 Correct 11 ms 1812 KB Output is correct
12 Correct 8 ms 1880 KB Output is correct
13 Correct 8 ms 2060 KB Output is correct
14 Correct 16 ms 2568 KB Output is correct
15 Correct 26 ms 2584 KB Output is correct
16 Correct 26 ms 2524 KB Output is correct
17 Correct 24 ms 2556 KB Output is correct
18 Correct 24 ms 2680 KB Output is correct
19 Correct 26 ms 2676 KB Output is correct
20 Correct 24 ms 2528 KB Output is correct
21 Correct 35 ms 2664 KB Output is correct
22 Correct 47 ms 2724 KB Output is correct
23 Correct 56 ms 2708 KB Output is correct
24 Correct 52 ms 2900 KB Output is correct
25 Correct 53 ms 2744 KB Output is correct
26 Correct 51 ms 2660 KB Output is correct
27 Correct 52 ms 2788 KB Output is correct
28 Correct 51 ms 2768 KB Output is correct
29 Correct 70 ms 2772 KB Output is correct
30 Correct 103 ms 2880 KB Output is correct
31 Correct 87 ms 2872 KB Output is correct
32 Correct 90 ms 2856 KB Output is correct
33 Correct 91 ms 2844 KB Output is correct
34 Correct 107 ms 2860 KB Output is correct
35 Correct 92 ms 2896 KB Output is correct
36 Correct 93 ms 2864 KB Output is correct
37 Correct 129 ms 3232 KB Output is correct
38 Correct 174 ms 3412 KB Output is correct
39 Correct 157 ms 3268 KB Output is correct
40 Correct 167 ms 3376 KB Output is correct
41 Correct 178 ms 3228 KB Output is correct
42 Correct 165 ms 3300 KB Output is correct
43 Correct 166 ms 3320 KB Output is correct
44 Correct 164 ms 3384 KB Output is correct
45 Correct 207 ms 3264 KB Output is correct
46 Correct 260 ms 3420 KB Output is correct
47 Correct 251 ms 3360 KB Output is correct
48 Correct 265 ms 3608 KB Output is correct
49 Correct 253 ms 3344 KB Output is correct
50 Correct 236 ms 3368 KB Output is correct
51 Correct 269 ms 3468 KB Output is correct
52 Correct 269 ms 3372 KB Output is correct
53 Correct 258 ms 3392 KB Output is correct
54 Correct 264 ms 3416 KB Output is correct
55 Correct 261 ms 3432 KB Output is correct
56 Correct 256 ms 3540 KB Output is correct
57 Correct 317 ms 3828 KB Output is correct
58 Correct 362 ms 4184 KB Output is correct
59 Correct 409 ms 4012 KB Output is correct
60 Correct 392 ms 4084 KB Output is correct
61 Correct 392 ms 4136 KB Output is correct
62 Correct 387 ms 3968 KB Output is correct
63 Correct 377 ms 4148 KB Output is correct
64 Correct 394 ms 4056 KB Output is correct
65 Correct 352 ms 4004 KB Output is correct
66 Correct 382 ms 4132 KB Output is correct
67 Correct 373 ms 4168 KB Output is correct
68 Correct 383 ms 4220 KB Output is correct
69 Correct 463 ms 4248 KB Output is correct
70 Correct 544 ms 4248 KB Output is correct
71 Correct 522 ms 4308 KB Output is correct
72 Correct 523 ms 4312 KB Output is correct
73 Correct 516 ms 4292 KB Output is correct
74 Correct 581 ms 4312 KB Output is correct
75 Correct 567 ms 4412 KB Output is correct
76 Correct 538 ms 4644 KB Output is correct
77 Correct 544 ms 4356 KB Output is correct
78 Incorrect 85 ms 620 KB Incorrect
79 Halted 0 ms 0 KB -