답안 #1081282

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1081282 2024-08-29T20:57:52 Z AmirAli_H1 참나무 (IOI23_beechtree) C++17
100 / 100
367 ms 83968 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;

int n, m;
int par[maxn], col[maxn];
vector<pii> adj[maxn], lsx[maxn];
int sz[maxn], val[maxn];
vector<int> ls[maxn], ans;
int arr[maxn]; set<pii> st[maxn];

bool cmp(int i, int j) {
	return (lsx[i] < lsx[j]);
}

void calx(int v) {
	for (auto f : adj[v]) {
		int c = f.F, u = f.S;
		lsx[v].pb(Mp(c, val[u]));
	}
}

int GIx(int v, int c) {
	int j = lower_bound(all(adj[v]), Mp(c, -1)) - adj[v].begin();
	if (j < len(adj[v]) && adj[v][j].F == c) return j;
	else return -1;
}

bool ok(int v1, int v2) {
	if (val[v1] == val[v2]) return 1;
	else if (val[v1] > val[v2] || len(adj[v1]) > len(adj[v2])) return 0;
	for (auto f : adj[v1]) {
		int c = f.F, u1 = f.S;
		int j = GIx(v2, c);
		if (j == -1) return 0;
		int u2 = adj[v2][j].S;
		if (val[u1] > val[u2]) return 0;
	}
	return 1;
}

bool addx(int v, int x) {
	st[v].insert(Mp(val[x], x));
	auto it = st[v].find(Mp(val[x], x));
	if (it != st[v].begin()) {
		auto itx = it; itx--;
		if (!ok((*itx).S, (*it).S)) return 0;
	}
	auto itx = it; itx++;
	if (itx != st[v].end()) {
		if (!ok((*it).S, (*itx).S)) return 0;
	}
	return 1;
}

void pre_dfs(int v) {
	sz[v] = 1;
	for (auto f : adj[v]) {
		int c = f.F, u = f.S;
		pre_dfs(u);
		sz[v] += sz[u];
	}
}

void res_dfs(int v) {
	for (auto f : adj[v]) {
		int c = f.F, u = f.S;
		res_dfs(u);
	}
	
	if (ans[v] == 0) return ;
	for (auto f : adj[v]) {
		int c = f.F, u = f.S;
		if (ans[u] == 0) {
			ans[v] = 0; return ;
		}
	}
	
	addx(v, v);
	for (auto f : adj[v]) {
		int c = f.F, u = f.S;
		if (len(st[u]) > len(st[v])) st[v].swap(st[u]);
		for (auto g : st[u]) {
			if (!addx(v, g.S)) {
				ans[v] = 0; return ;
			}
		}
		st[u].clear();
	}
}

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];
	}
	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);
	for (int v = 0; v < n; v++) ls[sz[v]].pb(v);
	
	int x = 0;
	for (int R = 1; R <= n; R++) {
		int j = 0;
		for (int v : ls[R]) {
			calx(v);
			arr[j++] = v;
		}
		sort(arr, arr + j, cmp);
		
		for (int i = 0; i < j; i++) {
			if (i - 1 >= 0) {
				int u1 = arr[i - 1], u2 = arr[i];
				if (lsx[u1] != lsx[u2]) x++;
			}
			int v = arr[i];
			val[v] = x;
		}
		x++;
	}
	
	ans.resize(n);
	for (int v = 0; v < n; v++) {
		ans[v] = 1;
		for (int j = 1; j < len(adj[v]); j++) {
			if (adj[v][j - 1].F == adj[v][j].F) {
				ans[v] = 0;
				break;
			}
		}
	}
	res_dfs(0);
	
	return ans;
}

Compilation message

beechtree.cpp: In function 'void pre_dfs(int)':
beechtree.cpp:76:7: warning: unused variable 'c' [-Wunused-variable]
   76 |   int c = f.F, u = f.S;
      |       ^
beechtree.cpp: In function 'void res_dfs(int)':
beechtree.cpp:84:7: warning: unused variable 'c' [-Wunused-variable]
   84 |   int c = f.F, u = f.S;
      |       ^
