Submission #774572

# Submission time Handle Problem Language Result Execution time Memory
774572 2023-07-05T20:07:39 Z rainboy Phone Plans (CCO22_day2problem2) C
25 / 25
727 ms 106944 KB
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define N	200000
#define M	200000
#define N_	(N * 4)
#define MD	0x7fffffff

int min(int a, int b) { return a < b ? a : b; }

unsigned int Z = 12345;

int rand_() {
	return (Z *= 3) >> 1;
}

long long cnt;

long long *ek[N_]; int *ev[N_], eo[N_], eo_[N_], X = 123456789;

void init() {
	int h;

	for (h = 0; h < N_; h++) {
		eo_[h] = 2;
		ek[h] = (long long *) malloc(eo_[h] * sizeof *ek[h]);
		ev[h] = (int *) malloc(eo_[h] * sizeof *ev[h]);
	}
}

int hash(long long k) {
	int k1 = k / MD, k2 = k % MD;

	return ((long long) k1 * X % MD + k2) % MD * X % MD % N_;
}

void put(long long k, int v) {
	int h = hash(k), o;

	for (o = eo[h]; o--; )
		if (ek[h][o] == k) {
			int v_ = ev[h][o];

			cnt += (long long) v_ * (v_ - 1) / 2;
			v_ += v;
			cnt -= (long long) v_ * (v_ - 1) / 2;
			if (v_ == 0) {
				eo[h]--;
				while (o < eo[h])
					ek[h][o] = ek[h][o + 1], ev[h][o] = ev[h][o + 1], o++;
			} else
				ev[h][o] = v_;
			return;
		}
	o = eo[h]++;
	if (o == eo_[h]) {
		eo_[h] *= 2;
		ek[h] = (long long *) realloc(ek[h], eo_[h] * sizeof *ek[h]);
		ev[h] = (int *) realloc(ev[h], eo_[h] * sizeof *ev[h]);
	}
	ek[h][o] = k, ev[h][o] = v;
	cnt -= (long long) v * (v - 1) / 2;
}

int n;

int ddx[N], ddy[N];

void add(int x, int y, int v) {
	cnt -= (long long) ddx[x] * (ddx[x] - 1) / 2, ddx[x] += v, cnt += (long long) ddx[x] * (ddx[x] - 1) / 2;
	cnt -= (long long) ddy[y] * (ddy[y] - 1) / 2, ddy[y] += v, cnt += (long long) ddy[y] * (ddy[y] - 1) / 2;
	put((long long) x * n + y, v);
}

int *ww;

void sort(int *hh, int l, int r) {
	while (l < r) {
		int i = l, j = l, k = r, h = hh[l + rand_() % (r - l)], tmp;

		while (j < k)
			if (ww[hh[j]] == ww[h])
				j++;
			else if (ww[hh[j]] < ww[h]) {
				tmp = hh[i], hh[i] = hh[j], hh[j] = tmp;
				i++, j++;
			} else {
				k--;
				tmp = hh[j], hh[j] = hh[k], hh[k] = tmp;
			}
		sort(hh, l, i);
		l = k;
	}
}

int ds[N];

int find(int i) {
	return ds[i] < 0 ? i : (ds[i] = find(ds[i]));
}

void append(int **ej, int *eo, int i, int j) {
	int o = eo[i]++;

	if (o >= 2 && (o & o - 1) == 0)
		ej[i] = (int *) realloc(ej[i], o * 2 * sizeof *ej[i]);
	ej[i][o] = j;
}

int *ej1[N], eo1[N], *ej2[N], eo2[N], xx[N], yy[N];

void dfs1(int i, int x) {
	int o;

	add(xx[i], yy[i], -1), xx[i] = x, add(xx[i], yy[i], 1);
	for (o = eo1[i]; o--; ) {
		int j = ej1[i][o];

		dfs1(j, x);
	}
}

void dfs2(int i, int y) {
	int o;

	add(xx[i], yy[i], -1), yy[i] = y, add(xx[i], yy[i], 1);
	for (o = eo2[i]; o--; ) {
		int j = ej2[i][o];

		dfs2(j, y);
	}
}

