답안 #1043442

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1043442 2024-08-04T09:32:38 Z AmirAli_H1 분수 공원 (IOI21_parks) C++17
70 / 100
457 ms 91168 KB
// In the name of Allah

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

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

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

const int maxn = 1e6 + 4;

int n;
vector<pii> adj[maxn]; set<pii> E;
vector<pii> arr, arrx;
int val[maxn], D[maxn];
int mark[maxn], h[maxn];
vector<int> ux, vx, X1, Y1;

int GI(pii x) {
	int j = lower_bound(all(arr), x) - arr.begin();
	if (j < len(arr) && arr[j] == x) return j;
	else return -1;
}

int GIx(pii x) {
	int j = lower_bound(all(arrx), x) - arrx.begin();
	if (j < len(arrx) && arrx[j] == x) return j;
	else return -1;
}

bool ok(int x, int y) {
	int j = GI(Mp(x, y));
	return (j != -1);
}

void addE(int x1, int y1, int x2, int y2) {
	int u = val[GI(Mp(x1, y1))], v = val[GI(Mp(x2, y2))];
	if (u > v) swap(u, v);
	E.insert(Mp(u, v));
	D[u]++; D[v]++;
}

void delE(int x1, int y1, int x2, int y2) {
	int u = val[GI(Mp(x1, y1))], v = val[GI(Mp(x2, y2))];
	if (u > v) swap(u, v);
	E.erase(Mp(u, v));
	D[u]--; D[v]--;
}

void dfs(int v) {
	mark[v] = 1;
	for (auto f : adj[v]) {
		int u = f.F;
		if (!mark[u]) dfs(u);
	}
}

void res_dfs(int v, int i = -1) {
	mark[v] = 1;
	for (auto f : adj[v]) {
		int u = f.F, j = f.S;
		if (!mark[u]) {
			h[u] = h[v] + 1;
			res_dfs(u, j);
			X1[j] = arrx[u].F; Y1[j] = arrx[u].S;
		}
		else if (j != i && h[u] < h[v]) {
			X1[j] = arrx[u].F; Y1[j] = arrx[u].S;
		}
	}
}

bool checkx() {
	for (auto f : E) {
		int u = f.F, v = f.S;
		adj[u].pb(Mp(v, -1)); adj[v].pb(Mp(u, -1));
	}
	dfs(0);
	for (int i = 0; i < n; i++) {
		if (!mark[i]) return 0;
	}
	for (int i = 0; i < n; i++) {
		mark[i] = 0; adj[i].clear();
	}
	return 1;
}