beechtree.cpp:90:7: warning: unused variable 'c' [-Wunused-variable]
   90 |   int c = f.F, u = f.S;
      |       ^
beechtree.cpp:98:7: warning: unused variable 'c' [-Wunused-variable]
   98 |   int c = f.F, u = f.S;
      |       ^
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 23896 KB Output is correct
2 Correct 11 ms 23896 KB Output is correct
3 Correct 9 ms 23704 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 23900 KB Output is correct
2 Correct 11 ms 23900 KB Output is correct
3 Correct 10 ms 23900 KB Output is correct
4 Correct 10 ms 23760 KB Output is correct
5 Correct 11 ms 23900 KB Output is correct
6 Correct 10 ms 23900 KB Output is correct
7 Correct 12 ms 23900 KB Output is correct
8 Correct 11 ms 23896 KB Output is correct
9 Correct 12 ms 23900 KB Output is correct
10 Correct 10 ms 23900 KB Output is correct
11 Correct 13 ms 23900 KB Output is correct
12 Correct 10 ms 23896 KB Output is correct
13 Correct 12 ms 23900 KB Output is correct
14 Correct 9 ms 23900 KB Output is correct
15 Correct 11 ms 23936 KB Output is correct
16 Correct 11 ms 23896 KB Output is correct
17 Correct 10 ms 23900 KB Output is correct
18 Correct 10 ms 23900 KB Output is correct
19 Correct 10 ms 23896 KB Output is correct
20 Correct 11 ms 23896 KB Output is correct
21 Correct 10 ms 23716 KB Output is correct
22 Correct 10 ms 23900 KB Output is correct
23 Correct 10 ms 23892 KB Output is correct
24 Correct 10 ms 23896 KB Output is correct
25 Correct 9 ms 23900 KB Output is correct
26 Correct 11 ms 23896 KB Output is correct
27 Correct 10 ms 23900 KB Output is correct
28 Correct 9 ms 23900 KB Output is correct
29 Correct 10 ms 23932 KB Output is correct
30 Correct 10 ms 23896 KB Output is correct
31 Correct 11 ms 23900 KB Output is correct
32 Correct 12 ms 23900 KB Output is correct
33 Correct 11 ms 23900 KB Output is correct
34 Correct 11 ms 23940 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 23900 KB Output is correct
2 Correct 11 ms 23900 KB Output is correct
3 Correct 10 ms 23900 KB Output is correct
4 Correct 10 ms 23760 KB Output is correct
5 Correct 11 ms 23900 KB Output is correct
6 Correct 10 ms 23900 KB Output is correct
7 Correct 95 ms 74836 KB Output is correct
8 Correct 94 ms 74832 KB Output is correct
9 Correct 9 ms 23896 KB Output is correct
10 Correct 10 ms 23900 KB Output is correct
11 Correct 10 ms 23920 KB Output is correct
12 Correct 10 ms 23900 KB Output is correct
13 Correct 12 ms 24412 KB Output is correct
14 Correct 13 ms 24412 KB Output is correct
15 Correct 12 ms 24412 KB Output is correct
16 Correct 11 ms 24412 KB Output is correct
17 Correct 170 ms 83968 KB Output is correct
18 Correct 137 ms 81284 KB Output is correct
19 Correct 114 ms 76404 KB Output is correct
20 Correct 103 ms 74868 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 23900 KB Output is correct
2 Correct 11 ms 23900 KB Output is correct
3 Correct 10 ms 23900 KB Output is correct
4 Correct 12 ms 23900 KB Output is correct
5 Correct 10 ms 23908 KB Output is correct
6 Correct 11 ms 23716 KB Output is correct
7 Correct 11 ms 23900 KB Output is correct
8 Correct 11 ms 23812 KB Output is correct
9 Correct 11 ms 23900 KB Output is correct
10 Correct 10 ms 23880 KB Output is correct
11 Correct 12 ms 23900 KB Output is correct
12 Correct 13 ms 23900 KB Output is correct
13 Correct 11 ms 23896 KB Output is correct
14 Correct 12 ms 23896 KB Output is correct
15 Correct 82 ms 36832 KB Output is correct
16 Correct 66 ms 36044 KB Output is correct
17 Correct 84 ms 36424 KB Output is correct
18 Correct 99 ms 36808 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 23900 KB Output is correct
2 Correct 11 ms 23900 KB Output is correct
3 Correct 12 ms 23900 KB Output is correct
4 Correct 11 ms 23896 KB Output is correct
5 Correct 95 ms 74836 KB Output is correct
6 Correct 94 ms 74832 KB Output is correct
7 Correct 11 ms 23900 KB Output is correct
8 Correct 11 ms 23936 KB Output is correct
9 Correct 13 ms 24152 KB Output is correct
10 Correct 12 ms 24156 KB Output is correct
11 Correct 112 ms 52732 KB Output is correct
12 Correct 141 ms 47300 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 23896 KB Output is correct
2 Correct 11 ms 23896 KB Output is correct
3 Correct 9 ms 23704 KB Output is correct
4 Correct 10 ms 23900 KB Output is correct
5 Correct 11 ms 23900 KB Output is correct
6 Correct 10 ms 23900 KB Output is correct
7 Correct 10 ms 23760 KB Output is correct
8 Correct 11 ms 23900 KB Output is correct
9 Correct 10 ms 23900 KB Output is correct
10 Correct 12 ms 23900 KB Output is correct
11 Correct 11 ms 23896 KB Output is correct
12 Correct 12 ms 23900 KB Output is correct
13 Correct 10 ms 23900 KB Output is correct
14 Correct 13 ms 23900 KB Output is correct
15 Correct 10 ms 23896 KB Output is correct
16 Correct 12 ms 23900 KB Output is correct
17 Correct 9 ms 23900 KB Output is correct
18 Correct 11 ms 23936 KB Output is correct
19 Correct 11 ms 23896 KB Output is correct
20 Correct 10 ms 23900 KB Output is correct
21 Correct 10 ms 23900 KB Output is correct
22 Correct 10 ms 23896 KB Output is correct
23 Correct 11 ms 23896 KB Output is correct
24 Correct 10 ms 23716 KB Output is correct
25 Correct 10 ms 23900 KB Output is correct
26 Correct 10 ms 23892 KB Output is correct
27 Correct 10 ms 23896 KB Output is correct
28 Correct 9 ms 23900 KB Output is correct
29 Correct 11 ms 23896 KB Output is correct
30 Correct 10 ms 23900 KB Output is correct
31 Correct 9 ms 23900 KB Output is correct
32 Correct 10 ms 23932 KB Output is correct
33 Correct 10 ms 23896 KB Output is correct
34 Correct 11 ms 23900 KB Output is correct
35 Correct 12 ms 23900 KB Output is correct
36 Correct 11 ms 23900 KB Output is correct
37 Correct 11 ms 23940 KB Output is correct
38 Correct 9 ms 23896 KB Output is correct
39 Correct 10 ms 23900 KB Output is correct
40 Correct 10 ms 23920 KB Output is correct
41 Correct 10 ms 23900 KB Output is correct
42 Correct 10 ms 23900 KB Output is correct
43 Correct 11 ms 23900 KB Output is correct
44 Correct 10 ms 23900 KB Output is correct
45 Correct 12 ms 23900 KB Output is correct
46 Correct 10 ms 23908 KB Output is correct
47 Correct 11 ms 23716 KB Output is correct
48 Correct 11 ms 23900 KB Output is correct
49 Correct 11 ms 23812 KB Output is correct
50 Correct 11 ms 23900 KB Output is correct
51 Correct 10 ms 23880 KB Output is correct
52 Correct 11 ms 23900 KB Output is correct
53 Correct 11 ms 23936 KB Output is correct
54 Correct 10 ms 23896 KB Output is correct
55 Correct 9 ms 23900 KB Output is correct
56 Correct 12 ms 23900 KB Output is correct
57 Correct 11 ms 23900 KB Output is correct
58 Correct 10 ms 23852 KB Output is correct
59 Correct 10 ms 23900 KB Output is correct
60 Correct 11 ms 23900 KB Output is correct
61 Correct 10 ms 23900 KB Output is correct
62 Correct 10 ms 23936 KB Output is correct
63 Correct 10 ms 23900 KB Output is correct
64 Correct 11 ms 23748 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 23900 KB Output is correct
2 Correct 11 ms 23900 KB Output is correct
3 Correct 12 ms 23900 KB Output is correct
4 Correct 11 ms 23896 KB Output is correct
5 Correct 12 ms 23900 KB Output is correct
6 Correct 10 ms 23900 KB Output is correct
7 Correct 13 ms 23900 KB Output is correct
8 Correct 10 ms 23896 KB Output is correct
9 Correct 12 ms 23900 KB Output is correct
10 Correct 9 ms 23900 KB Output is correct
11 Correct 11 ms 23936 KB Output is correct
12 Correct 11 ms 23896 KB Output is correct
13 Correct 10 ms 23900 KB Output is correct
14 Correct 10 ms 23900 KB Output is correct
15 Correct 10 ms 23896 KB Output is correct
16 Correct 11 ms 23896 KB Output is correct
17 Correct 10 ms 23716 KB Output is correct
18 Correct 10 ms 23900 KB Output is correct
19 Correct 10 ms 23892 KB Output is correct
20 Correct 10 ms 23896 KB Output is correct
21 Correct 9 ms 23900 KB Output is correct
22 Correct 11 ms 23896 KB Output is correct
23 Correct 10 ms 23900 KB Output is correct
24 Correct 9 ms 23900 KB Output is correct
25 Correct 12 ms 24420 KB Output is correct
26 Correct 11 ms 24412 KB Output is correct
27 Correct 10 ms 24300 KB Output is correct
28 Correct 11 ms 24412 KB Output is correct
29 Correct 11 ms 24460 KB Output is correct
30 Correct 11 ms 24156 KB Output is correct
31 Correct 14 ms 24152 KB Output is correct
32 Correct 14 ms 24156 KB Output is correct
33 Correct 12 ms 24156 KB Output is correct
34 Correct 13 ms 24156 KB Output is correct
35 Correct 13 ms 24136 KB Output is correct
36 Correct 12 ms 24156 KB Output is correct
37 Correct 11 ms 24156 KB Output is correct
38 Correct 12 ms 24156 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 23896 KB Output is correct
2 Correct 11 ms 23896 KB Output is correct
3 Correct 9 ms 23704 KB Output is correct
4 Correct 10 ms 23900 KB Output is correct
5 Correct 11 ms 23900 KB Output is correct
6 Correct 10 ms 23900 KB Output is correct
7 Correct 10 ms 23760 KB Output is correct
8 Correct 11 ms 23900 KB Output is correct
9 Correct 10 ms 23900 KB Output is correct
10 Correct 12 ms 23900 KB Output is correct
11 Correct 11 ms 23896 KB Output is correct
12 Correct 12 ms 23900 KB Output is correct
13 Correct 10 ms 23900 KB Output is correct
14 Correct 13 ms 23900 KB Output is correct
15 Correct 10 ms 23896 KB Output is correct
16 Correct 12 ms 23900 KB Output is correct
17 Correct 9 ms 23900 KB Output is correct
18 Correct 11 ms 23936 KB Output is correct
19 Correct 11 ms 23896 KB Output is correct
20 Correct 10 ms 23900 KB Output is correct
21 Correct 10 ms 23900 KB Output is correct
22 Correct 10 ms 23896 KB Output is correct
23 Correct 11 ms 23896 KB Output is correct
24 Correct 10 ms 23716 KB Output is correct
25 Correct 10 ms 23900 KB Output is correct
26 Correct 10 ms 23892 KB Output is correct
27 Correct 10 ms 23896 KB Output is correct
28 Correct 9 ms 23900 KB Output is correct
29 Correct 11 ms 23896 KB Output is correct
30 Correct 10 ms 23900 KB Output is correct
31 Correct 9 ms 23900 KB Output is correct
32 Correct 10 ms 23932 KB Output is correct
33 Correct 10 ms 23896 KB Output is correct
34 Correct 11 ms 23900 KB Output is correct
35 Correct 12 ms 23900 KB Output is correct
36 Correct 11 ms 23900 KB Output is correct
37 Correct 11 ms 23940 KB Output is correct
38 Correct 9 ms 23896 KB Output is correct
39 Correct 10 ms 23900 KB Output is correct
40 Correct 10 ms 23920 KB Output is correct
41 Correct 10 ms 23900 KB Output is correct
42 Correct 12 ms 24412 KB Output is correct
43 Correct 13 ms 24412 KB Output is correct
44 Correct 12 ms 24412 KB Output is correct
45 Correct 11 ms 24412 KB Output is correct
46 Correct 10 ms 23900 KB Output is correct
47 Correct 11 ms 23900 KB Output is correct
48 Correct 10 ms 23900 KB Output is correct
49 Correct 12 ms 23900 KB Output is correct
50 Correct 10 ms 23908 KB Output is correct
51 Correct 11 ms 23716 KB Output is correct
52 Correct 11 ms 23900 KB Output is correct
53 Correct 11 ms 23812 KB Output is correct
54 Correct 11 ms 23900 KB Output is correct
55 Correct 10 ms 23880 KB Output is correct
56 Correct 12 ms 23900 KB Output is correct
57 Correct 13 ms 23900 KB Output is correct
58 Correct 11 ms 23896 KB Output is correct
59 Correct 12 ms 23896 KB Output is correct
60 Correct 11 ms 23900 KB Output is correct
61 Correct 11 ms 23936 KB Output is correct
62 Correct 13 ms 24152 KB Output is correct
63 Correct 12 ms 24156 KB Output is correct
64 Correct 10 ms 23896 KB Output is correct
65 Correct 9 ms 23900 KB Output is correct
66 Correct 12 ms 23900 KB Output is correct
67 Correct 11 ms 23900 KB Output is correct
68 Correct 10 ms 23852 KB Output is correct
69 Correct 10 ms 23900 KB Output is correct
70 Correct 11 ms 23900 KB Output is correct
71 Correct 10 ms 23900 KB Output is correct
72 Correct 10 ms 23936 KB Output is correct
73 Correct 10 ms 23900 KB Output is correct
74 Correct 11 ms 23748 KB Output is correct
75 Correct 12 ms 24420 KB Output is correct
76 Correct 11 ms 24412 KB Output is correct
77 Correct 10 ms 24300 KB Output is correct
78 Correct 11 ms 24412 KB Output is correct
79 Correct 11 ms 24460 KB Output is correct
80 Correct 11 ms 24156 KB Output is correct
81 Correct 14 ms 24152 KB Output is correct
82 Correct 14 ms 24156 KB Output is correct
83 Correct 12 ms 24156 KB Output is correct
84 Correct 13 ms 24156 KB Output is correct
85 Correct 13 ms 24136 KB Output is correct
86 Correct 12 ms 24156 KB Output is correct
87 Correct 11 ms 24156 KB Output is correct
88 Correct 12 ms 24156 KB Output is correct
89 Correct 11 ms 24408 KB Output is correct
90 Correct 11 ms 24268 KB Output is correct
91 Correct 12 ms 24156 KB Output is correct
92 Correct 12 ms 24204 KB Output is correct
93 Correct 11 ms 24156 KB Output is correct
94 Correct 12 ms 24156 KB Output is correct
95 Correct 13 ms 23980 KB Output is correct
96 Correct 10 ms 24156 KB Output is correct
97 Correct 11 ms 24100 KB Output is correct
98 Correct 11 ms 24132 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 23900 KB Output is correct
2 Correct 11 ms 23900 KB Output is correct
3 Correct 12 ms 23900 KB Output is correct
4 Correct 11 ms 23896 KB Output is correct
5 Correct 12 ms 23900 KB Output is correct
6 Correct 10 ms 23900 KB Output is correct
7 Correct 13 ms 23900 KB Output is correct
8 Correct 10 ms 23896 KB Output is correct
9 Correct 12 ms 23900 KB Output is correct
10 Correct 9 ms 23900 KB Output is correct
11 Correct 11 ms 23936 KB Output is correct
12 Correct 11 ms 23896 KB Output is correct
13 Correct 10 ms 23900 KB Output is correct
14 Correct 10 ms 23900 KB Output is correct
15 Correct 10 ms 23896 KB Output is correct
16 Correct 11 ms 23896 KB Output is correct
17 Correct 10 ms 23716 KB Output is correct
18 Correct 10 ms 23900 KB Output is correct
19 Correct 10 ms 23892 KB Output is correct
20 Correct 10 ms 23896 KB Output is correct
21 Correct 9 ms 23900 KB Output is correct
22 Correct 11 ms 23896 KB Output is correct
23 Correct 10 ms 23900 KB Output is correct
24 Correct 9 ms 23900 KB Output is correct
25 Correct 12 ms 24420 KB Output is correct
26 Correct 11 ms 24412 KB Output is correct
27 Correct 10 ms 24300 KB Output is correct
28 Correct 11 ms 24412 KB Output is correct
29 Correct 11 ms 24460 KB Output is correct
30 Correct 11 ms 24156 KB Output is correct
31 Correct 14 ms 24152 KB Output is correct
32 Correct 14 ms 24156 KB Output is correct
33 Correct 12 ms 24156 KB Output is correct
34 Correct 13 ms 24156 KB Output is correct
35 Correct 13 ms 24136 KB Output is correct
36 Correct 12 ms 24156 KB Output is correct
37 Correct 11 ms 24156 KB Output is correct
38 Correct 12 ms 24156 KB Output is correct
39 Correct 176 ms 83368 KB Output is correct
40 Correct 133 ms 79584 KB Output is correct
41 Correct 124 ms 78280 KB Output is correct
42 Correct 104 ms 74068 KB Output is correct
43 Correct 170 ms 74324 KB Output is correct
44 Correct 130 ms 58960 KB Output is correct
45 Correct 366 ms 54888 KB Output is correct
46 Correct 275 ms 52292 KB Output is correct
47 Correct 215 ms 52144 KB Output is correct
48 Correct 165 ms 52400 KB Output is correct
49 Correct 123 ms 51396 KB Output is correct
50 Correct 367 ms 53056 KB Output is correct
51 Correct 278 ms 50284 KB Output is correct
52 Correct 243 ms 50508 KB Output is correct
53 Correct 169 ms 50380 KB Output is correct
54 Correct 127 ms 48976 KB Output is correct
55 Correct 123 ms 58552 KB Output is correct
56 Correct 128 ms 58960 KB Output is correct
57 Correct 100 ms 49868 KB Output is correct
58 Correct 98 ms 49100 KB Output is correct
59 Correct 107 ms 48844 KB Output is correct
60 Correct 102 ms 48812 KB Output is correct
61 Correct 103 ms 48844 KB Output is correct
62 Correct 102 ms 48964 KB Output is correct
63 Correct 149 ms 60620 KB Output is correct
64 Correct 122 ms 56400 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 23896 KB Output is correct
2 Correct 11 ms 23896 KB Output is correct
3 Correct 9 ms 23704 KB Output is correct
4 Correct 10 ms 23900 KB Output is correct
5 Correct 11 ms 23900 KB Output is correct
6 Correct 10 ms 23900 KB Output is correct
7 Correct 10 ms 23760 KB Output is correct
8 Correct 11 ms 23900 KB Output is correct
9 Correct 10 ms 23900 KB Output is correct
10 Correct 12 ms 23900 KB Output is correct
11 Correct 11 ms 23896 KB Output is correct
12 Correct 12 ms 23900 KB Output is correct
13 Correct 10 ms 23900 KB Output is correct
14 Correct 13 ms 23900 KB Output is correct
15 Correct 10 ms 23896 KB Output is correct
16 Correct 12 ms 23900 KB Output is correct
17 Correct 9 ms 23900 KB Output is correct
18 Correct 11 ms 23936 KB Output is correct
19 Correct 11 ms 23896 KB Output is correct
20 Correct 10 ms 23900 KB Output is correct
21 Correct 10 ms 23900 KB Output is correct
22 Correct 10 ms 23896 KB Output is correct
23 Correct 11 ms 23896 KB Output is correct
24 Correct 10 ms 23716 KB Output is correct
25 Correct 10 ms 23900 KB Output is correct
26 Correct 10 ms 23892 KB Output is correct
27 Correct 10 ms 23896 KB Output is correct
28 Correct 9 ms 23900 KB Output is correct
29 Correct 11 ms 23896 KB Output is correct
30 Correct 10 ms 23900 KB Output is correct
31 Correct 9 ms 23900 KB Output is correct
32 Correct 10 ms 23932 KB Output is correct
33 Correct 10 ms 23896 KB Output is correct
34 Correct 11 ms 23900 KB Output is correct
35 Correct 12 ms 23900 KB Output is correct
36 Correct 11 ms 23900 KB Output is correct
37 Correct 11 ms 23940 KB Output is correct
38 Correct 95 ms 74836 KB Output is correct
39 Correct 94 ms 74832 KB Output is correct
40 Correct 9 ms 23896 KB Output is correct
41 Correct 10 ms 23900 KB Output is correct
42 Correct 10 ms 23920 KB Output is correct
43 Correct 10 ms 23900 KB Output is correct
44 Correct 12 ms 24412 KB Output is correct
45 Correct 13 ms 24412 KB Output is correct
46 Correct 12 ms 24412 KB Output is correct
47 Correct 11 ms 24412 KB Output is correct
48 Correct 170 ms 83968 KB Output is correct
49 Correct 137 ms 81284 KB Output is correct
50 Correct 114 ms 76404 KB Output is correct
51 Correct 103 ms 74868 KB Output is correct
52 Correct 10 ms 23900 KB Output is correct
53 Correct 11 ms 23900 KB Output is correct
54 Correct 10 ms 23900 KB Output is correct
55 Correct 12 ms 23900 KB Output is correct
56 Correct 10 ms 23908 KB Output is correct
57 Correct 11 ms 23716 KB Output is correct
58 Correct 11 ms 23900 KB Output is correct
59 Correct 11 ms 23812 KB Output is correct
60 Correct 11 ms 23900 KB Output is correct
61 Correct 10 ms 23880 KB Output is correct
62 Correct 12 ms 23900 KB Output is correct
63 Correct 13 ms 23900 KB Output is correct
64 Correct 11 ms 23896 KB Output is correct
65 Correct 12 ms 23896 KB Output is correct
66 Correct 82 ms 36832 KB Output is correct
67 Correct 66 ms 36044 KB Output is correct
68 Correct 84 ms 36424 KB Output is correct
69 Correct 99 ms 36808 KB Output is correct
70 Correct 11 ms 23900 KB Output is correct
71 Correct 11 ms 23936 KB Output is correct
72 Correct 13 ms 24152 KB Output is correct
73 Correct 12 ms 24156 KB Output is correct
74 Correct 112 ms 52732 KB Output is correct
75 Correct 141 ms 47300 KB Output is correct
76 Correct 10 ms 23896 KB Output is correct
77 Correct 9 ms 23900 KB Output is correct
78 Correct 12 ms 23900 KB Output is correct
79 Correct 11 ms 23900 KB Output is correct
80 Correct 10 ms 23852 KB Output is correct
81 Correct 10 ms 23900 KB Output is correct
82 Correct 11 ms 23900 KB Output is correct
83 Correct 10 ms 23900 KB Output is correct
84 Correct 10 ms 23936 KB Output is correct
85 Correct 10 ms 23900 KB Output is correct
86 Correct 11 ms 23748 KB Output is correct
87 Correct 12 ms 24420 KB Output is correct
88 Correct 11 ms 24412 KB Output is correct
89 Correct 10 ms 24300 KB Output is correct
90 Correct 11 ms 24412 KB Output is correct
91 Correct 11 ms 24460 KB Output is correct
92 Correct 11 ms 24156 KB Output is correct
93 Correct 14 ms 24152 KB Output is correct
94 Correct 14 ms 24156 KB Output is correct
95 Correct 12 ms 24156 KB Output is correct
96 Correct 13 ms 24156 KB Output is correct
97 Correct 13 ms 24136 KB Output is correct
98 Correct 12 ms 24156 KB Output is correct
99 Correct 11 ms 24156 KB Output is correct
100 Correct 12 ms 24156 KB Output is correct
101 Correct 11 ms 24408 KB Output is correct
102 Correct 11 ms 24268 KB Output is correct
103 Correct 12 ms 24156 KB Output is correct
104 Correct 12 ms 24204 KB Output is correct
105 Correct 11 ms 24156 KB Output is correct
106 Correct 12 ms 24156 KB Output is correct
107 Correct 13 ms 23980 KB Output is correct
108 Correct 10 ms 24156 KB Output is correct
109 Correct 11 ms 24100 KB Output is correct
110 Correct 11 ms 24132 KB Output is correct
111 Correct 176 ms 83368 KB Output is correct
112 Correct 133 ms 79584 KB Output is correct
113 Correct 124 ms 78280 KB Output is correct
114 Correct 104 ms 74068 KB Output is correct
115 Correct 170 ms 74324 KB Output is correct
116 Correct 130 ms 58960 KB Output is correct
117 Correct 366 ms 54888 KB Output is correct
118 Correct 275 ms 52292 KB Output is correct
119 Correct 215 ms 52144 KB Output is correct
120 Correct 165 ms 52400 KB Output is correct
121 Correct 123 ms 51396 KB Output is correct
122 Correct 367 ms 53056 KB Output is correct
123 Correct 278 ms 50284 KB Output is correct
124 Correct 243 ms 50508 KB Output is correct
125 Correct 169 ms 50380 KB Output is correct
126 Correct 127 ms 48976 KB Output is correct
127 Correct 123 ms 58552 KB Output is correct
128 Correct 128 ms 58960 KB Output is correct
129 Correct 100 ms 49868 KB Output is correct
130 Correct 98 ms 49100 KB Output is correct
131 Correct 107 ms 48844 KB Output is correct
132 Correct 102 ms 48812 KB Output is correct
133 Correct 103 ms 48844 KB Output is correct
134 Correct 102 ms 48964 KB Output is correct
135 Correct 149 ms 60620 KB Output is correct
136 Correct 122 ms 56400 KB Output is correct
137 Correct 174 ms 72016 KB Output is correct
138 Correct 128 ms 60024 KB Output is correct
139 Correct 331 ms 57992 KB Output is correct
140 Correct 239 ms 53828 KB Output is correct
141 Correct 199 ms 53620 KB Output is correct
142 Correct 153 ms 53504 KB Output is correct
143 Correct 125 ms 52688 KB Output is correct
144 Correct 296 ms 54472 KB Output is correct
145 Correct 264 ms 50048 KB Output is correct
146 Correct 199 ms 51400 KB Output is correct
147 Correct 165 ms 51144 KB Output is correct
148 Correct 126 ms 49484 KB Output is correct
149 Correct 118 ms 58904 KB Output is correct
150 Correct 104 ms 59004 KB Output is correct
151 Correct 98 ms 50632 KB Output is correct
152 Correct 101 ms 49868 KB Output is correct
153 Correct 101 ms 49616 KB Output is correct
154 Correct 100 ms 49868 KB Output is correct
155 Correct 99 ms 49612 KB Output is correct
156 Correct 109 ms 49864 KB Output is correct
157 Correct 149 ms 61388 KB Output is correct
158 Correct 129 ms 57168 KB Output is correct