Submission #1081059

# Submission time Handle Problem Language Result Execution time Memory
1081059 2024-08-29T17:40:38 Z AmirAli_H1 Beech Tree (IOI23_beechtree) C++17
71 / 100
147 ms 56660 KB
// In the name of Allah

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

typedef			long long				ll;
typedef			pair<int, int>			pii;
typedef			pair<ll, ll>			pll;

#define			F						first
#define			S						second
#define			endl					'\n'
#define			sep						' '
#define			pb						push_back
#define			Mp						make_pair
#define			all(x)					(x).begin(),(x).end()
#define			len(x)					((ll) (x).size())

const int maxn = 2e5 + 4;
const int maxs = 2000 + 4;
const int maxlg = 12;

int n, m;
int par[maxn], col[maxn];
vector<pii> adj[maxn];
int h[maxn]; vector<int> arr;
vector<int> ls1, ls2;
int val[maxs][maxs];
int M[maxn]; vector<int> ans;
int st[maxn], ft[maxn], timer;
int up[maxn][maxlg], cnt[maxn];
int mxh[maxn], mxcnt; map<int, int> cntx;

bool cmp1(int i, int j) {
	return (h[i] > h[j]);
}

bool cmp2(int i, int j) {
	return (Mp(len(adj[i]), -h[i]) > Mp(len(adj[j]), -h[j]));
}

bool is_gr(int v, int u) {
	return (st[v] <= st[u] && ft[v] >= ft[u]);
}

int lca(int u, int v) {
	if (is_gr(u, v)) return u;
	if (is_gr(v, u)) return v;
	for (int i = maxlg - 1; i >= 0; i--) {
		if (!is_gr(up[v][i], u)) v = up[v][i];
	}
	return up[v][0];
}

void pre_dfs(int v) {
	up[v][0] = (par[v] != -1) ? par[v] : v;
	for (int i = 1; i < maxlg; i++) up[v][i] = up[up[v][i - 1]][i - 1];
	
	st[v] = timer++; mxh[v] = 0;
	for (auto f : adj[v]) {
		int u = f.S;
		h[u] = h[v] + 1;
		pre_dfs(u);
		mxh[v] = max(mxh[v], mxh[u] + 1);
	}
	ft[v] = timer;
}

void dfs(int v) {
	for (auto f : adj[v]) {
		int u = f.S;
		dfs(u);
		M[v] += M[u];
	}
}

void setx(int v, vector<int> & ls) {
	for (auto f : adj[v]) {
		int c = f.F, u = f.S;
		if (ls[c] == -1) ls[c] = u;
		else ls[c] = -2;
	}
}

void setd(int v, vector<int> & ls) {
	for (auto f : adj[v]) {
		int c = f.F, u = f.S;
		ls[c] = -1;
	}
}

bool ok(int u, int v) {
	for (auto f : adj[u]) {
		int c = f.F;
		if (ls1[c] == -2) return 0;
	}
	for (auto f : adj[v]) {
		int c = f.F;
		if (ls2[c] == -2) return 0;
	}
	
	int T = 0; bool flag = 1;
	for (auto f : adj[u]) {
		int c = f.F;
		if (ls2[c] == -1) {
			flag = 0;
			break;
		}
	}
	T += flag;
	
	flag = 1;
	for (auto f : adj[v]) {
		int c = f.F;
		if (ls1[c] == -1) {
			flag = 0;
			break;
		}
	}
	T += flag;
	
	return (T >= 1);
}