int construct_roads(vector<int> X, vector<int> Y) {
	n = len(X);
	for (int i = 0; i < n; i++) arr.pb(Mp(X[i], Y[i]));
	sort(all(arr));
	
	for (int i = 0; i < n; i++) {
		int j = GI(Mp(X[i], Y[i]));
		val[j] = i;
	}
	
	for (int i = 0; i < n; i++) {
		if (ok(X[i], Y[i] + 2)) {
			addE(X[i], Y[i], X[i], Y[i] + 2);
		}
		if (ok(X[i] + 2, Y[i]) && (!ok(X[i], Y[i] - 2) || !ok(X[i] + 2, Y[i] - 2))) {
			addE(X[i], Y[i], X[i] + 2, Y[i]);
		}
	}
	
	for (int i = 0; i < n; i++) {
		if (D[i] == 4) {
			if (ok(X[i] + 2, Y[i] + 2)) {
				delE(X[i], Y[i], X[i] + 2, Y[i]);
				addE(X[i], Y[i] + 2, X[i] + 2, Y[i] + 2);
			}
			else if (ok(X[i] - 2, Y[i] + 2)) {
				delE(X[i], Y[i], X[i] - 2, Y[i]);
				addE(X[i], Y[i] + 2, X[i] - 2, Y[i] + 2);
			}
		}
	}
	if (!checkx()) return 0;
	
	for (auto f : E) {
		int u = f.F, v = f.S; pii f1, f2;
		int x = (X[u] + X[v]) / 2, y = (Y[u] + Y[v]) / 2;
		if (X[u] == X[v]) {
			f1 = Mp(x - 1, y); f2 = Mp(x + 1, y);
		}
		else {
			f1 = Mp(x, y - 1); f2 = Mp(x, y + 1);
		}
		arrx.pb(f1); arrx.pb(f2);
	}
	sort(all(arrx)); arrx.resize(unique(all(arrx)) - arrx.begin());
	
	for (auto f : E) {
		int u = f.F, v = f.S; pii f1, f2;
		int x = (X[u] + X[v]) / 2, y = (Y[u] + Y[v]) / 2;
		if (X[u] == X[v]) {
			f1 = Mp(x - 1, y); f2 = Mp(x + 1, y);
		}
		else {
			f1 = Mp(x, y - 1); f2 = Mp(x, y + 1);
		}
		int u1 = GIx(f1), v1 = GIx(f2);
		adj[u1].pb(Mp(v1, len(ux))); adj[v1].pb(Mp(u1, len(ux)));
		ux.pb(u); vx.pb(v);
	}
	
	X1.resize(len(ux)); Y1.resize(len(ux));
	for (int i = 0; i < len(arrx); i++) {
		if (!mark[i]) res_dfs(i);
	}
	
	build(ux, vx, X1, Y1);
	return 1;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 29020 KB Output is correct
2 Correct 4 ms 31068 KB Output is correct
3 Correct 4 ms 29020 KB Output is correct
4 Correct 4 ms 31204 KB Output is correct
5 Correct 5 ms 31068 KB Output is correct
6 Correct 5 ms 31064 KB Output is correct
7 Correct 4 ms 31068 KB Output is correct
8 Correct 5 ms 31068 KB Output is correct
9 Correct 153 ms 56080 KB Output is correct
10 Correct 12 ms 33492 KB Output is correct
11 Correct 48 ms 45216 KB Output is correct
12 Correct 16 ms 34520 KB Output is correct
13 Correct 23 ms 36052 KB Output is correct
14 Correct 5 ms 31068 KB Output is correct
15 Correct 5 ms 31324 KB Output is correct
16 Correct 153 ms 55348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 29020 KB Output is correct
2 Correct 4 ms 31068 KB Output is correct
3 Correct 4 ms 29020 KB Output is correct
4 Correct 4 ms 31204 KB Output is correct
5 Correct 5 ms 31068 KB Output is correct
6 Correct 5 ms 31064 KB Output is correct
7 Correct 4 ms 31068 KB Output is correct
8 Correct 5 ms 31068 KB Output is correct
9 Correct 153 ms 56080 KB Output is correct
10 Correct 12 ms 33492 KB Output is correct
11 Correct 48 ms 45216 KB Output is correct
12 Correct 16 ms 34520 KB Output is correct
13 Correct 23 ms 36052 KB Output is correct
14 Correct 5 ms 31068 KB Output is correct
15 Correct 5 ms 31324 KB Output is correct
16 Correct 153 ms 55348 KB Output is correct
17 Correct 5 ms 31064 KB Output is correct
18 Correct 4 ms 31068 KB Output is correct
19 Correct 4 ms 31068 KB Output is correct
20 Correct 4 ms 31000 KB Output is correct
21 Correct 5 ms 31068 KB Output is correct
22 Correct 4 ms 31068 KB Output is correct
23 Correct 376 ms 80416 KB Output is correct
24 Correct 6 ms 31064 KB Output is correct
25 Correct 6 ms 31324 KB Output is correct
26 Correct 8 ms 31324 KB Output is correct
27 Correct 8 ms 31580 KB Output is correct
28 Correct 123 ms 50172 KB Output is correct
29 Correct 206 ms 58088 KB Output is correct
30 Correct 285 ms 69040 KB Output is correct
31 Correct 372 ms 79908 KB Output is correct
32 Correct 5 ms 31064 KB Output is correct
33 Correct 5 ms 31068 KB Output is correct
34 Correct 4 ms 31068 KB Output is correct
35 Correct 5 ms 29160 KB Output is correct
36 Correct 4 ms 28956 KB Output is correct
37 Correct 5 ms 31068 KB Output is correct
38 Correct 4 ms 31068 KB Output is correct
39 Correct 5 ms 31068 KB Output is correct
40 Correct 4 ms 31088 KB Output is correct
41 Correct 5 ms 29020 KB Output is correct
42 Correct 6 ms 31068 KB Output is correct
43 Correct 6 ms 31324 KB Output is correct
44 Correct 8 ms 31324 KB Output is correct
45 Correct 159 ms 54004 KB Output is correct
46 Correct 244 ms 67020 KB Output is correct
47 Correct 260 ms 66768 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 29020 KB Output is correct
2 Correct 4 ms 31068 KB Output is correct
3 Correct 4 ms 29020 KB Output is correct
4 Correct 4 ms 31204 KB Output is correct
5 Correct 5 ms 31068 KB Output is correct
6 Correct 5 ms 31064 KB Output is correct
7 Correct 4 ms 31068 KB Output is correct
8 Correct 5 ms 31068 KB Output is correct
9 Correct 153 ms 56080 KB Output is correct
10 Correct 12 ms 33492 KB Output is correct
11 Correct 48 ms 45216 KB Output is correct
12 Correct 16 ms 34520 KB Output is correct
13 Correct 23 ms 36052 KB Output is correct
14 Correct 5 ms 31068 KB Output is correct
15 Correct 5 ms 31324 KB Output is correct
16 Correct 153 ms 55348 KB Output is correct
17 Correct 5 ms 31064 KB Output is correct
18 Correct 4 ms 31068 KB Output is correct
19 Correct 4 ms 31068 KB Output is correct
20 Correct 4 ms 31000 KB Output is correct
21 Correct 5 ms 31068 KB Output is correct
22 Correct 4 ms 31068 KB Output is correct
23 Correct 376 ms 80416 KB Output is correct
24 Correct 6 ms 31064 KB Output is correct
25 Correct 6 ms 31324 KB Output is correct
26 Correct 8 ms 31324 KB Output is correct
27 Correct 8 ms 31580 KB Output is correct
28 Correct 123 ms 50172 KB Output is correct
29 Correct 206 ms 58088 KB Output is correct
30 Correct 285 ms 69040 KB Output is correct
31 Correct 372 ms 79908 KB Output is correct
32 Correct 5 ms 31064 KB Output is correct
33 Correct 5 ms 31068 KB Output is correct
34 Correct 4 ms 31068 KB Output is correct
35 Correct 5 ms 29160 KB Output is correct
36 Correct 4 ms 28956 KB Output is correct
37 Correct 5 ms 31068 KB Output is correct
38 Correct 4 ms 31068 KB Output is correct
39 Correct 5 ms 31068 KB Output is correct
40 Correct 4 ms 31088 KB Output is correct
41 Correct 5 ms 29020 KB Output is correct
42 Correct 6 ms 31068 KB Output is correct
43 Correct 6 ms 31324 KB Output is correct
44 Correct 8 ms 31324 KB Output is correct
45 Correct 159 ms 54004 KB Output is correct
46 Correct 244 ms 67020 KB Output is correct
47 Correct 260 ms 66768 KB Output is correct
48 Correct 4 ms 31068 KB Output is correct
49 Correct 5 ms 31068 KB Output is correct
50 Correct 4 ms 31184 KB Output is correct
51 Correct 4 ms 31068 KB Output is correct
52 Correct 4 ms 31068 KB Output is correct
53 Correct 5 ms 31068 KB Output is correct
54 Correct 5 ms 31068 KB Output is correct
55 Correct 363 ms 77860 KB Output is correct
56 Correct 4 ms 31068 KB Output is correct
57 Correct 7 ms 31324 KB Output is correct
58 Correct 11 ms 32372 KB Output is correct
59 Correct 11 ms 32092 KB Output is correct
60 Correct 178 ms 52788 KB Output is correct
61 Correct 233 ms 62396 KB Output is correct
62 Correct 288 ms 68868 KB Output is correct
63 Correct 384 ms 77852 KB Output is correct
64 Correct 4 ms 29020 KB Output is correct
65 Correct 4 ms 31068 KB Output is correct
66 Correct 4 ms 29020 KB Output is correct
67 Correct 355 ms 82824 KB Output is correct
68 Correct 358 ms 82976 KB Output is correct
69 Correct 344 ms 83136 KB Output is correct
70 Correct 7 ms 31580 KB Output is correct
71 Correct 13 ms 31932 KB Output is correct
72 Correct 174 ms 53300 KB Output is correct
73 Correct 284 ms 66056 KB Output is correct
74 Correct 392 ms 78104 KB Output is correct
75 Correct 432 ms 86192 KB Output is correct
76 Correct 360 ms 83736 KB Output is correct
77 Correct 10 ms 31580 KB Output is correct
78 Correct 13 ms 32092 KB Output is correct
79 Correct 172 ms 55204 KB Output is correct
80 Correct 310 ms 68876 KB Output is correct
81 Correct 433 ms 82112 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 29020 KB Output is correct
2 Correct 4 ms 31068 KB Output is correct
3 Correct 4 ms 29020 KB Output is correct
4 Correct 4 ms 31204 KB Output is correct
5 Correct 5 ms 31068 KB Output is correct
6 Correct 5 ms 31064 KB Output is correct
7 Correct 4 ms 31068 KB Output is correct
8 Correct 5 ms 31068 KB Output is correct
9 Correct 153 ms 56080 KB Output is correct
10 Correct 12 ms 33492 KB Output is correct
11 Correct 48 ms 45216 KB Output is correct
12 Correct 16 ms 34520 KB Output is correct
13 Correct 23 ms 36052 KB Output is correct
14 Correct 5 ms 31068 KB Output is correct
15 Correct 5 ms 31324 KB Output is correct
16 Correct 153 ms 55348 KB Output is correct
17 Correct 5 ms 31068 KB Output is correct
18 Correct 4 ms 31168 KB Output is correct
19 Correct 4 ms 31204 KB Output is correct
20 Correct 358 ms 90568 KB Output is correct
21 Correct 366 ms 82712 KB Output is correct
22 Correct 363 ms 83088 KB Output is correct
23 Correct 312 ms 73484 KB Output is correct
24 Correct 95 ms 36032 KB Output is correct
25 Correct 215 ms 56004 KB Output is correct
26 Correct 218 ms 56004 KB Output is correct
27 Correct 379 ms 80828 KB Output is correct
28 Correct 366 ms 80612 KB Output is correct
29 Correct 393 ms 80664 KB Output is correct
30 Correct 386 ms 80660 KB Output is correct
31 Correct 5 ms 31068 KB Output is correct
32 Correct 23 ms 34180 KB Output is correct
33 Correct 49 ms 31624 KB Output is correct
34 Correct 365 ms 91168 KB Output is correct
35 Correct 12 ms 32092 KB Output is correct
36 Correct 51 ms 36320 KB Output is correct
37 Correct 101 ms 41668 KB Output is correct
38 Correct 131 ms 48972 KB Output is correct
39 Correct 185 ms 55008 KB Output is correct
40 Correct 237 ms 64500 KB Output is correct
41 Correct 301 ms 70152 KB Output is correct
42 Correct 368 ms 76824 KB Output is correct
43 Correct 4 ms 31064 KB Output is correct
44 Correct 4 ms 31068 KB Output is correct
45 Correct 4 ms 31068 KB Output is correct
46 Correct 4 ms 29020 KB Output is correct
47 Correct 4 ms 29020 KB Output is correct
48 Correct 4 ms 31068 KB Output is correct
49 Correct 4 ms 31068 KB Output is correct
50 Correct 5 ms 31068 KB Output is correct
51 Correct 5 ms 31068 KB Output is correct
52 Correct 4 ms 29020 KB Output is correct
53 Correct 5 ms 31068 KB Output is correct
54 Correct 6 ms 31324 KB Output is correct
55 Correct 6 ms 31348 KB Output is correct
56 Correct 158 ms 54008 KB Output is correct
57 Correct 243 ms 65740 KB Output is correct
58 Correct 262 ms 67280 KB Output is correct
59 Correct 4 ms 29020 KB Output is correct
60 Correct 4 ms 31068 KB Output is correct
61 Correct 4 ms 29108 KB Output is correct
62 Correct 351 ms 82712 KB Output is correct
63 Correct 361 ms 82964 KB Output is correct
64 Correct 375 ms 83232 KB Output is correct
65 Correct 7 ms 31576 KB Output is correct
66 Correct 10 ms 31832 KB Output is correct
67 Correct 162 ms 53248 KB Output is correct
68 Correct 258 ms 66724 KB Output is correct
69 Correct 371 ms 78108 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 29020 KB Output is correct
2 Correct 4 ms 31068 KB Output is correct
3 Correct 4 ms 29020 KB Output is correct
4 Correct 4 ms 31204 KB Output is correct
5 Correct 5 ms 31068 KB Output is correct
6 Correct 5 ms 31064 KB Output is correct
7 Correct 4 ms 31068 KB Output is correct
8 Correct 5 ms 31068 KB Output is correct
9 Correct 153 ms 56080 KB Output is correct
10 Correct 12 ms 33492 KB Output is correct
11 Correct 48 ms 45216 KB Output is correct
12 Correct 16 ms 34520 KB Output is correct
13 Correct 23 ms 36052 KB Output is correct
14 Correct 5 ms 31068 KB Output is correct
15 Correct 5 ms 31324 KB Output is correct
16 Correct 153 ms 55348 KB Output is correct
17 Correct 360 ms 84244 KB Output is correct
18 Correct 369 ms 84512 KB Output is correct
19 Correct 384 ms 90652 KB Output is correct
20 Correct 450 ms 85468 KB Output is correct
21 Correct 370 ms 75480 KB Output is correct
22 Correct 4 ms 31064 KB Output is correct
23 Correct 52 ms 38216 KB Output is correct
24 Correct 22 ms 33560 KB Output is correct
25 Correct 75 ms 39364 KB Output is correct
26 Correct 137 ms 45412 KB Output is correct
27 Correct 198 ms 56428 KB Output is correct
28 Correct 256 ms 62600 KB Output is correct
29 Correct 306 ms 71432 KB Output is correct
30 Correct 363 ms 76508 KB Output is correct
31 Correct 440 ms 84548 KB Output is correct
32 Correct 457 ms 86048 KB Output is correct
33 Correct 362 ms 83992 KB Output is correct
34 Correct 8 ms 31576 KB Output is correct
35 Correct 12 ms 32088 KB Output is correct
36 Correct 174 ms 55248 KB Output is correct
37 Correct 284 ms 69280 KB Output is correct
38 Correct 408 ms 82100 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 29020 KB Output is correct
2 Correct 4 ms 31068 KB Output is correct
3 Correct 4 ms 29020 KB Output is correct
4 Correct 4 ms 31204 KB Output is correct
5 Correct 5 ms 31068 KB Output is correct
6 Correct 5 ms 31064 KB Output is correct
7 Correct 4 ms 31068 KB Output is correct
8 Correct 5 ms 31068 KB Output is correct
9 Correct 153 ms 56080 KB Output is correct
10 Correct 12 ms 33492 KB Output is correct
11 Correct 48 ms 45216 KB Output is correct
12 Correct 16 ms 34520 KB Output is correct
13 Correct 23 ms 36052 KB Output is correct
14 Correct 5 ms 31068 KB Output is correct
15 Correct 5 ms 31324 KB Output is correct
16 Correct 153 ms 55348 KB Output is correct
17 Correct 5 ms 31064 KB Output is correct
18 Correct 4 ms 31068 KB Output is correct
19 Correct 4 ms 31068 KB Output is correct
20 Correct 4 ms 31000 KB Output is correct
21 Correct 5 ms 31068 KB Output is correct
22 Correct 4 ms 31068 KB Output is correct
23 Correct 376 ms 80416 KB Output is correct
24 Correct 6 ms 31064 KB Output is correct
25 Correct 6 ms 31324 KB Output is correct
26 Correct 8 ms 31324 KB Output is correct
27 Correct 8 ms 31580 KB Output is correct
28 Correct 123 ms 50172 KB Output is correct
29 Correct 206 ms 58088 KB Output is correct
30 Correct 285 ms 69040 KB Output is correct
31 Correct 372 ms 79908 KB Output is correct
32 Correct 5 ms 31064 KB Output is correct
33 Correct 5 ms 31068 KB Output is correct
34 Correct 4 ms 31068 KB Output is correct
35 Correct 5 ms 29160 KB Output is correct
36 Correct 4 ms 28956 KB Output is correct
37 Correct 5 ms 31068 KB Output is correct
38 Correct 4 ms 31068 KB Output is correct
39 Correct 5 ms 31068 KB Output is correct
40 Correct 4 ms 31088 KB Output is correct
41 Correct 5 ms 29020 KB Output is correct
42 Correct 6 ms 31068 KB Output is correct
43 Correct 6 ms 31324 KB Output is correct
44 Correct 8 ms 31324 KB Output is correct
45 Correct 159 ms 54004 KB Output is correct
46 Correct 244 ms 67020 KB Output is correct
47 Correct 260 ms 66768 KB Output is correct
48 Correct 4 ms 31068 KB Output is correct
49 Correct 5 ms 31068 KB Output is correct
50 Correct 4 ms 31184 KB Output is correct
51 Correct 4 ms 31068 KB Output is correct
52 Correct 4 ms 31068 KB Output is correct
53 Correct 5 ms 31068 KB Output is correct
54 Correct 5 ms 31068 KB Output is correct
55 Correct 363 ms 77860 KB Output is correct
56 Correct 4 ms 31068 KB Output is correct
57 Correct 7 ms 31324 KB Output is correct
58 Correct 11 ms 32372 KB Output is correct
59 Correct 11 ms 32092 KB Output is correct
60 Correct 178 ms 52788 KB Output is correct
61 Correct 233 ms 62396 KB Output is correct
62 Correct 288 ms 68868 KB Output is correct
63 Correct 384 ms 77852 KB Output is correct
64 Correct 4 ms 29020 KB Output is correct
65 Correct 4 ms 31068 KB Output is correct
66 Correct 4 ms 29020 KB Output is correct
67 Correct 355 ms 82824 KB Output is correct
68 Correct 358 ms 82976 KB Output is correct
69 Correct 344 ms 83136 KB Output is correct
70 Correct 7 ms 31580 KB Output is correct
71 Correct 13 ms 31932 KB Output is correct
72 Correct 174 ms 53300 KB Output is correct
73 Correct 284 ms 66056 KB Output is correct
74 Correct 392 ms 78104 KB Output is correct
75 Correct 432 ms 86192 KB Output is correct
76 Correct 360 ms 83736 KB Output is correct
77 Correct 10 ms 31580 KB Output is correct
78 Correct 13 ms 32092 KB Output is correct
79 Correct 172 ms 55204 KB Output is correct
80 Correct 310 ms 68876 KB Output is correct
81 Correct 433 ms 82112 KB Output is correct
82 Correct 5 ms 31068 KB Output is correct
83 Correct 4 ms 31168 KB Output is correct
84 Correct 4 ms 31204 KB Output is correct
85 Correct 358 ms 90568 KB Output is correct
86 Correct 366 ms 82712 KB Output is correct
87 Correct 363 ms 83088 KB Output is correct
88 Correct 312 ms 73484 KB Output is correct
89 Correct 95 ms 36032 KB Output is correct
90 Correct 215 ms 56004 KB Output is correct
91 Correct 218 ms 56004 KB Output is correct
92 Correct 379 ms 80828 KB Output is correct
93 Correct 366 ms 80612 KB Output is correct
94 Correct 393 ms 80664 KB Output is correct
95 Correct 386 ms 80660 KB Output is correct
96 Correct 5 ms 31068 KB Output is correct
97 Correct 23 ms 34180 KB Output is correct
98 Correct 49 ms 31624 KB Output is correct
99 Correct 365 ms 91168 KB Output is correct
100 Correct 12 ms 32092 KB Output is correct
101 Correct 51 ms 36320 KB Output is correct
102 Correct 101 ms 41668 KB Output is correct
103 Correct 131 ms 48972 KB Output is correct
104 Correct 185 ms 55008 KB Output is correct
105 Correct 237 ms 64500 KB Output is correct
106 Correct 301 ms 70152 KB Output is correct
107 Correct 368 ms 76824 KB Output is correct
108 Correct 4 ms 31064 KB Output is correct
109 Correct 4 ms 31068 KB Output is correct
110 Correct 4 ms 31068 KB Output is correct
111 Correct 4 ms 29020 KB Output is correct
112 Correct 4 ms 29020 KB Output is correct
113 Correct 4 ms 31068 KB Output is correct
114 Correct 4 ms 31068 KB Output is correct
115 Correct 5 ms 31068 KB Output is correct
116 Correct 5 ms 31068 KB Output is correct
117 Correct 4 ms 29020 KB Output is correct
118 Correct 5 ms 31068 KB Output is correct
119 Correct 6 ms 31324 KB Output is correct
120 Correct 6 ms 31348 KB Output is correct
121 Correct 158 ms 54008 KB Output is correct
122 Correct 243 ms 65740 KB Output is correct
123 Correct 262 ms 67280 KB Output is correct
124 Correct 4 ms 29020 KB Output is correct
125 Correct 4 ms 31068 KB Output is correct
126 Correct 4 ms 29108 KB Output is correct
127 Correct 351 ms 82712 KB Output is correct
128 Correct 361 ms 82964 KB Output is correct
129 Correct 375 ms 83232 KB Output is correct
130 Correct 7 ms 31576 KB Output is correct
131 Correct 10 ms 31832 KB Output is correct
132 Correct 162 ms 53248 KB Output is correct
133 Correct 258 ms 66724 KB Output is correct
134 Correct 371 ms 78108 KB Output is correct
135 Correct 360 ms 84244 KB Output is correct
136 Correct 369 ms 84512 KB Output is correct
137 Correct 384 ms 90652 KB Output is correct
138 Correct 450 ms 85468 KB Output is correct
139 Correct 370 ms 75480 KB Output is correct
140 Correct 4 ms 31064 KB Output is correct
141 Correct 52 ms 38216 KB Output is correct
142 Correct 22 ms 33560 KB Output is correct
143 Correct 75 ms 39364 KB Output is correct
144 Correct 137 ms 45412 KB Output is correct
145 Correct 198 ms 56428 KB Output is correct
146 Correct 256 ms 62600 KB Output is correct
147 Correct 306 ms 71432 KB Output is correct
148 Correct 363 ms 76508 KB Output is correct
149 Correct 440 ms 84548 KB Output is correct
150 Correct 457 ms 86048 KB Output is correct
151 Correct 362 ms 83992 KB Output is correct
152 Correct 8 ms 31576 KB Output is correct
153 Correct 12 ms 32088 KB Output is correct
154 Correct 174 ms 55248 KB Output is correct
155 Correct 284 ms 69280 KB Output is correct
156 Correct 408 ms 82100 KB Output is correct
157 Correct 4 ms 31068 KB Output is correct
158 Correct 5 ms 29020 KB Output is correct
159 Correct 5 ms 31068 KB Output is correct
160 Correct 4 ms 31068 KB Output is correct
161 Correct 393 ms 74776 KB Output is correct
162 Correct 368 ms 90632 KB Output is correct
163 Correct 405 ms 87836 KB Output is correct
164 Correct 396 ms 87828 KB Output is correct
165 Correct 371 ms 79044 KB Output is correct
166 Correct 382 ms 76576 KB Output is correct
167 Incorrect 77 ms 42456 KB Tree @(185555, 21279) appears more than once: for edges on positions 33 and 1615
168 Halted 0 ms 0 KB -