답안 #1053297

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1053297 2024-08-11T10:21:11 Z dozer 분수 공원 (IOI21_parks) C++17
70 / 100
992 ms 143120 KB
#include "parks.h"
#include <bits/stdc++.h>
using namespace std;
#define sp " "
#define endl "\n"
#define fileio() freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout)
#define pb push_back
#define pii pair<int, int>
#define fastio() cin.tie(0), ios_base::sync_with_stdio(0)
#define st first
#define nd second
#define ll long long
#define LL node * 2
#define RR node * 2 + 1
#define N 300005


const int modulo = 1e9 + 7;
const ll INF = 2e18 + 7;


int par[N], sz[N], TOT;
pii rev[N];

int find(int node){
	if (par[node] == node) return node;
	return par[node] = find(par[node]);
}


void uni(int a, int b){
	a = find(a), b = find(b);
	if (a == b) return;
	TOT--;
	if (sz[a] < sz[b]) swap(a, b);
	par[b] = a;
	sz[a] += b;
}


int construct_roads(vector<int> x, vector<int> y) {
    if (x.size() == 1) {
		build({}, {}, {}, {});
	    return 1;
    }
    map<pii ,int> ind;
    int n = x.size();
    vector<array<int, 3>> srt;
    for (int i = 0; i < n; i++) srt.pb({x[i], y[i], i});
    sort(srt.begin(), srt.end());
	for (int i = 0; i < n; i++) x[i] = srt[i][0], y[i] = srt[i][1];
    for (int i = 0; i < n; i++){
    	ind[{x[i], y[i]}] = i;
    	sz[i] = 1, par[i] = i;
    }

    vector<pii> dir = {{0, -2}, {-2, 0}, {0, 2}, {2, 0}};

    vector<pii> edges, b1, b2;
    map<pii, int> cnt;
    map<pii, set<int>> rev2;

    int cntr = 0;
    for (auto k : dir){
	    for (int i = 0; i < n; i++){
	    	int a = x[i], b = y[i];
    		int c = a + k.st, d = b + k.nd;
    		if (ind.count({c, d}) && ind[{c, d}] > i){
    			int g = (a + c) / 2, h = (b + d) / 2;
    			pii f1, f2;
    			if (b == d){
    				f1 = {g, h + 1};
    				f2 = {g, h - 1};
    			}
    			else{
    				f1 = {g + 1, h};
    				f2 = {g - 1, h};
    			}
    			edges.pb({i, ind[{c, d}]});
    			b1.pb(f1);
    			b2.pb(f2);
    			rev2[f1].insert(cntr);
    			rev2[f2].insert(cntr);
    			cnt[f1]++;
    			cnt[f2]++;
    			cntr++;
    		}
    	}
    }

    queue<int> q;
    for (int i = 0; i < cntr; i++){
    	if (cnt[b1[i]] == 1 || cnt[b2[i]] == 1) q.push(i);
    }

 	vector<int> u, v, a, b;
    
    set<int> undone;

    for (int i = 0; i < cntr; i++) undone.insert(i);
    TOT = n;
	while(TOT > 1){
		 while(!q.empty()){
	    	int top = q.front();
	    	q.pop();
	    	
	    	if (undone.count(top) == 0) continue;
	    	
	    	pii todo = {-1, -1};
	    	if (cnt[b1[top]] == 1) todo = b1[top];
	    	else if (cnt[b2[top]] == 1) todo = b2[top];
	    	if (todo.st == -1) continue;

	    	a.pb(todo.st), b.pb(todo.nd);
	    	vector<pii> V = {b1[top], b2[top]};
	    	for (auto i : V){
	    		cnt[i]--;
	    		rev2[i].erase(top);
	    		if (rev2[i].size()){
	    			q.push(*rev2[i].begin());
	    		}
	    	}

	    	u.pb(srt[edges[top].st][2]);
	    	v.pb(srt[edges[top].nd][2]);
	    	uni(edges[top].st, edges[top].nd);
	    	undone.erase(top);
	    }	

	    if (TOT == 1) break;

	    auto it = undone.begin();
	    while(it != undone.end()){
	    	int i = *it;
	    	if (find(edges[i].st) == find(edges[i].nd)) it = undone.erase(it); 
	    	else if (cnt[b1[i]] == 0 && cnt[b2[i]] == 0) it = undone.erase(it);
	    	else break;
	    }

	    if (undone.empty()) break;
		int tmp = *undone.begin();
		cnt[b1[tmp]] = 1;
		q.push(tmp);
	}

	
	if (TOT == 1){
		build(u, v, a, b);
		return 1;
	}
   
   return 0;
}
/*

static void check(bool cond, string message) {
	if (!cond) {
		printf("%s\n", message.c_str());
		fclose(stdout);
		exit(0);
	}
}

static int n;
static bool build_called;
static int m;
static vector<int> _u, _v, _a, _b;

void build(vector<int> u, vector<int> v, vector<int> a, vector<int> b) {
	check(!build_called, "build is called more than once");
	build_called = true;
	m = u.size();
	check(int(v.size()) == m, "u.size() != v.size()");
	check(int(a.size()) == m, "u.size() != a.size()");
	check(int(b.size()) == m, "u.size() != b.size()");
	_u = u;
	_v = v;
	_a = a;
	_b = b;
}

int main() {
	fileio();
	assert(scanf("%d", &n) == 1);
	vector<int> x(n), y(n);
	for (int i = 0; i < n; i++) {
		assert(scanf("%d%d", &x[i], &y[i]) == 2);
	}
	fclose(stdin);

	build_called = false;
	const int possible = construct_roads(x, y);

	check(possible == 0 || possible == 1, "Invalid return value of construct_roads()");
	if (possible == 1) {
		check(build_called, "construct_roads() returned 1 without calling build()");
	} else {
		check(!build_called, "construct_roads() called build() but returned 0");
	}

	printf("%d\n", possible);
	if (possible == 1) {
		printf("%d\n", m);
		for (int j = 0; j < m; j++) {
			printf("%d %d %d %d\n", _u[j], _v[j], _a[j], _b[j]);
		}
	}
	fclose(stdout);
	return 0;
}
*/
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 2392 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 0 ms 2488 KB Output is correct
7 Correct 0 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 287 ms 65092 KB Output is correct
10 Correct 19 ms 8288 KB Output is correct
11 Correct 135 ms 34944 KB Output is correct
12 Correct 30 ms 11112 KB Output is correct
13 Correct 121 ms 28440 KB Output is correct
14 Correct 3 ms 2908 KB Output is correct
15 Correct 4 ms 3420 KB Output is correct
16 Correct 288 ms 65128 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 2392 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 0 ms 2488 KB Output is correct
7 Correct 0 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 287 ms 65092 KB Output is correct
10 Correct 19 ms 8288 KB Output is correct
11 Correct 135 ms 34944 KB Output is correct
12 Correct 30 ms 11112 KB Output is correct
13 Correct 121 ms 28440 KB Output is correct
14 Correct 3 ms 2908 KB Output is correct
15 Correct 4 ms 3420 KB Output is correct
16 Correct 288 ms 65128 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 0 ms 2396 KB Output is correct
20 Correct 0 ms 2396 KB Output is correct
21 Correct 1 ms 2392 KB Output is correct
22 Correct 0 ms 2396 KB Output is correct
23 Correct 860 ms 142840 KB Output is correct
24 Correct 0 ms 2396 KB Output is correct
25 Correct 3 ms 3164 KB Output is correct
26 Correct 6 ms 4188 KB Output is correct
27 Correct 12 ms 4824 KB Output is correct
28 Correct 289 ms 50740 KB Output is correct
29 Correct 482 ms 79296 KB Output is correct
30 Correct 664 ms 108056 KB Output is correct
31 Correct 844 ms 143120 KB Output is correct
32 Correct 1 ms 2396 KB Output is correct
33 Correct 0 ms 2396 KB Output is correct
34 Correct 0 ms 2396 KB Output is correct
35 Correct 0 ms 2396 KB Output is correct
36 Correct 0 ms 2396 KB Output is correct
37 Correct 0 ms 2396 KB Output is correct
38 Correct 0 ms 2396 KB Output is correct
39 Correct 0 ms 2396 KB Output is correct
40 Correct 1 ms 2396 KB Output is correct
41 Correct 0 ms 2396 KB Output is correct
42 Correct 0 ms 2396 KB Output is correct
43 Correct 3 ms 3416 KB Output is correct
44 Correct 5 ms 3932 KB Output is correct
45 Correct 281 ms 53256 KB Output is correct
46 Correct 460 ms 81308 KB Output is correct
47 Correct 437 ms 81272 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 2392 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 0 ms 2488 KB Output is correct
7 Correct 0 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 287 ms 65092 KB Output is correct
10 Correct 19 ms 8288 KB Output is correct
11 Correct 135 ms 34944 KB Output is correct
12 Correct 30 ms 11112 KB Output is correct
13 Correct 121 ms 28440 KB Output is correct
14 Correct 3 ms 2908 KB Output is correct
15 Correct 4 ms 3420 KB Output is correct
16 Correct 288 ms 65128 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 0 ms 2396 KB Output is correct
20 Correct 0 ms 2396 KB Output is correct
21 Correct 1 ms 2392 KB Output is correct
22 Correct 0 ms 2396 KB Output is correct
23 Correct 860 ms 142840 KB Output is correct
24 Correct 0 ms 2396 KB Output is correct
25 Correct 3 ms 3164 KB Output is correct
26 Correct 6 ms 4188 KB Output is correct
27 Correct 12 ms 4824 KB Output is correct
28 Correct 289 ms 50740 KB Output is correct
29 Correct 482 ms 79296 KB Output is correct
30 Correct 664 ms 108056 KB Output is correct
31 Correct 844 ms 143120 KB Output is correct
32 Correct 1 ms 2396 KB Output is correct
33 Correct 0 ms 2396 KB Output is correct
34 Correct 0 ms 2396 KB Output is correct
35 Correct 0 ms 2396 KB Output is correct
36 Correct 0 ms 2396 KB Output is correct
37 Correct 0 ms 2396 KB Output is correct
38 Correct 0 ms 2396 KB Output is correct
39 Correct 0 ms 2396 KB Output is correct
40 Correct 1 ms 2396 KB Output is correct
41 Correct 0 ms 2396 KB Output is correct
42 Correct 0 ms 2396 KB Output is correct
43 Correct 3 ms 3416 KB Output is correct
44 Correct 5 ms 3932 KB Output is correct
45 Correct 281 ms 53256 KB Output is correct
46 Correct 460 ms 81308 KB Output is correct
47 Correct 437 ms 81272 KB Output is correct
48 Correct 0 ms 2396 KB Output is correct
49 Correct 0 ms 2396 KB Output is correct
50 Correct 0 ms 2396 KB Output is correct
51 Correct 0 ms 2396 KB Output is correct
52 Correct 0 ms 2396 KB Output is correct
53 Correct 0 ms 2492 KB Output is correct
54 Correct 0 ms 2396 KB Output is correct
55 Correct 901 ms 138016 KB Output is correct
56 Correct 1 ms 2396 KB Output is correct
57 Correct 6 ms 3332 KB Output is correct
58 Correct 16 ms 5944 KB Output is correct
59 Correct 33 ms 8212 KB Output is correct
60 Correct 422 ms 63936 KB Output is correct
61 Correct 582 ms 87364 KB Output is correct
62 Correct 748 ms 112312 KB Output is correct
63 Correct 918 ms 136140 KB Output is correct
64 Correct 0 ms 2392 KB Output is correct
65 Correct 0 ms 2396 KB Output is correct
66 Correct 1 ms 2392 KB Output is correct
67 Correct 607 ms 129824 KB Output is correct
68 Correct 630 ms 130128 KB Output is correct
69 Correct 618 ms 129608 KB Output is correct
70 Correct 7 ms 4188 KB Output is correct
71 Correct 14 ms 6132 KB Output is correct
72 Correct 291 ms 51684 KB Output is correct
73 Correct 503 ms 80732 KB Output is correct
74 Correct 695 ms 107204 KB Output is correct
75 Correct 718 ms 125124 KB Output is correct
76 Correct 605 ms 129616 KB Output is correct
77 Correct 9 ms 4956 KB Output is correct
78 Correct 23 ms 7200 KB Output is correct
79 Correct 317 ms 55228 KB Output is correct
80 Correct 543 ms 86492 KB Output is correct
81 Correct 717 ms 115140 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 2392 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 0 ms 2488 KB Output is correct
7 Correct 0 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 287 ms 65092 KB Output is correct
10 Correct 19 ms 8288 KB Output is correct
11 Correct 135 ms 34944 KB Output is correct
12 Correct 30 ms 11112 KB Output is correct
13 Correct 121 ms 28440 KB Output is correct
14 Correct 3 ms 2908 KB Output is correct
15 Correct 4 ms 3420 KB Output is correct
16 Correct 288 ms 65128 KB Output is correct
17 Correct 1 ms 2392 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 0 ms 2464 KB Output is correct
20 Correct 578 ms 95712 KB Output is correct
21 Correct 551 ms 95944 KB Output is correct
22 Correct 557 ms 95676 KB Output is correct
23 Correct 457 ms 111212 KB Output is correct
24 Correct 112 ms 20928 KB Output is correct
25 Correct 533 ms 123072 KB Output is correct
26 Correct 451 ms 123076 KB Output is correct
27 Correct 480 ms 129984 KB Output is correct
28 Correct 490 ms 130040 KB Output is correct
29 Correct 565 ms 129476 KB Output is correct
30 Correct 591 ms 129484 KB Output is correct
31 Correct 1 ms 2392 KB Output is correct
32 Correct 33 ms 9244 KB Output is correct
33 Correct 59 ms 11464 KB Output is correct
34 Correct 578 ms 96120 KB Output is correct
35 Correct 21 ms 7304 KB Output is correct
36 Correct 114 ms 26060 KB Output is correct
37 Correct 293 ms 49908 KB Output is correct
38 Correct 246 ms 41160 KB Output is correct
39 Correct 351 ms 56008 KB Output is correct
40 Correct 483 ms 74176 KB Output is correct
41 Correct 666 ms 89028 KB Output is correct
42 Correct 753 ms 103108 KB Output is correct
43 Correct 0 ms 2396 KB Output is correct
44 Correct 0 ms 2396 KB Output is correct
45 Correct 0 ms 2392 KB Output is correct
46 Correct 0 ms 2396 KB Output is correct
47 Correct 0 ms 2396 KB Output is correct
48 Correct 0 ms 2396 KB Output is correct
49 Correct 0 ms 2396 KB Output is correct
50 Correct 0 ms 2396 KB Output is correct
51 Correct 0 ms 2396 KB Output is correct
52 Correct 0 ms 2396 KB Output is correct
53 Correct 1 ms 2396 KB Output is correct
54 Correct 3 ms 3420 KB Output is correct
55 Correct 5 ms 3676 KB Output is correct
56 Correct 279 ms 53316 KB Output is correct
57 Correct 413 ms 81348 KB Output is correct
58 Correct 443 ms 80064 KB Output is correct
59 Correct 0 ms 2396 KB Output is correct
60 Correct 1 ms 2396 KB Output is correct
61 Correct 0 ms 2396 KB Output is correct
62 Correct 599 ms 129476 KB Output is correct
63 Correct 611 ms 130244 KB Output is correct
64 Correct 624 ms 129736 KB Output is correct
65 Correct 7 ms 4188 KB Output is correct
66 Correct 16 ms 6236 KB Output is correct
67 Correct 326 ms 51692 KB Output is correct
68 Correct 463 ms 80580 KB Output is correct
69 Correct 684 ms 106956 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 2392 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 0 ms 2488 KB Output is correct
7 Correct 0 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 287 ms 65092 KB Output is correct
10 Correct 19 ms 8288 KB Output is correct
11 Correct 135 ms 34944 KB Output is correct
12 Correct 30 ms 11112 KB Output is correct
13 Correct 121 ms 28440 KB Output is correct
14 Correct 3 ms 2908 KB Output is correct
15 Correct 4 ms 3420 KB Output is correct
16 Correct 288 ms 65128 KB Output is correct
17 Correct 569 ms 129984 KB Output is correct
18 Correct 569 ms 128200 KB Output is correct
19 Correct 536 ms 97220 KB Output is correct
20 Correct 603 ms 117828 KB Output is correct
21 Correct 499 ms 113864 KB Output is correct
22 Correct 0 ms 2392 KB Output is correct
23 Correct 81 ms 18244 KB Output is correct
24 Correct 51 ms 12956 KB Output is correct
25 Correct 232 ms 39928 KB Output is correct
26 Correct 438 ms 67008 KB Output is correct
27 Correct 404 ms 58024 KB Output is correct
28 Correct 535 ms 73280 KB Output is correct
29 Correct 668 ms 89032 KB Output is correct
30 Correct 795 ms 101572 KB Output is correct
31 Correct 963 ms 115580 KB Output is correct
32 Correct 683 ms 125124 KB Output is correct
33 Correct 591 ms 129476 KB Output is correct
34 Correct 11 ms 4956 KB Output is correct
35 Correct 18 ms 7196 KB Output is correct
36 Correct 294 ms 55256 KB Output is correct
37 Correct 496 ms 86468 KB Output is correct
38 Correct 701 ms 114740 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 2392 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 0 ms 2488 KB Output is correct
7 Correct 0 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 287 ms 65092 KB Output is correct
10 Correct 19 ms 8288 KB Output is correct
11 Correct 135 ms 34944 KB Output is correct
12 Correct 30 ms 11112 KB Output is correct
13 Correct 121 ms 28440 KB Output is correct
14 Correct 3 ms 2908 KB Output is correct
15 Correct 4 ms 3420 KB Output is correct
16 Correct 288 ms 65128 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 0 ms 2396 KB Output is correct
20 Correct 0 ms 2396 KB Output is correct
21 Correct 1 ms 2392 KB Output is correct
22 Correct 0 ms 2396 KB Output is correct
23 Correct 860 ms 142840 KB Output is correct
24 Correct 0 ms 2396 KB Output is correct
25 Correct 3 ms 3164 KB Output is correct
26 Correct 6 ms 4188 KB Output is correct
27 Correct 12 ms 4824 KB Output is correct
28 Correct 289 ms 50740 KB Output is correct
29 Correct 482 ms 79296 KB Output is correct
30 Correct 664 ms 108056 KB Output is correct
31 Correct 844 ms 143120 KB Output is correct
32 Correct 1 ms 2396 KB Output is correct
33 Correct 0 ms 2396 KB Output is correct
34 Correct 0 ms 2396 KB Output is correct
35 Correct 0 ms 2396 KB Output is correct
36 Correct 0 ms 2396 KB Output is correct
37 Correct 0 ms 2396 KB Output is correct
38 Correct 0 ms 2396 KB Output is correct
39 Correct 0 ms 2396 KB Output is correct
40 Correct 1 ms 2396 KB Output is correct
41 Correct 0 ms 2396 KB Output is correct
42 Correct 0 ms 2396 KB Output is correct
43 Correct 3 ms 3416 KB Output is correct
44 Correct 5 ms 3932 KB Output is correct
45 Correct 281 ms 53256 KB Output is correct
46 Correct 460 ms 81308 KB Output is correct
47 Correct 437 ms 81272 KB Output is correct
48 Correct 0 ms 2396 KB Output is correct
49 Correct 0 ms 2396 KB Output is correct
50 Correct 0 ms 2396 KB Output is correct
51 Correct 0 ms 2396 KB Output is correct
52 Correct 0 ms 2396 KB Output is correct
53 Correct 0 ms 2492 KB Output is correct
54 Correct 0 ms 2396 KB Output is correct
55 Correct 901 ms 138016 KB Output is correct
56 Correct 1 ms 2396 KB Output is correct
57 Correct 6 ms 3332 KB Output is correct
58 Correct 16 ms 5944 KB Output is correct
59 Correct 33 ms 8212 KB Output is correct
60 Correct 422 ms 63936 KB Output is correct
61 Correct 582 ms 87364 KB Output is correct
62 Correct 748 ms 112312 KB Output is correct
63 Correct 918 ms 136140 KB Output is correct
64 Correct 0 ms 2392 KB Output is correct
65 Correct 0 ms 2396 KB Output is correct
66 Correct 1 ms 2392 KB Output is correct
67 Correct 607 ms 129824 KB Output is correct
68 Correct 630 ms 130128 KB Output is correct
69 Correct 618 ms 129608 KB Output is correct
70 Correct 7 ms 4188 KB Output is correct
71 Correct 14 ms 6132 KB Output is correct
72 Correct 291 ms 51684 KB Output is correct
73 Correct 503 ms 80732 KB Output is correct
74 Correct 695 ms 107204 KB Output is correct
75 Correct 718 ms 125124 KB Output is correct
76 Correct 605 ms 129616 KB Output is correct
77 Correct 9 ms 4956 KB Output is correct
78 Correct 23 ms 7200 KB Output is correct
79 Correct 317 ms 55228 KB Output is correct
80 Correct 543 ms 86492 KB Output is correct
81 Correct 717 ms 115140 KB Output is correct
82 Correct 1 ms 2392 KB Output is correct
83 Correct 1 ms 2396 KB Output is correct
84 Correct 0 ms 2464 KB Output is correct
85 Correct 578 ms 95712 KB Output is correct
86 Correct 551 ms 95944 KB Output is correct
87 Correct 557 ms 95676 KB Output is correct
88 Correct 457 ms 111212 KB Output is correct
89 Correct 112 ms 20928 KB Output is correct
90 Correct 533 ms 123072 KB Output is correct
91 Correct 451 ms 123076 KB Output is correct
92 Correct 480 ms 129984 KB Output is correct
93 Correct 490 ms 130040 KB Output is correct
94 Correct 565 ms 129476 KB Output is correct
95 Correct 591 ms 129484 KB Output is correct
96 Correct 1 ms 2392 KB Output is correct
97 Correct 33 ms 9244 KB Output is correct
98 Correct 59 ms 11464 KB Output is correct
99 Correct 578 ms 96120 KB Output is correct
100 Correct 21 ms 7304 KB Output is correct
101 Correct 114 ms 26060 KB Output is correct
102 Correct 293 ms 49908 KB Output is correct
103 Correct 246 ms 41160 KB Output is correct
104 Correct 351 ms 56008 KB Output is correct
105 Correct 483 ms 74176 KB Output is correct
106 Correct 666 ms 89028 KB Output is correct
107 Correct 753 ms 103108 KB Output is correct
108 Correct 0 ms 2396 KB Output is correct
109 Correct 0 ms 2396 KB Output is correct
110 Correct 0 ms 2392 KB Output is correct
111 Correct 0 ms 2396 KB Output is correct
112 Correct 0 ms 2396 KB Output is correct
113 Correct 0 ms 2396 KB Output is correct
114 Correct 0 ms 2396 KB Output is correct
115 Correct 0 ms 2396 KB Output is correct
116 Correct 0 ms 2396 KB Output is correct
117 Correct 0 ms 2396 KB Output is correct
118 Correct 1 ms 2396 KB Output is correct
119 Correct 3 ms 3420 KB Output is correct
120 Correct 5 ms 3676 KB Output is correct
121 Correct 279 ms 53316 KB Output is correct
122 Correct 413 ms 81348 KB Output is correct
123 Correct 443 ms 80064 KB Output is correct
124 Correct 0 ms 2396 KB Output is correct
125 Correct 1 ms 2396 KB Output is correct
126 Correct 0 ms 2396 KB Output is correct
127 Correct 599 ms 129476 KB Output is correct
128 Correct 611 ms 130244 KB Output is correct
129 Correct 624 ms 129736 KB Output is correct
130 Correct 7 ms 4188 KB Output is correct
131 Correct 16 ms 6236 KB Output is correct
132 Correct 326 ms 51692 KB Output is correct
133 Correct 463 ms 80580 KB Output is correct
134 Correct 684 ms 106956 KB Output is correct
135 Correct 569 ms 129984 KB Output is correct
136 Correct 569 ms 128200 KB Output is correct
137 Correct 536 ms 97220 KB Output is correct
138 Correct 603 ms 117828 KB Output is correct
139 Correct 499 ms 113864 KB Output is correct
140 Correct 0 ms 2392 KB Output is correct
141 Correct 81 ms 18244 KB Output is correct
142 Correct 51 ms 12956 KB Output is correct
143 Correct 232 ms 39928 KB Output is correct
144 Correct 438 ms 67008 KB Output is correct
145 Correct 404 ms 58024 KB Output is correct
146 Correct 535 ms 73280 KB Output is correct
147 Correct 668 ms 89032 KB Output is correct
148 Correct 795 ms 101572 KB Output is correct
149 Correct 963 ms 115580 KB Output is correct
150 Correct 683 ms 125124 KB Output is correct
151 Correct 591 ms 129476 KB Output is correct
152 Correct 11 ms 4956 KB Output is correct
153 Correct 18 ms 7196 KB Output is correct
154 Correct 294 ms 55256 KB Output is correct
155 Correct 496 ms 86468 KB Output is correct
156 Correct 701 ms 114740 KB Output is correct
157 Correct 0 ms 2396 KB Output is correct
158 Correct 0 ms 2492 KB Output is correct
159 Correct 0 ms 2396 KB Output is correct
160 Correct 1 ms 2396 KB Output is correct
161 Correct 992 ms 130524 KB Output is correct
162 Correct 570 ms 98756 KB Output is correct
163 Correct 670 ms 112828 KB Output is correct
164 Correct 669 ms 111660 KB Output is correct
165 Incorrect 735 ms 125880 KB Tree @(44441, 44443) appears more than once: for edges on positions 199986 and 200006
166 Halted 0 ms 0 KB -