void solve1() {
	arr.clear(); arr.resize(n);
	iota(all(arr), 0); sort(all(arr), cmp1);
	
	for (int i1 = 0; i1 < len(arr); i1++) {
		for (int i2 = i1 + 1; i2 < len(arr); i2++) {
			int u = arr[i1], v = arr[i2];
			setx(u, ls1); setx(v, ls2);
			if (!ok(u, v)) {
				val[u][v] = val[v][u] = -23;
			}
			else {
				if (len(adj[u]) > len(adj[v])) {
					val[u][v] = 1; val[v][u] = -1;
				}
				else if (len(adj[v]) > len(adj[u])) {
					val[u][v] = -1; val[v][u] = 1;
				}
				else {
					val[u][v] = val[v][u] = 0;
				}
				for (auto f : adj[u]) {
					int c = f.F;
					int ux = ls1[c], vx = ls2[c];
					if (vx == -1) continue;
					if (val[ux][vx] == -23 || val[u][v] == -23) {
						val[u][v] = val[v][u] = -23;
					}
					else if (val[ux][vx] == 1) {
						if (val[u][v] == -1) val[u][v] = val[v][u] = -23;
						else {
							val[u][v] = 1; val[v][u] = -1;
						}
					}
					else if (val[ux][vx] == -1) {
						if (val[u][v] == 1) val[u][v] = val[v][u] = -23;
						else {
							val[u][v] = -1; val[v][u] = 1;
						}
					}
				}
			}
			if (val[u][v] == -23) {
				int r = lca(u, v);
				M[r]++;
			}
			setd(u, ls1); setd(v, ls2);
		}
	}
}

void dfsx(int v) {
	arr.pb(v);
	for (auto f : adj[v]) {
		int u = f.S;
		dfsx(u);
	}
}

bool okx() {
	for (int i = 1; i < len(arr); i++) {
		int v1 = arr[i - 1], v2 = arr[i];
		setx(v1, ls1);
		for (auto f : adj[v2]) {
			int c = f.F;
			if (ls1[c] == -1) return 0;
		}
		setd(v1, ls1);
	}
	return 1;
}

void solvex() {
	for (int v = 0; v < n; v++) {
		setx(v, ls1);
		for (auto f : adj[v]) {
			int c = f.F;
			if (ls1[c] == -2) M[v]++;
		}
		for (auto f : adj[v]) {
			int u = f.S;
			for (auto g : adj[u]) {
				int c = g.F;
				if (ls1[c] == -1) M[v]++;
			}
		}
		setd(v, ls1);
	}
	for (int v = 0; v < n; v++) {
		if (mxh[v] <= 2) {
			arr.clear();
			dfsx(v);
			sort(all(arr), cmp2);
			if (!okx()) M[v]++;
		}
		else if (mxcnt <= 2) M[v]++;
	}
}

vector<int> beechtree(int Nx, int Mx, vector<int> Px, vector<int> Cx) {
	n = Nx; m = Mx;
	for (int i = 0; i < n; i++) Cx[i]--;
	for (int i = 0; i < n; i++) {
		par[i] = Px[i]; col[i] = Cx[i];
		cntx[col[i]]++; mxcnt = max(mxcnt, cntx[col[i]]);
	}
	for (int i = 1; i < n; i++) {
		adj[par[i]].pb(Mp(col[i], i));
	}
	for (int i = 0; i < n; i++) sort(all(adj[i]));
	
	pre_dfs(0);
	
	ls1.resize(m); ls2.resize(m);
	fill(all(ls1), -1); fill(all(ls2), -1);
	
	if (n <= 2000) solve1();
	else solvex();
	
	dfs(0);
	ans.resize(n);
	for (int i = 0; i < n; i++) {
		if (M[i] == 0) ans[i] = 1;
		else ans[i] = 0;
	}
	return ans;
}

Compilation message

beechtree.cpp: In function 'void setd(int, std::vector<int>&)':
beechtree.cpp:88:16: warning: unused variable 'u' [-Wunused-variable]
   88 |   int c = f.F, u = f.S;
      |                ^