int main() {
	static int ii1[M], jj1[M], ww1[M], hh1[M], ii2[M], jj2[M], ww2[M], hh2[M];
	int m1, m1_, m2, m2_, h, h1, h2, i, j, tmp, ans;
	long long cnt_;

	init();
	scanf("%d%d%d%lld", &n, &m1, &m2, &cnt_);
	for (h = 0; h < m1; h++)
		scanf("%d%d%d", &ii1[h], &jj1[h], &ww1[h]), ii1[h]--, jj1[h]--;
	for (h = 0; h < m2; h++)
		scanf("%d%d%d", &ii2[h], &jj2[h], &ww2[h]), ii2[h]--, jj2[h]--;
	for (h = 0; h < m1; h++)
		hh1[h] = h;
	ww = ww1, sort(hh1, 0, m1);
	memset(ds, -1, n * sizeof *ds);
	for (i = 0; i < n; i++)
		ej1[i] = (int *) malloc(2 * sizeof *ej1[i]);
	m1_ = 0;
	for (h = 0; h < m1; h++) {
		h1 = hh1[h], i = find(ii1[h1]), j = find(jj1[h1]);
		if (i == j)
			continue;
		if (ds[i] > ds[j])
			tmp = i, i = j, j = tmp;
		if (ds[i] == ds[j])
			ds[i]--;
		ds[j] = i, append(ej1, eo1, i, j);
		ii1[h1] = i, jj1[h1] = j, hh1[m1_++] = h1;
	}
	m1 = m1_;
	for (h = 0; h < m2; h++)
		hh2[h] = h;
	ww = ww2, sort(hh2, 0, m2);
	memset(ds, -1, n * sizeof *ds);
	for (i = 0; i < n; i++)
		ej2[i] = (int *) malloc(2 * sizeof *ej2[i]);
	m2_ = 0;
	for (h = 0; h < m2; h++) {
		h2 = hh2[h], i = find(ii2[h2]), j = find(jj2[h2]);
		if (i == j)
			continue;
		if (ds[i] > ds[j])
			tmp = i, i = j, j = tmp;
		if (ds[i] == ds[j])
			ds[i]--;
		ds[j] = i, append(ej2, eo2, i, j);
		ii2[h2] = i, jj2[h2] = j, hh2[m2_++] = h2;
	}
	m2 = m2_;
	for (i = 0; i < n; i++) {
		xx[i] = i, yy[i] = find(i);
		add(xx[i], yy[i], 1);
	}
	ans = MD;
	for (h1 = -1, h2 = m2 - 1; h1 < m1; h1++) {
		if (h1 >= 0)
			dfs1(jj1[hh1[h1]], ii1[hh1[h1]]);
		while (h2 >= -1 && cnt >= cnt_) {
			ans = min(ans, (h1 < 0 ? 0 : ww1[hh1[h1]]) + (h2 < 0 ? 0 : ww2[hh2[h2]]));
			if (h2 >= 0)
				dfs2(jj2[hh2[h2]], jj2[hh2[h2]]);
			h2--;
		}
	}
	if (ans == MD)
		ans = -1;
	printf("%d\n", ans);
	return 0;
}

Compilation message

Main.c: In function 'append':
Main.c:106:23: warning: suggest parentheses around '-' in operand of '&' [-Wparentheses]
  106 |  if (o >= 2 && (o & o - 1) == 0)
      |                     ~~^~~
