Submission #438128

# Submission time Handle Problem Language Result Execution time Memory
438128 2021-06-27T16:01:45 Z gs14004 Fountain Parks (IOI21_parks) C++17
70 / 100
727 ms 80620 KB
#include "parks.h"
#include <bits/stdc++.h>
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
using namespace std;
using lint = long long;
using pi = pair<lint, lint>;
const int MAXN = 400005;
const int mod = 1e9 + 7;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

struct point{
	int x, y, idx;
};

struct disj{
	int pa[MAXN];
	void init(int n){
		iota(pa, pa + n, 0);
	}
	int find(int x){
		return pa[x] = (pa[x] == x ? x : find(pa[x]));
	}
	bool uni(int p, int q){
		p = find(p);
		q = find(q);
		if(p == q) return 0;
		pa[q] = p; return 1;
	}
}disj;

bool vis[MAXN];
int V = 0, E = 0;
vector<int> dfn;
vector<pi> gph[MAXN];

void dfs(int x){
	if(vis[x]) return;
	vis[x] = 1;
	dfn.push_back(x);
	V += 1;
	E += sz(gph[x]);
	for(auto &[_, y] : gph[x]) dfs(y);
}

int construct_roads(std::vector<int> x, std::vector<int> y) {
	int n = sz(x);
	vector<point> p;
	vector<pi> edges;
	vector<pi> matches;
	vector<pi> to_mst;
	auto get_mode = [&](pi q){
		int x = q.first, y = q.second;
		int val = (p[y].x + p[y].y) % 4;
		if(val % 4 == 0) return p[x].x == p[y].x ? 0 : 2;
		return p[x].x == p[y].x ? 1 : 3;
	};
	for(int i = 0; i < n; i++){
		p.push_back({x[i], y[i], i});
	}
	sort(all(p), [&](const point &a, const point &b){
		return pi(a.x, a.y) < pi(b.x, b.y);
	});
	disj.init(n);
	for(int i = 1; i < sz(p); i++){
		if(p[i-1].x == p[i].x && p[i-1].y + 2 == p[i].y){
			to_mst.emplace_back(p[i-1].idx, p[i].idx);
		}
	}
	sort(all(p), [&](const point &a, const point &b){
		return pi(a.y, a.x) < pi(b.y, b.x);
	});
	for(int i = 1; i < sz(p); i++){
		if(p[i-1].y == p[i].y && p[i-1].x + 2 == p[i].x){
			to_mst.emplace_back(p[i-1].idx, p[i].idx);
		}
	}
	sort(all(p), [&](const point &a, const point &b){
		return a.idx < b.idx;
	});
	sort(all(to_mst), [&](const pi &x, const pi &y){
		return get_mode(x) < get_mode(y);
	});
	for(auto &[x, y] : to_mst){
		if(disj.uni(x, y)) edges.emplace_back(x, y);
	}
	if(sz(edges) != n - 1) return 0;
	map<pi, int> mp;
	vector<int> U, _V, A(n-1), B(n-1);
	for(auto &[x, y] : edges){
		U.push_back(x);
		_V.push_back(y);
		set<pi> s;
		int mx = (p[x].x + p[y].x) / 2;
		int my = (p[x].y + p[y].y) / 2;
		for(int i = 0; i < 4; i++){
			s.emplace(mx + dx[i], my + dy[i]);
		}
		s.erase(pi(p[x].x, p[x].y));
		s.erase(pi(p[y].x, p[y].y));
		for(auto &p : s){
			if(mp.find(p) == mp.end()){
				int idx = sz(mp);
				mp[p] = idx;
			}
		}
		matches.emplace_back(mp[*s.begin()], mp[*s.rbegin()]);
	}
	vector<int> deg(sz(mp));
	for(int i = 0; i < sz(matches); i++){
		int x, y; tie(x, y) = matches[i];
		gph[x].emplace_back(i, y);
		gph[y].emplace_back(i, x);
		deg[x]++;
		deg[y]++;
	}
	vector<pi> mrev(sz(mp));
	for(auto &[x, y] : mp){
		mrev[y] = x;
	}
	for(int i = 0; i < sz(mp); i++){
		if(!vis[i]){
			V = E = 0;
			dfn.clear();
			dfs(i);
			E /= 2;
			if(V < E){
				return 0;
			}
			assert(V >= E);
			queue<int> que;
			for(auto &v : dfn){
				if(deg[v] == 1){
					que.push(v);
				}
			}
			while(sz(que)){
				int x = que.front();
				que.pop();
				for(auto &[i, y] : gph[x]){
					if(!deg[y]) continue;
					deg[x]--;
					deg[y]--;
					A[i] = mrev[x].first;
					B[i] = mrev[x].second;
				//	printf("%d %d\n", i, x);
					if(deg[y] == 1){
						que.push(y);
					}
				}
			}
			if(V != E) continue;
			for(auto &v : dfn){
				if(deg[v] == 2){
					int I, V, W;
					for(auto &[i, w] : gph[v]){
						if(deg[w] == 2){
							deg[v]--;
							deg[w]--;
							tie(I, V, W) = make_tuple(i, v, w);
							break;
						}
					}
					gph[V].erase(find(all(gph[V]), pi(I, W)));
					gph[W].erase(find(all(gph[W]), pi(I, V)));
			//		printf("%d %d\n", I, W);
					A[I] = mrev[W].first;
					B[I] = mrev[W].second;
					que.push(V);
					break;
				}
			}
			while(sz(que)){
				int x = que.front();
				que.pop();
				for(auto &[i, y] : gph[x]){
					if(!deg[y]) continue;
					deg[x]--;
					deg[y]--;
			//		printf("%d %d\n", i, x);
					A[i] = mrev[x].first;
					B[i] = mrev[x].second;
					if(deg[y] == 1){
						que.push(y);
					}
				}
			}
		}
	}
	build(U, _V, A, B);
	return 1;
}
# Verdict Execution time Memory Grader output
1 Correct 6 ms 9676 KB Output is correct
2 Correct 6 ms 9676 KB Output is correct
3 Correct 6 ms 9676 KB Output is correct
4 Correct 7 ms 9676 KB Output is correct
5 Correct 6 ms 9580 KB Output is correct
6 Correct 7 ms 9676 KB Output is correct
7 Correct 6 ms 9676 KB Output is correct
8 Correct 6 ms 9676 KB Output is correct
9 Correct 310 ms 45140 KB Output is correct
10 Correct 27 ms 13136 KB Output is correct
11 Correct 132 ms 28800 KB Output is correct
12 Correct 37 ms 15004 KB Output is correct
13 Correct 24 ms 13244 KB Output is correct
14 Correct 7 ms 9676 KB Output is correct
15 Correct 7 ms 9804 KB Output is correct
16 Correct 297 ms 45096 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 9676 KB Output is correct
2 Correct 6 ms 9676 KB Output is correct
3 Correct 6 ms 9676 KB Output is correct
4 Correct 7 ms 9676 KB Output is correct
5 Correct 6 ms 9580 KB Output is correct
6 Correct 7 ms 9676 KB Output is correct
7 Correct 6 ms 9676 KB Output is correct
8 Correct 6 ms 9676 KB Output is correct
9 Correct 310 ms 45140 KB Output is correct
10 Correct 27 ms 13136 KB Output is correct
11 Correct 132 ms 28800 KB Output is correct
12 Correct 37 ms 15004 KB Output is correct
13 Correct 24 ms 13244 KB Output is correct
14 Correct 7 ms 9676 KB Output is correct
15 Correct 7 ms 9804 KB Output is correct
16 Correct 297 ms 45096 KB Output is correct
17 Correct 6 ms 9676 KB Output is correct
18 Correct 8 ms 9676 KB Output is correct
19 Correct 6 ms 9704 KB Output is correct
20 Correct 7 ms 9676 KB Output is correct
21 Correct 6 ms 9692 KB Output is correct
22 Correct 6 ms 9676 KB Output is correct
23 Correct 626 ms 72344 KB Output is correct
24 Correct 6 ms 9676 KB Output is correct
25 Correct 9 ms 10060 KB Output is correct
26 Correct 10 ms 9896 KB Output is correct
27 Correct 10 ms 9932 KB Output is correct
28 Correct 223 ms 34720 KB Output is correct
29 Correct 362 ms 47156 KB Output is correct
30 Correct 477 ms 59680 KB Output is correct
31 Correct 651 ms 72212 KB Output is correct
32 Correct 7 ms 9676 KB Output is correct
33 Correct 7 ms 9676 KB Output is correct
34 Correct 6 ms 9676 KB Output is correct
35 Correct 6 ms 9676 KB Output is correct
36 Correct 7 ms 9692 KB Output is correct
37 Correct 6 ms 9676 KB Output is correct
38 Correct 6 ms 9676 KB Output is correct
39 Correct 7 ms 9684 KB Output is correct
40 Correct 6 ms 9676 KB Output is correct
41 Correct 7 ms 9676 KB Output is correct
42 Correct 6 ms 9676 KB Output is correct
43 Correct 8 ms 9804 KB Output is correct
44 Correct 9 ms 9972 KB Output is correct
45 Correct 280 ms 40548 KB Output is correct
46 Correct 475 ms 54516 KB Output is correct
47 Correct 488 ms 54624 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 9676 KB Output is correct
2 Correct 6 ms 9676 KB Output is correct
3 Correct 6 ms 9676 KB Output is correct
4 Correct 7 ms 9676 KB Output is correct
5 Correct 6 ms 9580 KB Output is correct
6 Correct 7 ms 9676 KB Output is correct
7 Correct 6 ms 9676 KB Output is correct
8 Correct 6 ms 9676 KB Output is correct
9 Correct 310 ms 45140 KB Output is correct
10 Correct 27 ms 13136 KB Output is correct
11 Correct 132 ms 28800 KB Output is correct
12 Correct 37 ms 15004 KB Output is correct
13 Correct 24 ms 13244 KB Output is correct
14 Correct 7 ms 9676 KB Output is correct
15 Correct 7 ms 9804 KB Output is correct
16 Correct 297 ms 45096 KB Output is correct
17 Correct 6 ms 9676 KB Output is correct
18 Correct 8 ms 9676 KB Output is correct
19 Correct 6 ms 9704 KB Output is correct
20 Correct 7 ms 9676 KB Output is correct
21 Correct 6 ms 9692 KB Output is correct
22 Correct 6 ms 9676 KB Output is correct
23 Correct 626 ms 72344 KB Output is correct
24 Correct 6 ms 9676 KB Output is correct
25 Correct 9 ms 10060 KB Output is correct
26 Correct 10 ms 9896 KB Output is correct
27 Correct 10 ms 9932 KB Output is correct
28 Correct 223 ms 34720 KB Output is correct
29 Correct 362 ms 47156 KB Output is correct
30 Correct 477 ms 59680 KB Output is correct
31 Correct 651 ms 72212 KB Output is correct
32 Correct 7 ms 9676 KB Output is correct
33 Correct 7 ms 9676 KB Output is correct
34 Correct 6 ms 9676 KB Output is correct
35 Correct 6 ms 9676 KB Output is correct
36 Correct 7 ms 9692 KB Output is correct
37 Correct 6 ms 9676 KB Output is correct
38 Correct 6 ms 9676 KB Output is correct
39 Correct 7 ms 9684 KB Output is correct
40 Correct 6 ms 9676 KB Output is correct
41 Correct 7 ms 9676 KB Output is correct
42 Correct 6 ms 9676 KB Output is correct
43 Correct 8 ms 9804 KB Output is correct
44 Correct 9 ms 9972 KB Output is correct
45 Correct 280 ms 40548 KB Output is correct
46 Correct 475 ms 54516 KB Output is correct
47 Correct 488 ms 54624 KB Output is correct
48 Correct 6 ms 9676 KB Output is correct
49 Correct 6 ms 9676 KB Output is correct
50 Correct 6 ms 9676 KB Output is correct
51 Correct 7 ms 9668 KB Output is correct
52 Correct 8 ms 9676 KB Output is correct
53 Correct 7 ms 9804 KB Output is correct
54 Correct 7 ms 9676 KB Output is correct
55 Correct 575 ms 71452 KB Output is correct
56 Correct 6 ms 9676 KB Output is correct
57 Correct 9 ms 10188 KB Output is correct
58 Correct 20 ms 11592 KB Output is correct
59 Correct 12 ms 10608 KB Output is correct
60 Correct 284 ms 40244 KB Output is correct
61 Correct 374 ms 50980 KB Output is correct
62 Correct 472 ms 60164 KB Output is correct
63 Correct 594 ms 70868 KB Output is correct
64 Correct 8 ms 9676 KB Output is correct
65 Correct 6 ms 9676 KB Output is correct
66 Correct 6 ms 9676 KB Output is correct
67 Correct 626 ms 80548 KB Output is correct
68 Correct 609 ms 80568 KB Output is correct
69 Correct 615 ms 80168 KB Output is correct
70 Correct 8 ms 10056 KB Output is correct
71 Correct 11 ms 10256 KB Output is correct
72 Correct 299 ms 39692 KB Output is correct
73 Correct 470 ms 54588 KB Output is correct
74 Correct 635 ms 69456 KB Output is correct
75 Correct 593 ms 75780 KB Output is correct
76 Correct 641 ms 80580 KB Output is correct
77 Correct 10 ms 10188 KB Output is correct
78 Correct 12 ms 10508 KB Output is correct
79 Correct 275 ms 40600 KB Output is correct
80 Correct 465 ms 56164 KB Output is correct
81 Correct 596 ms 71648 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 9676 KB Output is correct
2 Correct 6 ms 9676 KB Output is correct
3 Correct 6 ms 9676 KB Output is correct
4 Correct 7 ms 9676 KB Output is correct
5 Correct 6 ms 9580 KB Output is correct
6 Correct 7 ms 9676 KB Output is correct
7 Correct 6 ms 9676 KB Output is correct
8 Correct 6 ms 9676 KB Output is correct
9 Correct 310 ms 45140 KB Output is correct
10 Correct 27 ms 13136 KB Output is correct
11 Correct 132 ms 28800 KB Output is correct
12 Correct 37 ms 15004 KB Output is correct
13 Correct 24 ms 13244 KB Output is correct
14 Correct 7 ms 9676 KB Output is correct
15 Correct 7 ms 9804 KB Output is correct
16 Correct 297 ms 45096 KB Output is correct
17 Correct 6 ms 9676 KB Output is correct
18 Correct 6 ms 9676 KB Output is correct
19 Correct 6 ms 9676 KB Output is correct
20 Correct 490 ms 68128 KB Output is correct
21 Correct 537 ms 65888 KB Output is correct
22 Correct 519 ms 66032 KB Output is correct
23 Correct 480 ms 70048 KB Output is correct
24 Correct 112 ms 16052 KB Output is correct
25 Correct 147 ms 25192 KB Output is correct
26 Correct 150 ms 25152 KB Output is correct
27 Correct 582 ms 80452 KB Output is correct
28 Correct 573 ms 80420 KB Output is correct
29 Correct 635 ms 80456 KB Output is correct
30 Correct 643 ms 80420 KB Output is correct
31 Correct 6 ms 9676 KB Output is correct
32 Correct 41 ms 13720 KB Output is correct
33 Correct 58 ms 13000 KB Output is correct
34 Correct 466 ms 68140 KB Output is correct
35 Correct 14 ms 10508 KB Output is correct
36 Correct 42 ms 13532 KB Output is correct
37 Correct 83 ms 17380 KB Output is correct
38 Correct 260 ms 32196 KB Output is correct
39 Correct 343 ms 40612 KB Output is correct
40 Correct 508 ms 49000 KB Output is correct
41 Correct 575 ms 57436 KB Output is correct
42 Correct 727 ms 65896 KB Output is correct
43 Correct 6 ms 9676 KB Output is correct
44 Correct 6 ms 9676 KB Output is correct
45 Correct 6 ms 9676 KB Output is correct
46 Correct 6 ms 9676 KB Output is correct
47 Correct 7 ms 9676 KB Output is correct
48 Correct 7 ms 9676 KB Output is correct
49 Correct 7 ms 9676 KB Output is correct
50 Correct 6 ms 9676 KB Output is correct
51 Correct 7 ms 9676 KB Output is correct
52 Correct 6 ms 9676 KB Output is correct
53 Correct 6 ms 9676 KB Output is correct
54 Correct 7 ms 9804 KB Output is correct
55 Correct 8 ms 9932 KB Output is correct
56 Correct 273 ms 40600 KB Output is correct
57 Correct 421 ms 54584 KB Output is correct
58 Correct 437 ms 54628 KB Output is correct
59 Correct 6 ms 9676 KB Output is correct
60 Correct 7 ms 9676 KB Output is correct
61 Correct 7 ms 9688 KB Output is correct
62 Correct 637 ms 80620 KB Output is correct
63 Correct 603 ms 80560 KB Output is correct
64 Correct 643 ms 80328 KB Output is correct
65 Correct 10 ms 9932 KB Output is correct
66 Correct 11 ms 10256 KB Output is correct
67 Correct 283 ms 39580 KB Output is correct
68 Correct 465 ms 54412 KB Output is correct
69 Correct 634 ms 69416 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 9676 KB Output is correct
2 Correct 6 ms 9676 KB Output is correct
3 Correct 6 ms 9676 KB Output is correct
4 Correct 7 ms 9676 KB Output is correct
5 Correct 6 ms 9580 KB Output is correct
6 Correct 7 ms 9676 KB Output is correct
7 Correct 6 ms 9676 KB Output is correct
8 Correct 6 ms 9676 KB Output is correct
9 Correct 310 ms 45140 KB Output is correct
10 Correct 27 ms 13136 KB Output is correct
11 Correct 132 ms 28800 KB Output is correct
12 Correct 37 ms 15004 KB Output is correct
13 Correct 24 ms 13244 KB Output is correct
14 Correct 7 ms 9676 KB Output is correct
15 Correct 7 ms 9804 KB Output is correct
16 Correct 297 ms 45096 KB Output is correct
17 Correct 646 ms 80444 KB Output is correct
18 Correct 569 ms 80532 KB Output is correct
19 Correct 526 ms 69516 KB Output is correct
20 Correct 634 ms 71360 KB Output is correct
21 Correct 599 ms 66128 KB Output is correct
22 Correct 6 ms 9676 KB Output is correct
23 Correct 99 ms 18808 KB Output is correct
24 Correct 21 ms 11364 KB Output is correct
25 Correct 62 ms 16364 KB Output is correct
26 Correct 101 ms 19580 KB Output is correct
27 Correct 322 ms 39136 KB Output is correct
28 Correct 457 ms 46404 KB Output is correct
29 Correct 517 ms 53736 KB Output is correct
30 Correct 601 ms 61132 KB Output is correct
31 Correct 726 ms 68456 KB Output is correct
32 Correct 610 ms 75820 KB Output is correct
33 Correct 629 ms 80556 KB Output is correct
34 Correct 9 ms 10188 KB Output is correct
35 Correct 12 ms 10508 KB Output is correct
36 Correct 309 ms 40628 KB Output is correct
37 Correct 480 ms 56180 KB Output is correct
38 Correct 706 ms 71584 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 9676 KB Output is correct
2 Correct 6 ms 9676 KB Output is correct
3 Correct 6 ms 9676 KB Output is correct
4 Correct 7 ms 9676 KB Output is correct
5 Correct 6 ms 9580 KB Output is correct
6 Correct 7 ms 9676 KB Output is correct
7 Correct 6 ms 9676 KB Output is correct
8 Correct 6 ms 9676 KB Output is correct
9 Correct 310 ms 45140 KB Output is correct
10 Correct 27 ms 13136 KB Output is correct
11 Correct 132 ms 28800 KB Output is correct
12 Correct 37 ms 15004 KB Output is correct
13 Correct 24 ms 13244 KB Output is correct
14 Correct 7 ms 9676 KB Output is correct
15 Correct 7 ms 9804 KB Output is correct
16 Correct 297 ms 45096 KB Output is correct
17 Correct 6 ms 9676 KB Output is correct
18 Correct 8 ms 9676 KB Output is correct
19 Correct 6 ms 9704 KB Output is correct
20 Correct 7 ms 9676 KB Output is correct
21 Correct 6 ms 9692 KB Output is correct
22 Correct 6 ms 9676 KB Output is correct
23 Correct 626 ms 72344 KB Output is correct
24 Correct 6 ms 9676 KB Output is correct
25 Correct 9 ms 10060 KB Output is correct
26 Correct 10 ms 9896 KB Output is correct
27 Correct 10 ms 9932 KB Output is correct
28 Correct 223 ms 34720 KB Output is correct
29 Correct 362 ms 47156 KB Output is correct
30 Correct 477 ms 59680 KB Output is correct
31 Correct 651 ms 72212 KB Output is correct
32 Correct 7 ms 9676 KB Output is correct
33 Correct 7 ms 9676 KB Output is correct
34 Correct 6 ms 9676 KB Output is correct
35 Correct 6 ms 9676 KB Output is correct
36 Correct 7 ms 9692 KB Output is correct
37 Correct 6 ms 9676 KB Output is correct
38 Correct 6 ms 9676 KB Output is correct
39 Correct 7 ms 9684 KB Output is correct
40 Correct 6 ms 9676 KB Output is correct
41 Correct 7 ms 9676 KB Output is correct
42 Correct 6 ms 9676 KB Output is correct
43 Correct 8 ms 9804 KB Output is correct
44 Correct 9 ms 9972 KB Output is correct
45 Correct 280 ms 40548 KB Output is correct
46 Correct 475 ms 54516 KB Output is correct
47 Correct 488 ms 54624 KB Output is correct
48 Correct 6 ms 9676 KB Output is correct
49 Correct 6 ms 9676 KB Output is correct
50 Correct 6 ms 9676 KB Output is correct
51 Correct 7 ms 9668 KB Output is correct
52 Correct 8 ms 9676 KB Output is correct
53 Correct 7 ms 9804 KB Output is correct
54 Correct 7 ms 9676 KB Output is correct
55 Correct 575 ms 71452 KB Output is correct
56 Correct 6 ms 9676 KB Output is correct
57 Correct 9 ms 10188 KB Output is correct
58 Correct 20 ms 11592 KB Output is correct
59 Correct 12 ms 10608 KB Output is correct
60 Correct 284 ms 40244 KB Output is correct
61 Correct 374 ms 50980 KB Output is correct
62 Correct 472 ms 60164 KB Output is correct
63 Correct 594 ms 70868 KB Output is correct
64 Correct 8 ms 9676 KB Output is correct
65 Correct 6 ms 9676 KB Output is correct
66 Correct 6 ms 9676 KB Output is correct
67 Correct 626 ms 80548 KB Output is correct
68 Correct 609 ms 80568 KB Output is correct
69 Correct 615 ms 80168 KB Output is correct
70 Correct 8 ms 10056 KB Output is correct
71 Correct 11 ms 10256 KB Output is correct
72 Correct 299 ms 39692 KB Output is correct
73 Correct 470 ms 54588 KB Output is correct
74 Correct 635 ms 69456 KB Output is correct
75 Correct 593 ms 75780 KB Output is correct
76 Correct 641 ms 80580 KB Output is correct
77 Correct 10 ms 10188 KB Output is correct
78 Correct 12 ms 10508 KB Output is correct
79 Correct 275 ms 40600 KB Output is correct
80 Correct 465 ms 56164 KB Output is correct
81 Correct 596 ms 71648 KB Output is correct
82 Correct 6 ms 9676 KB Output is correct
83 Correct 6 ms 9676 KB Output is correct
84 Correct 6 ms 9676 KB Output is correct
85 Correct 490 ms 68128 KB Output is correct
86 Correct 537 ms 65888 KB Output is correct
87 Correct 519 ms 66032 KB Output is correct
88 Correct 480 ms 70048 KB Output is correct
89 Correct 112 ms 16052 KB Output is correct
90 Correct 147 ms 25192 KB Output is correct
91 Correct 150 ms 25152 KB Output is correct
92 Correct 582 ms 80452 KB Output is correct
93 Correct 573 ms 80420 KB Output is correct
94 Correct 635 ms 80456 KB Output is correct
95 Correct 643 ms 80420 KB Output is correct
96 Correct 6 ms 9676 KB Output is correct
97 Correct 41 ms 13720 KB Output is correct
98 Correct 58 ms 13000 KB Output is correct
99 Correct 466 ms 68140 KB Output is correct
100 Correct 14 ms 10508 KB Output is correct
101 Correct 42 ms 13532 KB Output is correct
102 Correct 83 ms 17380 KB Output is correct
103 Correct 260 ms 32196 KB Output is correct
104 Correct 343 ms 40612 KB Output is correct
105 Correct 508 ms 49000 KB Output is correct
106 Correct 575 ms 57436 KB Output is correct
107 Correct 727 ms 65896 KB Output is correct
108 Correct 6 ms 9676 KB Output is correct
109 Correct 6 ms 9676 KB Output is correct
110 Correct 6 ms 9676 KB Output is correct
111 Correct 6 ms 9676 KB Output is correct
112 Correct 7 ms 9676 KB Output is correct
113 Correct 7 ms 9676 KB Output is correct
114 Correct 7 ms 9676 KB Output is correct
115 Correct 6 ms 9676 KB Output is correct
116 Correct 7 ms 9676 KB Output is correct
117 Correct 6 ms 9676 KB Output is correct
118 Correct 6 ms 9676 KB Output is correct
119 Correct 7 ms 9804 KB Output is correct
120 Correct 8 ms 9932 KB Output is correct
121 Correct 273 ms 40600 KB Output is correct
122 Correct 421 ms 54584 KB Output is correct
123 Correct 437 ms 54628 KB Output is correct
124 Correct 6 ms 9676 KB Output is correct
125 Correct 7 ms 9676 KB Output is correct
126 Correct 7 ms 9688 KB Output is correct
127 Correct 637 ms 80620 KB Output is correct
128 Correct 603 ms 80560 KB Output is correct
129 Correct 643 ms 80328 KB Output is correct
130 Correct 10 ms 9932 KB Output is correct
131 Correct 11 ms 10256 KB Output is correct
132 Correct 283 ms 39580 KB Output is correct
133 Correct 465 ms 54412 KB Output is correct
134 Correct 634 ms 69416 KB Output is correct
135 Correct 646 ms 80444 KB Output is correct
136 Correct 569 ms 80532 KB Output is correct
137 Correct 526 ms 69516 KB Output is correct
138 Correct 634 ms 71360 KB Output is correct
139 Correct 599 ms 66128 KB Output is correct
140 Correct 6 ms 9676 KB Output is correct
141 Correct 99 ms 18808 KB Output is correct
142 Correct 21 ms 11364 KB Output is correct
143 Correct 62 ms 16364 KB Output is correct
144 Correct 101 ms 19580 KB Output is correct
145 Correct 322 ms 39136 KB Output is correct
146 Correct 457 ms 46404 KB Output is correct
147 Correct 517 ms 53736 KB Output is correct
148 Correct 601 ms 61132 KB Output is correct
149 Correct 726 ms 68456 KB Output is correct
150 Correct 610 ms 75820 KB Output is correct
151 Correct 629 ms 80556 KB Output is correct
152 Correct 9 ms 10188 KB Output is correct
153 Correct 12 ms 10508 KB Output is correct
154 Correct 309 ms 40628 KB Output is correct
155 Correct 480 ms 56180 KB Output is correct
156 Correct 706 ms 71584 KB Output is correct
157 Correct 6 ms 9676 KB Output is correct
158 Correct 6 ms 9676 KB Output is correct
159 Correct 6 ms 9676 KB Output is correct
160 Correct 7 ms 9676 KB Output is correct
161 Incorrect 506 ms 59104 KB Solution announced impossible, but it is possible.
162 Halted 0 ms 0 KB -