# Verdict Execution time Memory Grader output
1 Correct 2 ms 10584 KB Output is correct
2 Correct 2 ms 10588 KB Output is correct
3 Correct 2 ms 10584 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 10588 KB Output is correct
2 Correct 2 ms 10704 KB Output is correct
3 Correct 1 ms 10584 KB Output is correct
4 Correct 2 ms 10588 KB Output is correct
5 Correct 2 ms 10584 KB Output is correct
6 Correct 2 ms 10588 KB Output is correct
7 Correct 1 ms 10588 KB Output is correct
8 Correct 2 ms 10584 KB Output is correct
9 Correct 1 ms 10588 KB Output is correct
10 Correct 2 ms 10584 KB Output is correct
11 Correct 2 ms 10588 KB Output is correct
12 Correct 2 ms 10588 KB Output is correct
13 Correct 1 ms 10588 KB Output is correct
14 Correct 1 ms 10652 KB Output is correct
15 Correct 1 ms 10588 KB Output is correct
16 Correct 2 ms 10588 KB Output is correct
17 Correct 1 ms 10696 KB Output is correct
18 Correct 1 ms 10588 KB Output is correct
19 Correct 2 ms 10588 KB Output is correct
20 Correct 1 ms 10588 KB Output is correct
21 Correct 2 ms 10588 KB Output is correct
22 Correct 2 ms 10680 KB Output is correct
23 Correct 1 ms 10588 KB Output is correct
24 Correct 1 ms 10588 KB Output is correct
25 Correct 2 ms 10588 KB Output is correct
26 Correct 1 ms 10588 KB Output is correct
27 Correct 1 ms 10588 KB Output is correct
28 Correct 1 ms 10680 KB Output is correct
29 Correct 2 ms 10588 KB Output is correct
30 Correct 1 ms 10696 KB Output is correct
31 Correct 2 ms 10584 KB Output is correct
32 Correct 2 ms 10588 KB Output is correct
33 Correct 2 ms 10588 KB Output is correct
34 Correct 2 ms 10588 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 10588 KB Output is correct
2 Correct 2 ms 10704 KB Output is correct
3 Correct 1 ms 10584 KB Output is correct
4 Correct 2 ms 10588 KB Output is correct
5 Correct 2 ms 10584 KB Output is correct
6 Correct 2 ms 10588 KB Output is correct
7 Correct 147 ms 56660 KB Output is correct
8 Correct 118 ms 54228 KB Output is correct
9 Correct 2 ms 12636 KB Output is correct
10 Correct 2 ms 12636 KB Output is correct
11 Correct 2 ms 12632 KB Output is correct
12 Correct 2 ms 12636 KB Output is correct
13 Correct 34 ms 26672 KB Output is correct
14 Correct 35 ms 26712 KB Output is correct
15 Correct 36 ms 26972 KB Output is correct
16 Correct 40 ms 27028 KB Output is correct
17 Correct 76 ms 49200 KB Output is correct
18 Correct 69 ms 49612 KB Output is correct
19 Correct 111 ms 53844 KB Output is correct
20 Correct 139 ms 55636 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 10584 KB Output is correct
2 Correct 2 ms 12636 KB Output is correct
3 Correct 2 ms 10588 KB Output is correct
4 Correct 2 ms 10588 KB Output is correct
5 Correct 2 ms 10588 KB Output is correct
6 Correct 2 ms 10588 KB Output is correct
7 Correct 1 ms 10588 KB Output is correct
8 Correct 2 ms 10584 KB Output is correct
9 Correct 2 ms 10588 KB Output is correct
10 Correct 2 ms 10588 KB Output is correct
11 Correct 16 ms 20316 KB Output is correct
12 Correct 11 ms 18524 KB Output is correct
13 Correct 10 ms 19408 KB Output is correct
14 Correct 10 ms 19292 KB Output is correct
15 Correct 45 ms 22884 KB Output is correct
16 Correct 45 ms 22216 KB Output is correct
17 Correct 43 ms 22736 KB Output is correct
18 Correct 45 ms 22744 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 10588 KB Output is correct
2 Correct 2 ms 10704 KB Output is correct
3 Correct 1 ms 10588 KB Output is correct
4 Correct 2 ms 10584 KB Output is correct
5 Correct 147 ms 56660 KB Output is correct
6 Correct 118 ms 54228 KB Output is correct
7 Correct 2 ms 12636 KB Output is correct
8 Correct 2 ms 10844 KB Output is correct
9 Correct 51 ms 26820 KB Output is correct
10 Correct 39 ms 26960 KB Output is correct
11 Correct 128 ms 40788 KB Output is correct
12 Correct 140 ms 37212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 10584 KB Output is correct
2 Correct 2 ms 10588 KB Output is correct
3 Correct 2 ms 10584 KB Output is correct
4 Correct 2 ms 10588 KB Output is correct
5 Correct 2 ms 10704 KB Output is correct
6 Correct 1 ms 10584 KB Output is correct
7 Correct 2 ms 10588 KB Output is correct
8 Correct 2 ms 10584 KB Output is correct
9 Correct 2 ms 10588 KB Output is correct
10 Correct 1 ms 10588 KB Output is correct
11 Correct 2 ms 10584 KB Output is correct
12 Correct 1 ms 10588 KB Output is correct
13 Correct 2 ms 10584 KB Output is correct
14 Correct 2 ms 10588 KB Output is correct
15 Correct 2 ms 10588 KB Output is correct
16 Correct 1 ms 10588 KB Output is correct
17 Correct 1 ms 10652 KB Output is correct
18 Correct 1 ms 10588 KB Output is correct
19 Correct 2 ms 10588 KB Output is correct
20 Correct 1 ms 10696 KB Output is correct
21 Correct 1 ms 10588 KB Output is correct
22 Correct 2 ms 10588 KB Output is correct
23 Correct 1 ms 10588 KB Output is correct
24 Correct 2 ms 10588 KB Output is correct
25 Correct 2 ms 10680 KB Output is correct
26 Correct 1 ms 10588 KB Output is correct
27 Correct 1 ms 10588 KB Output is correct
28 Correct 2 ms 10588 KB Output is correct
29 Correct 1 ms 10588 KB Output is correct
30 Correct 1 ms 10588 KB Output is correct
31 Correct 1 ms 10680 KB Output is correct
32 Correct 2 ms 10588 KB Output is correct
33 Correct 1 ms 10696 KB Output is correct
34 Correct 2 ms 10584 KB Output is correct
35 Correct 2 ms 10588 KB Output is correct
36 Correct 2 ms 10588 KB Output is correct
37 Correct 2 ms 10588 KB Output is correct
38 Correct 2 ms 12636 KB Output is correct
39 Correct 2 ms 12636 KB Output is correct
40 Correct 2 ms 12632 KB Output is correct
41 Correct 2 ms 12636 KB Output is correct
42 Correct 2 ms 10584 KB Output is correct
43 Correct 2 ms 12636 KB Output is correct
44 Correct 2 ms 10588 KB Output is correct
45 Correct 2 ms 10588 KB Output is correct
46 Correct 2 ms 10588 KB Output is correct
47 Correct 2 ms 10588 KB Output is correct
48 Correct 1 ms 10588 KB Output is correct
49 Correct 2 ms 10584 KB Output is correct
50 Correct 2 ms 10588 KB Output is correct
51 Correct 2 ms 10588 KB Output is correct
52 Correct 2 ms 12636 KB Output is correct
53 Correct 2 ms 10844 KB Output is correct
54 Correct 2 ms 12632 KB Output is correct
55 Correct 2 ms 12636 KB Output is correct
56 Correct 2 ms 10844 KB Output is correct
57 Correct 2 ms 10844 KB Output is correct
58 Correct 2 ms 12744 KB Output is correct
59 Correct 2 ms 10844 KB Output is correct
60 Correct 2 ms 12636 KB Output is correct
61 Correct 2 ms 12636 KB Output is correct
62 Correct 2 ms 12636 KB Output is correct
63 Correct 2 ms 12636 KB Output is correct
64 Correct 2 ms 12788 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 10588 KB Output is correct
2 Correct 2 ms 10704 KB Output is correct
3 Correct 1 ms 10588 KB Output is correct
4 Correct 2 ms 10584 KB Output is correct
5 Correct 1 ms 10588 KB Output is correct
6 Correct 2 ms 10584 KB Output is correct
7 Correct 2 ms 10588 KB Output is correct
8 Correct 2 ms 10588 KB Output is correct
9 Correct 1 ms 10588 KB Output is correct
10 Correct 1 ms 10652 KB Output is correct
11 Correct 1 ms 10588 KB Output is correct
12 Correct 2 ms 10588 KB Output is correct
13 Correct 1 ms 10696 KB Output is correct
14 Correct 1 ms 10588 KB Output is correct
15 Correct 2 ms 10588 KB Output is correct
16 Correct 1 ms 10588 KB Output is correct
17 Correct 2 ms 10588 KB Output is correct
18 Correct 2 ms 10680 KB Output is correct
19 Correct 1 ms 10588 KB Output is correct
20 Correct 1 ms 10588 KB Output is correct
21 Correct 2 ms 10588 KB Output is correct
22 Correct 1 ms 10588 KB Output is correct
23 Correct 1 ms 10588 KB Output is correct
24 Correct 1 ms 10680 KB Output is correct
25 Correct 36 ms 25168 KB Output is correct
26 Correct 35 ms 25124 KB Output is correct
27 Correct 36 ms 25320 KB Output is correct
28 Correct 46 ms 25180 KB Output is correct
29 Correct 34 ms 25188 KB Output is correct
30 Correct 107 ms 25180 KB Output is correct
31 Correct 58 ms 25176 KB Output is correct
32 Correct 69 ms 25044 KB Output is correct
33 Correct 71 ms 24912 KB Output is correct
34 Correct 43 ms 25184 KB Output is correct
35 Correct 58 ms 25188 KB Output is correct
36 Correct 50 ms 24664 KB Output is correct
37 Correct 50 ms 25180 KB Output is correct
38 Correct 138 ms 25180 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 10584 KB Output is correct
2 Correct 2 ms 10588 KB Output is correct
3 Correct 2 ms 10584 KB Output is correct
4 Correct 2 ms 10588 KB Output is correct
5 Correct 2 ms 10704 KB Output is correct
6 Correct 1 ms 10584 KB Output is correct
7 Correct 2 ms 10588 KB Output is correct
8 Correct 2 ms 10584 KB Output is correct
9 Correct 2 ms 10588 KB Output is correct
10 Correct 1 ms 10588 KB Output is correct
11 Correct 2 ms 10584 KB Output is correct
12 Correct 1 ms 10588 KB Output is correct
13 Correct 2 ms 10584 KB Output is correct
14 Correct 2 ms 10588 KB Output is correct
15 Correct 2 ms 10588 KB Output is correct
16 Correct 1 ms 10588 KB Output is correct
17 Correct 1 ms 10652 KB Output is correct
18 Correct 1 ms 10588 KB Output is correct
19 Correct 2 ms 10588 KB Output is correct
20 Correct 1 ms 10696 KB Output is correct
21 Correct 1 ms 10588 KB Output is correct
22 Correct 2 ms 10588 KB Output is correct
23 Correct 1 ms 10588 KB Output is correct
24 Correct 2 ms 10588 KB Output is correct
25 Correct 2 ms 10680 KB Output is correct
26 Correct 1 ms 10588 KB Output is correct
27 Correct 1 ms 10588 KB Output is correct
28 Correct 2 ms 10588 KB Output is correct
29 Correct 1 ms 10588 KB Output is correct
30 Correct 1 ms 10588 KB Output is correct
31 Correct 1 ms 10680 KB Output is correct
32 Correct 2 ms 10588 KB Output is correct
33 Correct 1 ms 10696 KB Output is correct
34 Correct 2 ms 10584 KB Output is correct
35 Correct 2 ms 10588 KB Output is correct
36 Correct 2 ms 10588 KB Output is correct
37 Correct 2 ms 10588 KB Output is correct
38 Correct 2 ms 12636 KB Output is correct
39 Correct 2 ms 12636 KB Output is correct
40 Correct 2 ms 12632 KB Output is correct
41 Correct 2 ms 12636 KB Output is correct
42 Correct 34 ms 26672 KB Output is correct
43 Correct 35 ms 26712 KB Output is correct
44 Correct 36 ms 26972 KB Output is correct
45 Correct 40 ms 27028 KB Output is correct
46 Correct 2 ms 10584 KB Output is correct
47 Correct 2 ms 12636 KB Output is correct
48 Correct 2 ms 10588 KB Output is correct
49 Correct 2 ms 10588 KB Output is correct
50 Correct 2 ms 10588 KB Output is correct
51 Correct 2 ms 10588 KB Output is correct
52 Correct 1 ms 10588 KB Output is correct
53 Correct 2 ms 10584 KB Output is correct
54 Correct 2 ms 10588 KB Output is correct
55 Correct 2 ms 10588 KB Output is correct
56 Correct 16 ms 20316 KB Output is correct
57 Correct 11 ms 18524 KB Output is correct
58 Correct 10 ms 19408 KB Output is correct
59 Correct 10 ms 19292 KB Output is correct
60 Correct 2 ms 12636 KB Output is correct
61 Correct 2 ms 10844 KB Output is correct
62 Correct 51 ms 26820 KB Output is correct
63 Correct 39 ms 26960 KB Output is correct
64 Correct 2 ms 12632 KB Output is correct
65 Correct 2 ms 12636 KB Output is correct
66 Correct 2 ms 10844 KB Output is correct
67 Correct 2 ms 10844 KB Output is correct
68 Correct 2 ms 12744 KB Output is correct
69 Correct 2 ms 10844 KB Output is correct
70 Correct 2 ms 12636 KB Output is correct
71 Correct 2 ms 12636 KB Output is correct
72 Correct 2 ms 12636 KB Output is correct
73 Correct 2 ms 12636 KB Output is correct
74 Correct 2 ms 12788 KB Output is correct
75 Correct 36 ms 25168 KB Output is correct
76 Correct 35 ms 25124 KB Output is correct
77 Correct 36 ms 25320 KB Output is correct
78 Correct 46 ms 25180 KB Output is correct
79 Correct 34 ms 25188 KB Output is correct
80 Correct 107 ms 25180 KB Output is correct
81 Correct 58 ms 25176 KB Output is correct
82 Correct 69 ms 25044 KB Output is correct
83 Correct 71 ms 24912 KB Output is correct
84 Correct 43 ms 25184 KB Output is correct
85 Correct 58 ms 25188 KB Output is correct
86 Correct 50 ms 24664 KB Output is correct
87 Correct 50 ms 25180 KB Output is correct
88 Correct 138 ms 25180 KB Output is correct
89 Correct 51 ms 26716 KB Output is correct
90 Correct 145 ms 26816 KB Output is correct
91 Correct 47 ms 26712 KB Output is correct
92 Correct 92 ms 26796 KB Output is correct
93 Correct 92 ms 26704 KB Output is correct
94 Correct 38 ms 26716 KB Output is correct
95 Correct 40 ms 26712 KB Output is correct
96 Correct 54 ms 26248 KB Output is correct
97 Correct 51 ms 26800 KB Output is correct
98 Correct 124 ms 26792 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 10588 KB Output is correct
2 Correct 2 ms 10704 KB Output is correct
3 Correct 1 ms 10588 KB Output is correct
4 Correct 2 ms 10584 KB Output is correct
5 Correct 1 ms 10588 KB Output is correct
6 Correct 2 ms 10584 KB Output is correct
7 Correct 2 ms 10588 KB Output is correct
8 Correct 2 ms 10588 KB Output is correct
9 Correct 1 ms 10588 KB Output is correct
10 Correct 1 ms 10652 KB Output is correct
11 Correct 1 ms 10588 KB Output is correct
12 Correct 2 ms 10588 KB Output is correct
13 Correct 1 ms 10696 KB Output is correct
14 Correct 1 ms 10588 KB Output is correct
15 Correct 2 ms 10588 KB Output is correct
16 Correct 1 ms 10588 KB Output is correct
17 Correct 2 ms 10588 KB Output is correct
18 Correct 2 ms 10680 KB Output is correct
19 Correct 1 ms 10588 KB Output is correct
20 Correct 1 ms 10588 KB Output is correct
21 Correct 2 ms 10588 KB Output is correct
22 Correct 1 ms 10588 KB Output is correct
23 Correct 1 ms 10588 KB Output is correct
24 Correct 1 ms 10680 KB Output is correct
25 Correct 36 ms 25168 KB Output is correct
26 Correct 35 ms 25124 KB Output is correct
27 Correct 36 ms 25320 KB Output is correct
28 Correct 46 ms 25180 KB Output is correct
29 Correct 34 ms 25188 KB Output is correct
30 Correct 107 ms 25180 KB Output is correct
31 Correct 58 ms 25176 KB Output is correct
32 Correct 69 ms 25044 KB Output is correct
33 Correct 71 ms 24912 KB Output is correct
34 Correct 43 ms 25184 KB Output is correct
35 Correct 58 ms 25188 KB Output is correct
36 Correct 50 ms 24664 KB Output is correct
37 Correct 50 ms 25180 KB Output is correct
38 Correct 138 ms 25180 KB Output is correct
39 Correct 70 ms 47060 KB Output is correct
40 Correct 71 ms 47188 KB Output is correct
41 Correct 78 ms 47188 KB Output is correct
42 Correct 70 ms 47172 KB Output is correct
43 Correct 67 ms 42592 KB Output is correct
44 Correct 75 ms 36180 KB Output is correct
45 Correct 93 ms 32564 KB Output is correct
46 Incorrect 74 ms 32592 KB 2nd lines differ - on the 40007th token, expected: '0', found: '1'
47 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 10584 KB Output is correct
2 Correct 2 ms 10588 KB Output is correct
3 Correct 2 ms 10584 KB Output is correct
4 Correct 2 ms 10588 KB Output is correct
5 Correct 2 ms 10704 KB Output is correct
6 Correct 1 ms 10584 KB Output is correct
7 Correct 2 ms 10588 KB Output is correct
8 Correct 2 ms 10584 KB Output is correct
9 Correct 2 ms 10588 KB Output is correct
10 Correct 1 ms 10588 KB Output is correct
11 Correct 2 ms 10584 KB Output is correct
12 Correct 1 ms 10588 KB Output is correct
13 Correct 2 ms 10584 KB Output is correct
14 Correct 2 ms 10588 KB Output is correct
15 Correct 2 ms 10588 KB Output is correct
16 Correct 1 ms 10588 KB Output is correct
17 Correct 1 ms 10652 KB Output is correct
18 Correct 1 ms 10588 KB Output is correct
19 Correct 2 ms 10588 KB Output is correct
20 Correct 1 ms 10696 KB Output is correct
21 Correct 1 ms 10588 KB Output is correct
22 Correct 2 ms 10588 KB Output is correct
23 Correct 1 ms 10588 KB Output is correct
24 Correct 2 ms 10588 KB Output is correct
25 Correct 2 ms 10680 KB Output is correct
26 Correct 1 ms 10588 KB Output is correct
27 Correct 1 ms 10588 KB Output is correct
28 Correct 2 ms 10588 KB Output is correct
29 Correct 1 ms 10588 KB Output is correct
30 Correct 1 ms 10588 KB Output is correct
31 Correct 1 ms 10680 KB Output is correct
32 Correct 2 ms 10588 KB Output is correct
33 Correct 1 ms 10696 KB Output is correct
34 Correct 2 ms 10584 KB Output is correct
35 Correct 2 ms 10588 KB Output is correct
36 Correct 2 ms 10588 KB Output is correct
37 Correct 2 ms 10588 KB Output is correct
38 Correct 147 ms 56660 KB Output is correct
39 Correct 118 ms 54228 KB Output is correct
40 Correct 2 ms 12636 KB Output is correct
41 Correct 2 ms 12636 KB Output is correct
42 Correct 2 ms 12632 KB Output is correct
43 Correct 2 ms 12636 KB Output is correct
44 Correct 34 ms 26672 KB Output is correct
45 Correct 35 ms 26712 KB Output is correct
46 Correct 36 ms 26972 KB Output is correct
47 Correct 40 ms 27028 KB Output is correct
48 Correct 76 ms 49200 KB Output is correct
49 Correct 69 ms 49612 KB Output is correct
50 Correct 111 ms 53844 KB Output is correct
51 Correct 139 ms 55636 KB Output is correct
52 Correct 2 ms 10584 KB Output is correct
53 Correct 2 ms 12636 KB Output is correct
54 Correct 2 ms 10588 KB Output is correct
55 Correct 2 ms 10588 KB Output is correct
56 Correct 2 ms 10588 KB Output is correct
57 Correct 2 ms 10588 KB Output is correct
58 Correct 1 ms 10588 KB Output is correct
59 Correct 2 ms 10584 KB Output is correct
60 Correct 2 ms 10588 KB Output is correct
61 Correct 2 ms 10588 KB Output is correct
62 Correct 16 ms 20316 KB Output is correct
63 Correct 11 ms 18524 KB Output is correct
64 Correct 10 ms 19408 KB Output is correct
65 Correct 10 ms 19292 KB Output is correct
66 Correct 45 ms 22884 KB Output is correct
67 Correct 45 ms 22216 KB Output is correct
68 Correct 43 ms 22736 KB Output is correct
69 Correct 45 ms 22744 KB Output is correct
70 Correct 2 ms 12636 KB Output is correct
71 Correct 2 ms 10844 KB Output is correct
72 Correct 51 ms 26820 KB Output is correct
73 Correct 39 ms 26960 KB Output is correct
74 Correct 128 ms 40788 KB Output is correct
75 Correct 140 ms 37212 KB Output is correct
76 Correct 2 ms 12632 KB Output is correct
77 Correct 2 ms 12636 KB Output is correct
78 Correct 2 ms 10844 KB Output is correct
79 Correct 2 ms 10844 KB Output is correct
80 Correct 2 ms 12744 KB Output is correct
81 Correct 2 ms 10844 KB Output is correct
82 Correct 2 ms 12636 KB Output is correct
83 Correct 2 ms 12636 KB Output is correct
84 Correct 2 ms 12636 KB Output is correct
85 Correct 2 ms 12636 KB Output is correct
86 Correct 2 ms 12788 KB Output is correct
87 Correct 36 ms 25168 KB Output is correct
88 Correct 35 ms 25124 KB Output is correct
89 Correct 36 ms 25320 KB Output is correct
90 Correct 46 ms 25180 KB Output is correct
91 Correct 34 ms 25188 KB Output is correct
92 Correct 107 ms 25180 KB Output is correct
93 Correct 58 ms 25176 KB Output is correct
94 Correct 69 ms 25044 KB Output is correct
95 Correct 71 ms 24912 KB Output is correct
96 Correct 43 ms 25184 KB Output is correct
97 Correct 58 ms 25188 KB Output is correct
98 Correct 50 ms 24664 KB Output is correct
99 Correct 50 ms 25180 KB Output is correct
100 Correct 138 ms 25180 KB Output is correct
101 Correct 51 ms 26716 KB Output is correct
102 Correct 145 ms 26816 KB Output is correct
103 Correct 47 ms 26712 KB Output is correct
104 Correct 92 ms 26796 KB Output is correct
105 Correct 92 ms 26704 KB Output is correct
106 Correct 38 ms 26716 KB Output is correct
107 Correct 40 ms 26712 KB Output is correct
108 Correct 54 ms 26248 KB Output is correct
109 Correct 51 ms 26800 KB Output is correct
110 Correct 124 ms 26792 KB Output is correct
111 Correct 70 ms 47060 KB Output is correct
112 Correct 71 ms 47188 KB Output is correct
113 Correct 78 ms 47188 KB Output is correct
114 Correct 70 ms 47172 KB Output is correct
115 Correct 67 ms 42592 KB Output is correct
116 Correct 75 ms 36180 KB Output is correct
117 Correct 93 ms 32564 KB Output is correct
118 Incorrect 74 ms 32592 KB 2nd lines differ - on the 40007th token, expected: '0', found: '1'
119 Halted 0 ms 0 KB -