Main.c: In function 'main':
Main.c:141:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
  141 |  scanf("%d%d%d%lld", &n, &m1, &m2, &cnt_);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Main.c:143:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
  143 |   scanf("%d%d%d", &ii1[h], &jj1[h], &ww1[h]), ii1[h]--, jj1[h]--;
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Main.c:145:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
  145 |   scanf("%d%d%d", &ii2[h], &jj2[h], &ww2[h]), ii2[h]--, jj2[h]--;
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 43 ms 66128 KB Output is correct
2 Correct 42 ms 66008 KB Output is correct
3 Correct 44 ms 66008 KB Output is correct
4 Correct 44 ms 66040 KB Output is correct
5 Correct 43 ms 66124 KB Output is correct
6 Correct 110 ms 76228 KB Output is correct
7 Correct 112 ms 76200 KB Output is correct
8 Correct 182 ms 82956 KB Output is correct
9 Correct 174 ms 82952 KB Output is correct
10 Correct 184 ms 82940 KB Output is correct
11 Correct 176 ms 82904 KB Output is correct
12 Correct 46 ms 69324 KB Output is correct
13 Correct 45 ms 69352 KB Output is correct
14 Correct 45 ms 69304 KB Output is correct
15 Correct 180 ms 82952 KB Output is correct
16 Correct 193 ms 82976 KB Output is correct
17 Correct 186 ms 83016 KB Output is correct
18 Correct 179 ms 83040 KB Output is correct
19 Correct 178 ms 82928 KB Output is correct
20 Correct 181 ms 83028 KB Output is correct
21 Correct 179 ms 83020 KB Output is correct
22 Correct 178 ms 82972 KB Output is correct
23 Correct 176 ms 83000 KB Output is correct
24 Correct 179 ms 83008 KB Output is correct
25 Correct 178 ms 83044 KB Output is correct
26 Correct 178 ms 82936 KB Output is correct
27 Correct 184 ms 83240 KB Output is correct
28 Correct 179 ms 82960 KB Output is correct
29 Correct 182 ms 82964 KB Output is correct
30 Correct 180 ms 82952 KB Output is correct
31 Correct 200 ms 83020 KB Output is correct
32 Correct 195 ms 82920 KB Output is correct
33 Correct 151 ms 80212 KB Output is correct
34 Correct 157 ms 80888 KB Output is correct
35 Correct 149 ms 80888 KB Output is correct
36 Correct 153 ms 80780 KB Output is correct
37 Correct 47 ms 69060 KB Output is correct
38 Correct 47 ms 69036 KB Output is correct
39 Correct 47 ms 68960 KB Output is correct
40 Correct 48 ms 69068 KB Output is correct
41 Correct 169 ms 77900 KB Output is correct
42 Correct 172 ms 77964 KB Output is correct
43 Correct 178 ms 81756 KB Output is correct
44 Correct 174 ms 81184 KB Output is correct
45 Correct 182 ms 82968 KB Output is correct
46 Correct 182 ms 82980 KB Output is correct
47 Correct 194 ms 83040 KB Output is correct
48 Correct 134 ms 80248 KB Output is correct
49 Correct 135 ms 80244 KB Output is correct
50 Correct 47 ms 69440 KB Output is correct
51 Correct 112 ms 76200 KB Output is correct
52 Correct 113 ms 76188 KB Output is correct
53 Correct 43 ms 66088 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 380 ms 94080 KB Output is correct
2 Correct 279 ms 93472 KB Output is correct
3 Correct 271 ms 93372 KB Output is correct
4 Correct 44 ms 65976 KB Output is correct
5 Correct 44 ms 65992 KB Output is correct
6 Correct 44 ms 66004 KB Output is correct
7 Correct 173 ms 77728 KB Output is correct
8 Correct 115 ms 78156 KB Output is correct
9 Correct 234 ms 97420 KB Output is correct
10 Correct 281 ms 97344 KB Output is correct
11 Correct 271 ms 103996 KB Output is correct
12 Correct 302 ms 103928 KB Output is correct
13 Correct 273 ms 103984 KB Output is correct
14 Correct 284 ms 103976 KB Output is correct
15 Correct 83 ms 88708 KB Output is correct
16 Correct 84 ms 88640 KB Output is correct
17 Correct 87 ms 88652 KB Output is correct
18 Correct 460 ms 106204 KB Output is correct
19 Correct 457 ms 106152 KB Output is correct
20 Correct 496 ms 106220 KB Output is correct
21 Correct 476 ms 106220 KB Output is correct
22 Correct 463 ms 106168 KB Output is correct
23 Correct 468 ms 106236 KB Output is correct
24 Correct 452 ms 106188 KB Output is correct
25 Correct 523 ms 106260 KB Output is correct
26 Correct 472 ms 106280 KB Output is correct
27 Correct 349 ms 106096 KB Output is correct
28 Correct 462 ms 106296 KB Output is correct
29 Correct 482 ms 106104 KB Output is correct
30 Correct 466 ms 106256 KB Output is correct
31 Correct 458 ms 106168 KB Output is correct
32 Correct 453 ms 106200 KB Output is correct
33 Correct 476 ms 106200 KB Output is correct
34 Correct 436 ms 104784 KB Output is correct
35 Correct 448 ms 104868 KB Output is correct
36 Correct 434 ms 104816 KB Output is correct
37 Correct 348 ms 104744 KB Output is correct
38 Correct 240 ms 93356 KB Output is correct
39 Correct 245 ms 93364 KB Output is correct
40 Correct 237 ms 93328 KB Output is correct
41 Correct 233 ms 93260 KB Output is correct
42 Correct 172 ms 77916 KB Output is correct
43 Correct 171 ms 77884 KB Output is correct
44 Correct 172 ms 81068 KB Output is correct
45 Correct 173 ms 81228 KB Output is correct
46 Correct 478 ms 106248 KB Output is correct
47 Correct 460 ms 106216 KB Output is correct
48 Correct 344 ms 106204 KB Output is correct
49 Correct 439 ms 103548 KB Output is correct
50 Correct 341 ms 103500 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 40 ms 66020 KB Output is correct
2 Correct 41 ms 65996 KB Output is correct
3 Correct 111 ms 71928 KB Output is correct
4 Correct 80 ms 72176 KB Output is correct
5 Correct 361 ms 97832 KB Output is correct
6 Correct 171 ms 97868 KB Output is correct
7 Correct 305 ms 97848 KB Output is correct
8 Correct 82 ms 88728 KB Output is correct
9 Correct 158 ms 95760 KB Output is correct
10 Correct 154 ms 95796 KB Output is correct
11 Correct 150 ms 95676 KB Output is correct
12 Correct 150 ms 95700 KB Output is correct
13 Correct 86 ms 88664 KB Output is correct
14 Correct 86 ms 88704 KB Output is correct
15 Correct 84 ms 88644 KB Output is correct
16 Correct 365 ms 97812 KB Output is correct
17 Correct 381 ms 97968 KB Output is correct
18 Correct 363 ms 97924 KB Output is correct
19 Correct 376 ms 97920 KB Output is correct
20 Correct 377 ms 97888 KB Output is correct
21 Correct 378 ms 98036 KB Output is correct
22 Correct 313 ms 97868 KB Output is correct
23 Correct 303 ms 97780 KB Output is correct
24 Correct 217 ms 97636 KB Output is correct
25 Correct 169 ms 97684 KB Output is correct
26 Correct 360 ms 97868 KB Output is correct
27 Correct 362 ms 97824 KB Output is correct
28 Correct 389 ms 97948 KB Output is correct
29 Correct 421 ms 97904 KB Output is correct
30 Correct 380 ms 97880 KB Output is correct
31 Correct 415 ms 97888 KB Output is correct
32 Correct 319 ms 97824 KB Output is correct
33 Correct 268 ms 97732 KB Output is correct
34 Correct 185 ms 97620 KB Output is correct
35 Correct 192 ms 97636 KB Output is correct
36 Correct 146 ms 86448 KB Output is correct
37 Correct 129 ms 86340 KB Output is correct
38 Correct 161 ms 86420 KB Output is correct
39 Correct 128 ms 86348 KB Output is correct
40 Correct 134 ms 86368 KB Output is correct
41 Correct 129 ms 86360 KB Output is correct
42 Correct 127 ms 86348 KB Output is correct
43 Correct 130 ms 86396 KB Output is correct
44 Correct 132 ms 86416 KB Output is correct
45 Correct 130 ms 86364 KB Output is correct
46 Correct 125 ms 72088 KB Output is correct
47 Correct 108 ms 72040 KB Output is correct
48 Correct 112 ms 74688 KB Output is correct
49 Correct 109 ms 74128 KB Output is correct
50 Correct 341 ms 97852 KB Output is correct
51 Correct 215 ms 97740 KB Output is correct
52 Correct 172 ms 97692 KB Output is correct
53 Correct 359 ms 96516 KB Output is correct
54 Correct 231 ms 96372 KB Output is correct
55 Correct 135 ms 93640 KB Output is correct
56 Correct 92 ms 89028 KB Output is correct
57 Correct 90 ms 89036 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 43 ms 66128 KB Output is correct
2 Correct 42 ms 66008 KB Output is correct
3 Correct 44 ms 66008 KB Output is correct
4 Correct 44 ms 66040 KB Output is correct
5 Correct 43 ms 66124 KB Output is correct
6 Correct 110 ms 76228 KB Output is correct
7 Correct 112 ms 76200 KB Output is correct
8 Correct 182 ms 82956 KB Output is correct
9 Correct 174 ms 82952 KB Output is correct
10 Correct 184 ms 82940 KB Output is correct
11 Correct 176 ms 82904 KB Output is correct
12 Correct 46 ms 69324 KB Output is correct
13 Correct 45 ms 69352 KB Output is correct
14 Correct 45 ms 69304 KB Output is correct
15 Correct 180 ms 82952 KB Output is correct
16 Correct 193 ms 82976 KB Output is correct
17 Correct 186 ms 83016 KB Output is correct
18 Correct 179 ms 83040 KB Output is correct
19 Correct 178 ms 82928 KB Output is correct
20 Correct 181 ms 83028 KB Output is correct
21 Correct 179 ms 83020 KB Output is correct
22 Correct 178 ms 82972 KB Output is correct
23 Correct 176 ms 83000 KB Output is correct
24 Correct 179 ms 83008 KB Output is correct
25 Correct 178 ms 83044 KB Output is correct
26 Correct 178 ms 82936 KB Output is correct
27 Correct 184 ms 83240 KB Output is correct
28 Correct 179 ms 82960 KB Output is correct
29 Correct 182 ms 82964 KB Output is correct
30 Correct 180 ms 82952 KB Output is correct
31 Correct 200 ms 83020 KB Output is correct
32 Correct 195 ms 82920 KB Output is correct
33 Correct 151 ms 80212 KB Output is correct
34 Correct 157 ms 80888 KB Output is correct
35 Correct 149 ms 80888 KB Output is correct
36 Correct 153 ms 80780 KB Output is correct
37 Correct 47 ms 69060 KB Output is correct
38 Correct 47 ms 69036 KB Output is correct
39 Correct 47 ms 68960 KB Output is correct
40 Correct 48 ms 69068 KB Output is correct
41 Correct 169 ms 77900 KB Output is correct
42 Correct 172 ms 77964 KB Output is correct
43 Correct 178 ms 81756 KB Output is correct
44 Correct 174 ms 81184 KB Output is correct
45 Correct 182 ms 82968 KB Output is correct
46 Correct 182 ms 82980 KB Output is correct
47 Correct 194 ms 83040 KB Output is correct
48 Correct 134 ms 80248 KB Output is correct
49 Correct 135 ms 80244 KB Output is correct
50 Correct 47 ms 69440 KB Output is correct
51 Correct 112 ms 76200 KB Output is correct
52 Correct 113 ms 76188 KB Output is correct
53 Correct 43 ms 66088 KB Output is correct
54 Correct 380 ms 94080 KB Output is correct
55 Correct 279 ms 93472 KB Output is correct
56 Correct 271 ms 93372 KB Output is correct
57 Correct 44 ms 65976 KB Output is correct
58 Correct 44 ms 65992 KB Output is correct
59 Correct 44 ms 66004 KB Output is correct
60 Correct 173 ms 77728 KB Output is correct
61 Correct 115 ms 78156 KB Output is correct
62 Correct 234 ms 97420 KB Output is correct
63 Correct 281 ms 97344 KB Output is correct
64 Correct 271 ms 103996 KB Output is correct
65 Correct 302 ms 103928 KB Output is correct
66 Correct 273 ms 103984 KB Output is correct
67 Correct 284 ms 103976 KB Output is correct
68 Correct 83 ms 88708 KB Output is correct
69 Correct 84 ms 88640 KB Output is correct
70 Correct 87 ms 88652 KB Output is correct
71 Correct 460 ms 106204 KB Output is correct
72 Correct 457 ms 106152 KB Output is correct
73 Correct 496 ms 106220 KB Output is correct
74 Correct 476 ms 106220 KB Output is correct
75 Correct 463 ms 106168 KB Output is correct
76 Correct 468 ms 106236 KB Output is correct
77 Correct 452 ms 106188 KB Output is correct
78 Correct 523 ms 106260 KB Output is correct
79 Correct 472 ms 106280 KB Output is correct
80 Correct 349 ms 106096 KB Output is correct
81 Correct 462 ms 106296 KB Output is correct
82 Correct 482 ms 106104 KB Output is correct
83 Correct 466 ms 106256 KB Output is correct
84 Correct 458 ms 106168 KB Output is correct
85 Correct 453 ms 106200 KB Output is correct
86 Correct 476 ms 106200 KB Output is correct
87 Correct 436 ms 104784 KB Output is correct
88 Correct 448 ms 104868 KB Output is correct
89 Correct 434 ms 104816 KB Output is correct
90 Correct 348 ms 104744 KB Output is correct
91 Correct 240 ms 93356 KB Output is correct
92 Correct 245 ms 93364 KB Output is correct
93 Correct 237 ms 93328 KB Output is correct
94 Correct 233 ms 93260 KB Output is correct
95 Correct 172 ms 77916 KB Output is correct
96 Correct 171 ms 77884 KB Output is correct
97 Correct 172 ms 81068 KB Output is correct
98 Correct 173 ms 81228 KB Output is correct
99 Correct 478 ms 106248 KB Output is correct
100 Correct 460 ms 106216 KB Output is correct
101 Correct 344 ms 106204 KB Output is correct
102 Correct 439 ms 103548 KB Output is correct
103 Correct 341 ms 103500 KB Output is correct
104 Correct 40 ms 66020 KB Output is correct
105 Correct 41 ms 65996 KB Output is correct
106 Correct 111 ms 71928 KB Output is correct
107 Correct 80 ms 72176 KB Output is correct
108 Correct 361 ms 97832 KB Output is correct
109 Correct 171 ms 97868 KB Output is correct
110 Correct 305 ms 97848 KB Output is correct
111 Correct 82 ms 88728 KB Output is correct
112 Correct 158 ms 95760 KB Output is correct
113 Correct 154 ms 95796 KB Output is correct
114 Correct 150 ms 95676 KB Output is correct
115 Correct 150 ms 95700 KB Output is correct
116 Correct 86 ms 88664 KB Output is correct
117 Correct 86 ms 88704 KB Output is correct
118 Correct 84 ms 88644 KB Output is correct
119 Correct 365 ms 97812 KB Output is correct
120 Correct 381 ms 97968 KB Output is correct
121 Correct 363 ms 97924 KB Output is correct
122 Correct 376 ms 97920 KB Output is correct
123 Correct 377 ms 97888 KB Output is correct
124 Correct 378 ms 98036 KB Output is correct
125 Correct 313 ms 97868 KB Output is correct
126 Correct 303 ms 97780 KB Output is correct
127 Correct 217 ms 97636 KB Output is correct
128 Correct 169 ms 97684 KB Output is correct
129 Correct 360 ms 97868 KB Output is correct
130 Correct 362 ms 97824 KB Output is correct
131 Correct 389 ms 97948 KB Output is correct
132 Correct 421 ms 97904 KB Output is correct
133 Correct 380 ms 97880 KB Output is correct
134 Correct 415 ms 97888 KB Output is correct
135 Correct 319 ms 97824 KB Output is correct
136 Correct 268 ms 97732 KB Output is correct
137 Correct 185 ms 97620 KB Output is correct
138 Correct 192 ms 97636 KB Output is correct
139 Correct 146 ms 86448 KB Output is correct
140 Correct 129 ms 86340 KB Output is correct
141 Correct 161 ms 86420 KB Output is correct
142 Correct 128 ms 86348 KB Output is correct
143 Correct 134 ms 86368 KB Output is correct
144 Correct 129 ms 86360 KB Output is correct
145 Correct 127 ms 86348 KB Output is correct
146 Correct 130 ms 86396 KB Output is correct
147 Correct 132 ms 86416 KB Output is correct
148 Correct 130 ms 86364 KB Output is correct
149 Correct 125 ms 72088 KB Output is correct
150 Correct 108 ms 72040 KB Output is correct
151 Correct 112 ms 74688 KB Output is correct
152 Correct 109 ms 74128 KB Output is correct
153 Correct 341 ms 97852 KB Output is correct
154 Correct 215 ms 97740 KB Output is correct
155 Correct 172 ms 97692 KB Output is correct
156 Correct 359 ms 96516 KB Output is correct
157 Correct 231 ms 96372 KB Output is correct
158 Correct 135 ms 93640 KB Output is correct
159 Correct 92 ms 89028 KB Output is correct
160 Correct 90 ms 89036 KB Output is correct
161 Correct 46 ms 65988 KB Output is correct
162 Correct 47 ms 66052 KB Output is correct
163 Correct 177 ms 77872 KB Output is correct
164 Correct 123 ms 78160 KB Output is correct
165 Correct 345 ms 97944 KB Output is correct
166 Correct 429 ms 97668 KB Output is correct
167 Correct 362 ms 104264 KB Output is correct
168 Correct 354 ms 104132 KB Output is correct
169 Correct 364 ms 104156 KB Output is correct
170 Correct 344 ms 104204 KB Output is correct
171 Correct 98 ms 88644 KB Output is correct
172 Correct 99 ms 88732 KB Output is correct
173 Correct 94 ms 88720 KB Output is correct
174 Correct 682 ms 106784 KB Output is correct
175 Correct 676 ms 106756 KB Output is correct
176 Correct 708 ms 106788 KB Output is correct
177 Correct 700 ms 106744 KB Output is correct
178 Correct 714 ms 106884 KB Output is correct
179 Correct 686 ms 106732 KB Output is correct
180 Correct 661 ms 106788 KB Output is correct
181 Correct 661 ms 106788 KB Output is correct
182 Correct 686 ms 106820 KB Output is correct
183 Correct 418 ms 106416 KB Output is correct
184 Correct 658 ms 106756 KB Output is correct
185 Correct 686 ms 106832 KB Output is correct
186 Correct 692 ms 106804 KB Output is correct
187 Correct 702 ms 106784 KB Output is correct
188 Correct 707 ms 106676 KB Output is correct
189 Correct 687 ms 106764 KB Output is correct
190 Correct 647 ms 105456 KB Output is correct
191 Correct 666 ms 105528 KB Output is correct
192 Correct 567 ms 105180 KB Output is correct
193 Correct 367 ms 105060 KB Output is correct
194 Correct 279 ms 93748 KB Output is correct
195 Correct 276 ms 93600 KB Output is correct
196 Correct 296 ms 93572 KB Output is correct
197 Correct 289 ms 93552 KB Output is correct
198 Correct 328 ms 94328 KB Output is correct
199 Correct 291 ms 94400 KB Output is correct
200 Correct 303 ms 94284 KB Output is correct
201 Correct 311 ms 94336 KB Output is correct
202 Correct 325 ms 94444 KB Output is correct
203 Correct 176 ms 77932 KB Output is correct
204 Correct 182 ms 77904 KB Output is correct
205 Correct 174 ms 81616 KB Output is correct
206 Correct 177 ms 81356 KB Output is correct
207 Correct 727 ms 106944 KB Output is correct
208 Correct 671 ms 106620 KB Output is correct
209 Correct 398 ms 106388 KB Output is correct
210 Correct 648 ms 104124 KB Output is correct
211 Correct 364 ms 103696 KB Output is correct
212 Correct 255 ms 98380 KB Output is correct
213 Correct 409 ms 97924 KB Output is correct
214 Correct 430 ms 98192 KB Output is correct