Submission #800391

# Submission time Handle Problem Language Result Execution time Memory
800391 2023-08-01T14:07:26 Z MadokaMagicaFan Radio Towers (IOI22_towers) C++17
100 / 100
2135 ms 127036 KB
#include "bits/stdc++.h"

using namespace std;
using ll = long long;

#define sz(v) ((int)(v).size())
#define pb push_back

int n;
vector<int> h;
const int inf = 1e9+7;

struct aint {
	int n, neut;
	vector<int> f;
	int (*fn)(const int, const int);

	aint(int _n, int _neut, int (*_fn)(const int, const int)) {
		n = _n; neut = _neut;
		fn = _fn;
		f.assign(n<<1, neut);
	}

	int
	query(int l, int r)
	{
		int res = neut;
		for (l += n, r+=n+1; l < r; l>>=1, r>>=1) {
			if (l&1) res = fn(res, f[l++]);
			if (r&1) res = fn(res, f[--r]);
		}
		return res;
	}

	void
	upd(int x, int v) {
		x+=n;
		for (f[x] = v; x > 1; x>>=1) {
			f[x>>1] = fn(f[x], f[x^1]);
		}
	}
};

struct paint {
	int n, neut;
	int (*fn)(const int, const int);
	vector<array<int, 3>> f; /* val, l, r */
	int cn = 0;

	paint(int _n, int _neut, int (*_fn)(const int, const int))
	{
		fn = _fn;
		n = _n; neut = _neut;

		f.assign(max(20*n, (int)2e5), {neut, -1, -1});
	}

	void chkalloc() {if (cn == sz(f)) f.resize(sz(f)+max(n, 100)); }

	int newv(int val) {
		chkalloc();
		f[cn] = {val, -1, -1};
		return cn++;
	}

	int newv(int l, int r) {
		chkalloc();
		f[cn] = {fn(f[l][0], f[r][0]), l, r};
		return cn++;
	}

	int build(int l, int r) {
		if (l == r)
			return newv(neut);
		int tm = (l+r)>>1;
		return newv(build(l, tm), build(tm+1, r));
	}

	int query(int i, int l, int r) { return query(i, 0, n-1, l, r); }

	int query(int i, int l, int r, int tl, int tr) {
		if (l >= tl && r <= tr) return f[i][0];
		if (r < tl || l >= tr) return neut;
		assert(i >= 0);

		int m = (r + l) >> 1;
		return fn(query(f[i][1], l, m, tl, tr), query(f[i][2], m+1, r, tl, tr));
	}

	int upd(int i, int x, int v) { return upd(i, 0, n-1, x, v); }

	int upd(int i, int l, int r, int x, int v) {
		if (l == r) return newv(v);
		int m = (l + r)>>1;

		if (x <= m)
			return newv(upd(f[i][1], l, m, x, v), f[i][2]);
		else
			return newv(f[i][1], upd(f[i][2], m+1, r, x, v));
	}
};

aint *tmnh, *tmxh;
paint *p1, *p2, *p3; /* p1 = sum; p2 = left pos; p3 = right pos */
map<int, int> hpos, dind;
vector<array<int, 3>> edg;
set<int> deltas;

const int N = 1e5;
int ip1[N+5], ip2[N+5], ip3[N+5];
int ev[N+5];

int mn(int a, int b) { return min(a, b); }
int mx(int a, int b) { return max(a, b); }
int sm(int a, int b) { return a + b; }


int
max_towers(int l, int r, int d)
{
	if (l == r) return 1;
	if (l + 1 == r) return 1;

	auto it = deltas.lower_bound(d);
	if (it == deltas.end()) return 1;

	int x = dind[*it];

	int ans = 0;

	int v, z, u = p2->query(ip2[x], l, r);
	if (u <= r && u > l) {
		z = hpos[tmnh->query(l, u-1)];
		v = hpos[tmxh->query(l, u-1)];
		l = u;
		if (h[u] - h[z] >= d)
			++ans;
	}

	u = p3->query(ip3[x], l, r);
	if (u < r && u >= l) {
		z = hpos[tmnh->query(u+1, r)];
		v = hpos[tmxh->query(u+1, r)];
		r = u;
		if (h[u] - h[z] >= d)
			++ans;
	}

	if (l > r) return ans;
	ans += p1->query(ip1[x], l, r);

	return max(ans, 1);
}

void
dfs(int x, int l, int r) {
	int y, z;
	if (l == r) return;

	if (x > l)  {
		y = tmnh->query(l, x-1);
		z = hpos[tmxh->query(l, x-1)];

		edg.pb({h[x] - y, x, z});
		dfs(z, l, x-1);
	}

	if (x < r) {
		y = tmnh->query(x+1, r);
		z = hpos[tmxh->query(x+1, r)];

		edg.pb({h[x] - y, x, z});
		dfs(z, x+1, r);
	}
}

void
init(int _n, std::vector<int> _h)
{
	n = _n;
	h = _h;

	tmnh = new aint(n, inf+10, mn);
	tmxh = new aint(n, -1, mx);
	for (int i = 0; i < n; ++i) {
		tmnh->upd(i, h[i]);
		tmxh->upd(i, h[i]);
		hpos[h[i]] = i;
	}

	dfs(hpos[tmxh->query(0, n-1)], 0, n-1);

	sort(edg.begin(), edg.end());
	reverse(edg.begin(), edg.end());

	for (auto x : edg) {
		deltas.insert(x[0]);
		ev[x[2]] = x[0];
		dind[x[0]] = sz(deltas);
	}

	p1 = new paint(n, 0, sm);
	p2 = new paint(n, inf, mn);
	p3 = new paint(n, -1, mx);

	int lp1, lp2, lp3;
	lp1 = p1->build(0, n-1);
	lp2 = p2->build(0, n-1);
	lp3 = p3->build(0, n-1);

	for (auto x : edg) {
		lp1 = p1->upd(lp1, x[1], 0);
		lp1 = p1->upd(lp1, x[2], 1);

		if (x[1] < x[2]) {
			lp2 = p2->upd(lp2, x[1], x[1]);
		} else {
			lp3 = p3->upd(lp3, x[1], x[1]);
		}
		ip1[dind[x[0]]] = lp1;
		ip2[dind[x[0]]] = lp2;
		ip3[dind[x[0]]] = lp3;
	}
}

Compilation message

towers.cpp: In function 'int max_towers(int, int, int)':
towers.cpp:131:6: warning: variable 'v' set but not used [-Wunused-but-set-variable]
  131 |  int v, z, u = p2->query(ip2[x], l, r);
      |      ^
# Verdict Execution time Memory Grader output
1 Correct 606 ms 74476 KB Output is correct
2 Correct 1369 ms 126228 KB Output is correct
3 Correct 1396 ms 126316 KB Output is correct
4 Correct 1288 ms 126908 KB Output is correct
5 Correct 1196 ms 114352 KB Output is correct
6 Correct 1161 ms 126836 KB Output is correct
7 Correct 1227 ms 114372 KB Output is correct
8 Correct 3 ms 7248 KB Output is correct
9 Correct 5 ms 7760 KB Output is correct
10 Correct 5 ms 7760 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 7376 KB Output is correct
2 Correct 5 ms 7760 KB Output is correct
3 Correct 5 ms 7760 KB Output is correct
4 Correct 5 ms 7720 KB Output is correct
5 Correct 5 ms 7632 KB Output is correct
6 Correct 5 ms 7632 KB Output is correct
7 Correct 5 ms 7760 KB Output is correct
8 Correct 5 ms 7888 KB Output is correct
9 Correct 5 ms 7644 KB Output is correct
10 Correct 5 ms 7888 KB Output is correct
11 Correct 5 ms 7632 KB Output is correct
12 Correct 3 ms 7248 KB Output is correct
13 Correct 5 ms 7744 KB Output is correct
14 Correct 5 ms 7760 KB Output is correct
15 Correct 6 ms 7724 KB Output is correct
16 Correct 5 ms 7636 KB Output is correct
17 Correct 6 ms 7632 KB Output is correct
18 Correct 5 ms 7672 KB Output is correct
19 Correct 5 ms 7888 KB Output is correct
20 Correct 5 ms 7632 KB Output is correct
21 Correct 6 ms 7760 KB Output is correct
22 Correct 5 ms 7632 KB Output is correct
23 Correct 5 ms 7752 KB Output is correct
24 Correct 5 ms 7888 KB Output is correct
25 Correct 4 ms 7504 KB Output is correct
26 Correct 5 ms 7632 KB Output is correct
27 Correct 5 ms 7632 KB Output is correct
28 Correct 5 ms 7632 KB Output is correct
29 Correct 5 ms 7632 KB Output is correct
30 Correct 5 ms 7632 KB Output is correct
31 Correct 6 ms 7672 KB Output is correct
32 Correct 5 ms 7888 KB Output is correct
33 Correct 5 ms 7708 KB Output is correct
34 Correct 5 ms 7924 KB Output is correct
35 Correct 5 ms 7632 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 7376 KB Output is correct
2 Correct 5 ms 7760 KB Output is correct
3 Correct 5 ms 7760 KB Output is correct
4 Correct 5 ms 7720 KB Output is correct
5 Correct 5 ms 7632 KB Output is correct
6 Correct 5 ms 7632 KB Output is correct
7 Correct 5 ms 7760 KB Output is correct
8 Correct 5 ms 7888 KB Output is correct
9 Correct 5 ms 7644 KB Output is correct
10 Correct 5 ms 7888 KB Output is correct
11 Correct 5 ms 7632 KB Output is correct
12 Correct 3 ms 7248 KB Output is correct
13 Correct 5 ms 7744 KB Output is correct
14 Correct 5 ms 7760 KB Output is correct
15 Correct 6 ms 7724 KB Output is correct
16 Correct 5 ms 7636 KB Output is correct
17 Correct 6 ms 7632 KB Output is correct
18 Correct 5 ms 7672 KB Output is correct
19 Correct 5 ms 7888 KB Output is correct
20 Correct 5 ms 7632 KB Output is correct
21 Correct 6 ms 7760 KB Output is correct
22 Correct 5 ms 7632 KB Output is correct
23 Correct 5 ms 7752 KB Output is correct
24 Correct 5 ms 7888 KB Output is correct
25 Correct 4 ms 7504 KB Output is correct
26 Correct 5 ms 7632 KB Output is correct
27 Correct 5 ms 7632 KB Output is correct
28 Correct 5 ms 7632 KB Output is correct
29 Correct 5 ms 7632 KB Output is correct
30 Correct 5 ms 7632 KB Output is correct
31 Correct 6 ms 7672 KB Output is correct
32 Correct 5 ms 7888 KB Output is correct
33 Correct 5 ms 7708 KB Output is correct
34 Correct 5 ms 7924 KB Output is correct
35 Correct 5 ms 7632 KB Output is correct
36 Correct 174 ms 74596 KB Output is correct
37 Correct 281 ms 114424 KB Output is correct
38 Correct 290 ms 114352 KB Output is correct
39 Correct 278 ms 114344 KB Output is correct
40 Correct 289 ms 114432 KB Output is correct
41 Correct 279 ms 114376 KB Output is correct
42 Correct 280 ms 114360 KB Output is correct
43 Correct 206 ms 126824 KB Output is correct
44 Correct 197 ms 114400 KB Output is correct
45 Correct 207 ms 123408 KB Output is correct
46 Correct 206 ms 114376 KB Output is correct
47 Correct 281 ms 114388 KB Output is correct
48 Correct 288 ms 114380 KB Output is correct
49 Correct 284 ms 114372 KB Output is correct
50 Correct 196 ms 114364 KB Output is correct
51 Correct 223 ms 126652 KB Output is correct
52 Correct 293 ms 114372 KB Output is correct
53 Correct 286 ms 114328 KB Output is correct
54 Correct 287 ms 114376 KB Output is correct
55 Correct 200 ms 114372 KB Output is correct
56 Correct 208 ms 125828 KB Output is correct
57 Correct 270 ms 110476 KB Output is correct
58 Correct 280 ms 114364 KB Output is correct
59 Correct 284 ms 114324 KB Output is correct
60 Correct 281 ms 114428 KB Output is correct
61 Correct 319 ms 114356 KB Output is correct
62 Correct 296 ms 114316 KB Output is correct
63 Correct 296 ms 114408 KB Output is correct
64 Correct 206 ms 127024 KB Output is correct
65 Correct 202 ms 114388 KB Output is correct
66 Correct 211 ms 122180 KB Output is correct
67 Correct 198 ms 114392 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1271 ms 113528 KB Output is correct
2 Correct 1508 ms 114388 KB Output is correct
3 Correct 1242 ms 114308 KB Output is correct
4 Correct 1474 ms 114400 KB Output is correct
5 Correct 1346 ms 114308 KB Output is correct
6 Correct 1497 ms 114500 KB Output is correct
7 Correct 1479 ms 114344 KB Output is correct
8 Correct 1294 ms 126888 KB Output is correct
9 Correct 1091 ms 114344 KB Output is correct
10 Correct 1158 ms 123708 KB Output is correct
11 Correct 1211 ms 114432 KB Output is correct
12 Correct 1171 ms 126780 KB Output is correct
13 Correct 1108 ms 114312 KB Output is correct
14 Correct 3 ms 7376 KB Output is correct
15 Correct 5 ms 7760 KB Output is correct
16 Correct 5 ms 7716 KB Output is correct
17 Correct 292 ms 114408 KB Output is correct
18 Correct 292 ms 114392 KB Output is correct
19 Correct 280 ms 114364 KB Output is correct
20 Correct 199 ms 114364 KB Output is correct
21 Correct 212 ms 126620 KB Output is correct
22 Correct 285 ms 114400 KB Output is correct
23 Correct 286 ms 114320 KB Output is correct
24 Correct 289 ms 114372 KB Output is correct
25 Correct 206 ms 114468 KB Output is correct
26 Correct 208 ms 125736 KB Output is correct
27 Correct 5 ms 7760 KB Output is correct
28 Correct 5 ms 7660 KB Output is correct
29 Correct 6 ms 7760 KB Output is correct
30 Correct 5 ms 7632 KB Output is correct
31 Correct 5 ms 7888 KB Output is correct
32 Correct 5 ms 7632 KB Output is correct
33 Correct 5 ms 7748 KB Output is correct
34 Correct 6 ms 7760 KB Output is correct
35 Correct 5 ms 7716 KB Output is correct
36 Correct 5 ms 7888 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 347 ms 27580 KB Output is correct
2 Correct 1160 ms 114448 KB Output is correct
3 Correct 1169 ms 114364 KB Output is correct
4 Correct 1132 ms 114348 KB Output is correct
5 Correct 1293 ms 114320 KB Output is correct
6 Correct 1291 ms 114312 KB Output is correct
7 Correct 1114 ms 114328 KB Output is correct
8 Correct 984 ms 127036 KB Output is correct
9 Correct 830 ms 114320 KB Output is correct
10 Correct 1036 ms 121832 KB Output is correct
11 Correct 989 ms 114320 KB Output is correct
12 Correct 284 ms 114348 KB Output is correct
13 Correct 285 ms 114380 KB Output is correct
14 Correct 285 ms 114364 KB Output is correct
15 Correct 199 ms 114312 KB Output is correct
16 Correct 221 ms 125844 KB Output is correct
17 Correct 286 ms 110500 KB Output is correct
18 Correct 293 ms 114356 KB Output is correct
19 Correct 284 ms 114348 KB Output is correct
20 Correct 281 ms 114364 KB Output is correct
21 Correct 285 ms 114348 KB Output is correct
22 Correct 291 ms 114336 KB Output is correct
23 Correct 290 ms 114428 KB Output is correct
24 Correct 205 ms 126876 KB Output is correct
25 Correct 197 ms 114340 KB Output is correct
26 Correct 214 ms 121980 KB Output is correct
27 Correct 198 ms 114368 KB Output is correct
28 Correct 7 ms 7632 KB Output is correct
29 Correct 5 ms 7760 KB Output is correct
30 Correct 5 ms 7632 KB Output is correct
31 Correct 5 ms 7760 KB Output is correct
32 Correct 5 ms 7876 KB Output is correct
33 Correct 4 ms 7504 KB Output is correct
34 Correct 5 ms 7760 KB Output is correct
35 Correct 5 ms 7632 KB Output is correct
36 Correct 5 ms 7760 KB Output is correct
37 Correct 5 ms 7632 KB Output is correct
38 Correct 5 ms 7752 KB Output is correct
39 Correct 5 ms 7728 KB Output is correct
40 Correct 5 ms 7888 KB Output is correct
41 Correct 5 ms 7732 KB Output is correct
42 Correct 5 ms 7844 KB Output is correct
43 Correct 5 ms 7632 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 7376 KB Output is correct
2 Correct 5 ms 7760 KB Output is correct
3 Correct 5 ms 7760 KB Output is correct
4 Correct 5 ms 7720 KB Output is correct
5 Correct 5 ms 7632 KB Output is correct
6 Correct 5 ms 7632 KB Output is correct
7 Correct 5 ms 7760 KB Output is correct
8 Correct 5 ms 7888 KB Output is correct
9 Correct 5 ms 7644 KB Output is correct
10 Correct 5 ms 7888 KB Output is correct
11 Correct 5 ms 7632 KB Output is correct
12 Correct 3 ms 7248 KB Output is correct
13 Correct 5 ms 7744 KB Output is correct
14 Correct 5 ms 7760 KB Output is correct
15 Correct 6 ms 7724 KB Output is correct
16 Correct 5 ms 7636 KB Output is correct
17 Correct 6 ms 7632 KB Output is correct
18 Correct 5 ms 7672 KB Output is correct
19 Correct 5 ms 7888 KB Output is correct
20 Correct 5 ms 7632 KB Output is correct
21 Correct 6 ms 7760 KB Output is correct
22 Correct 5 ms 7632 KB Output is correct
23 Correct 5 ms 7752 KB Output is correct
24 Correct 5 ms 7888 KB Output is correct
25 Correct 4 ms 7504 KB Output is correct
26 Correct 5 ms 7632 KB Output is correct
27 Correct 5 ms 7632 KB Output is correct
28 Correct 5 ms 7632 KB Output is correct
29 Correct 5 ms 7632 KB Output is correct
30 Correct 5 ms 7632 KB Output is correct
31 Correct 6 ms 7672 KB Output is correct
32 Correct 5 ms 7888 KB Output is correct
33 Correct 5 ms 7708 KB Output is correct
34 Correct 5 ms 7924 KB Output is correct
35 Correct 5 ms 7632 KB Output is correct
36 Correct 174 ms 74596 KB Output is correct
37 Correct 281 ms 114424 KB Output is correct
38 Correct 290 ms 114352 KB Output is correct
39 Correct 278 ms 114344 KB Output is correct
40 Correct 289 ms 114432 KB Output is correct
41 Correct 279 ms 114376 KB Output is correct
42 Correct 280 ms 114360 KB Output is correct
43 Correct 206 ms 126824 KB Output is correct
44 Correct 197 ms 114400 KB Output is correct
45 Correct 207 ms 123408 KB Output is correct
46 Correct 206 ms 114376 KB Output is correct
47 Correct 281 ms 114388 KB Output is correct
48 Correct 288 ms 114380 KB Output is correct
49 Correct 284 ms 114372 KB Output is correct
50 Correct 196 ms 114364 KB Output is correct
51 Correct 223 ms 126652 KB Output is correct
52 Correct 293 ms 114372 KB Output is correct
53 Correct 286 ms 114328 KB Output is correct
54 Correct 287 ms 114376 KB Output is correct
55 Correct 200 ms 114372 KB Output is correct
56 Correct 208 ms 125828 KB Output is correct
57 Correct 270 ms 110476 KB Output is correct
58 Correct 280 ms 114364 KB Output is correct
59 Correct 284 ms 114324 KB Output is correct
60 Correct 281 ms 114428 KB Output is correct
61 Correct 319 ms 114356 KB Output is correct
62 Correct 296 ms 114316 KB Output is correct
63 Correct 296 ms 114408 KB Output is correct
64 Correct 206 ms 127024 KB Output is correct
65 Correct 202 ms 114388 KB Output is correct
66 Correct 211 ms 122180 KB Output is correct
67 Correct 198 ms 114392 KB Output is correct
68 Correct 1271 ms 113528 KB Output is correct
69 Correct 1508 ms 114388 KB Output is correct
70 Correct 1242 ms 114308 KB Output is correct
71 Correct 1474 ms 114400 KB Output is correct
72 Correct 1346 ms 114308 KB Output is correct
73 Correct 1497 ms 114500 KB Output is correct
74 Correct 1479 ms 114344 KB Output is correct
75 Correct 1294 ms 126888 KB Output is correct
76 Correct 1091 ms 114344 KB Output is correct
77 Correct 1158 ms 123708 KB Output is correct
78 Correct 1211 ms 114432 KB Output is correct
79 Correct 1171 ms 126780 KB Output is correct
80 Correct 1108 ms 114312 KB Output is correct
81 Correct 3 ms 7376 KB Output is correct
82 Correct 5 ms 7760 KB Output is correct
83 Correct 5 ms 7716 KB Output is correct
84 Correct 292 ms 114408 KB Output is correct
85 Correct 292 ms 114392 KB Output is correct
86 Correct 280 ms 114364 KB Output is correct
87 Correct 199 ms 114364 KB Output is correct
88 Correct 212 ms 126620 KB Output is correct
89 Correct 285 ms 114400 KB Output is correct
90 Correct 286 ms 114320 KB Output is correct
91 Correct 289 ms 114372 KB Output is correct
92 Correct 206 ms 114468 KB Output is correct
93 Correct 208 ms 125736 KB Output is correct
94 Correct 5 ms 7760 KB Output is correct
95 Correct 5 ms 7660 KB Output is correct
96 Correct 6 ms 7760 KB Output is correct
97 Correct 5 ms 7632 KB Output is correct
98 Correct 5 ms 7888 KB Output is correct
99 Correct 5 ms 7632 KB Output is correct
100 Correct 5 ms 7748 KB Output is correct
101 Correct 6 ms 7760 KB Output is correct
102 Correct 5 ms 7716 KB Output is correct
103 Correct 5 ms 7888 KB Output is correct
104 Correct 1082 ms 101548 KB Output is correct
105 Correct 1476 ms 114364 KB Output is correct
106 Correct 1529 ms 114404 KB Output is correct
107 Correct 1464 ms 114396 KB Output is correct
108 Correct 1379 ms 114384 KB Output is correct
109 Correct 1340 ms 114332 KB Output is correct
110 Correct 1244 ms 114344 KB Output is correct
111 Correct 1240 ms 126872 KB Output is correct
112 Correct 1091 ms 114348 KB Output is correct
113 Correct 1028 ms 124208 KB Output is correct
114 Correct 1123 ms 114368 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 606 ms 74476 KB Output is correct
2 Correct 1369 ms 126228 KB Output is correct
3 Correct 1396 ms 126316 KB Output is correct
4 Correct 1288 ms 126908 KB Output is correct
5 Correct 1196 ms 114352 KB Output is correct
6 Correct 1161 ms 126836 KB Output is correct
7 Correct 1227 ms 114372 KB Output is correct
8 Correct 3 ms 7248 KB Output is correct
9 Correct 5 ms 7760 KB Output is correct
10 Correct 5 ms 7760 KB Output is correct
11 Correct 3 ms 7376 KB Output is correct
12 Correct 5 ms 7760 KB Output is correct
13 Correct 5 ms 7760 KB Output is correct
14 Correct 5 ms 7720 KB Output is correct
15 Correct 5 ms 7632 KB Output is correct
16 Correct 5 ms 7632 KB Output is correct
17 Correct 5 ms 7760 KB Output is correct
18 Correct 5 ms 7888 KB Output is correct
19 Correct 5 ms 7644 KB Output is correct
20 Correct 5 ms 7888 KB Output is correct
21 Correct 5 ms 7632 KB Output is correct
22 Correct 3 ms 7248 KB Output is correct
23 Correct 5 ms 7744 KB Output is correct
24 Correct 5 ms 7760 KB Output is correct
25 Correct 6 ms 7724 KB Output is correct
26 Correct 5 ms 7636 KB Output is correct
27 Correct 6 ms 7632 KB Output is correct
28 Correct 5 ms 7672 KB Output is correct
29 Correct 5 ms 7888 KB Output is correct
30 Correct 5 ms 7632 KB Output is correct
31 Correct 6 ms 7760 KB Output is correct
32 Correct 5 ms 7632 KB Output is correct
33 Correct 5 ms 7752 KB Output is correct
34 Correct 5 ms 7888 KB Output is correct
35 Correct 4 ms 7504 KB Output is correct
36 Correct 5 ms 7632 KB Output is correct
37 Correct 5 ms 7632 KB Output is correct
38 Correct 5 ms 7632 KB Output is correct
39 Correct 5 ms 7632 KB Output is correct
40 Correct 5 ms 7632 KB Output is correct
41 Correct 6 ms 7672 KB Output is correct
42 Correct 5 ms 7888 KB Output is correct
43 Correct 5 ms 7708 KB Output is correct
44 Correct 5 ms 7924 KB Output is correct
45 Correct 5 ms 7632 KB Output is correct
46 Correct 174 ms 74596 KB Output is correct
47 Correct 281 ms 114424 KB Output is correct
48 Correct 290 ms 114352 KB Output is correct
49 Correct 278 ms 114344 KB Output is correct
50 Correct 289 ms 114432 KB Output is correct
51 Correct 279 ms 114376 KB Output is correct
52 Correct 280 ms 114360 KB Output is correct
53 Correct 206 ms 126824 KB Output is correct
54 Correct 197 ms 114400 KB Output is correct
55 Correct 207 ms 123408 KB Output is correct
56 Correct 206 ms 114376 KB Output is correct
57 Correct 281 ms 114388 KB Output is correct
58 Correct 288 ms 114380 KB Output is correct
59 Correct 284 ms 114372 KB Output is correct
60 Correct 196 ms 114364 KB Output is correct
61 Correct 223 ms 126652 KB Output is correct
62 Correct 293 ms 114372 KB Output is correct
63 Correct 286 ms 114328 KB Output is correct
64 Correct 287 ms 114376 KB Output is correct
65 Correct 200 ms 114372 KB Output is correct
66 Correct 208 ms 125828 KB Output is correct
67 Correct 270 ms 110476 KB Output is correct
68 Correct 280 ms 114364 KB Output is correct
69 Correct 284 ms 114324 KB Output is correct
70 Correct 281 ms 114428 KB Output is correct
71 Correct 319 ms 114356 KB Output is correct
72 Correct 296 ms 114316 KB Output is correct
73 Correct 296 ms 114408 KB Output is correct
74 Correct 206 ms 127024 KB Output is correct
75 Correct 202 ms 114388 KB Output is correct
76 Correct 211 ms 122180 KB Output is correct
77 Correct 198 ms 114392 KB Output is correct
78 Correct 1271 ms 113528 KB Output is correct
79 Correct 1508 ms 114388 KB Output is correct
80 Correct 1242 ms 114308 KB Output is correct
81 Correct 1474 ms 114400 KB Output is correct
82 Correct 1346 ms 114308 KB Output is correct
83 Correct 1497 ms 114500 KB Output is correct
84 Correct 1479 ms 114344 KB Output is correct
85 Correct 1294 ms 126888 KB Output is correct
86 Correct 1091 ms 114344 KB Output is correct
87 Correct 1158 ms 123708 KB Output is correct
88 Correct 1211 ms 114432 KB Output is correct
89 Correct 1171 ms 126780 KB Output is correct
90 Correct 1108 ms 114312 KB Output is correct
91 Correct 3 ms 7376 KB Output is correct
92 Correct 5 ms 7760 KB Output is correct
93 Correct 5 ms 7716 KB Output is correct
94 Correct 292 ms 114408 KB Output is correct
95 Correct 292 ms 114392 KB Output is correct
96 Correct 280 ms 114364 KB Output is correct
97 Correct 199 ms 114364 KB Output is correct
98 Correct 212 ms 126620 KB Output is correct
99 Correct 285 ms 114400 KB Output is correct
100 Correct 286 ms 114320 KB Output is correct
101 Correct 289 ms 114372 KB Output is correct
102 Correct 206 ms 114468 KB Output is correct
103 Correct 208 ms 125736 KB Output is correct
104 Correct 5 ms 7760 KB Output is correct
105 Correct 5 ms 7660 KB Output is correct
106 Correct 6 ms 7760 KB Output is correct
107 Correct 5 ms 7632 KB Output is correct
108 Correct 5 ms 7888 KB Output is correct
109 Correct 5 ms 7632 KB Output is correct
110 Correct 5 ms 7748 KB Output is correct
111 Correct 6 ms 7760 KB Output is correct
112 Correct 5 ms 7716 KB Output is correct
113 Correct 5 ms 7888 KB Output is correct
114 Correct 347 ms 27580 KB Output is correct
115 Correct 1160 ms 114448 KB Output is correct
116 Correct 1169 ms 114364 KB Output is correct
117 Correct 1132 ms 114348 KB Output is correct
118 Correct 1293 ms 114320 KB Output is correct
119 Correct 1291 ms 114312 KB Output is correct
120 Correct 1114 ms 114328 KB Output is correct
121 Correct 984 ms 127036 KB Output is correct
122 Correct 830 ms 114320 KB Output is correct
123 Correct 1036 ms 121832 KB Output is correct
124 Correct 989 ms 114320 KB Output is correct
125 Correct 284 ms 114348 KB Output is correct
126 Correct 285 ms 114380 KB Output is correct
127 Correct 285 ms 114364 KB Output is correct
128 Correct 199 ms 114312 KB Output is correct
129 Correct 221 ms 125844 KB Output is correct
130 Correct 286 ms 110500 KB Output is correct
131 Correct 293 ms 114356 KB Output is correct
132 Correct 284 ms 114348 KB Output is correct
133 Correct 281 ms 114364 KB Output is correct
134 Correct 285 ms 114348 KB Output is correct
135 Correct 291 ms 114336 KB Output is correct
136 Correct 290 ms 114428 KB Output is correct
137 Correct 205 ms 126876 KB Output is correct
138 Correct 197 ms 114340 KB Output is correct
139 Correct 214 ms 121980 KB Output is correct
140 Correct 198 ms 114368 KB Output is correct
141 Correct 7 ms 7632 KB Output is correct
142 Correct 5 ms 7760 KB Output is correct
143 Correct 5 ms 7632 KB Output is correct
144 Correct 5 ms 7760 KB Output is correct
145 Correct 5 ms 7876 KB Output is correct
146 Correct 4 ms 7504 KB Output is correct
147 Correct 5 ms 7760 KB Output is correct
148 Correct 5 ms 7632 KB Output is correct
149 Correct 5 ms 7760 KB Output is correct
150 Correct 5 ms 7632 KB Output is correct
151 Correct 5 ms 7752 KB Output is correct
152 Correct 5 ms 7728 KB Output is correct
153 Correct 5 ms 7888 KB Output is correct
154 Correct 5 ms 7732 KB Output is correct
155 Correct 5 ms 7844 KB Output is correct
156 Correct 5 ms 7632 KB Output is correct
157 Correct 1082 ms 101548 KB Output is correct
158 Correct 1476 ms 114364 KB Output is correct
159 Correct 1529 ms 114404 KB Output is correct
160 Correct 1464 ms 114396 KB Output is correct
161 Correct 1379 ms 114384 KB Output is correct
162 Correct 1340 ms 114332 KB Output is correct
163 Correct 1244 ms 114344 KB Output is correct
164 Correct 1240 ms 126872 KB Output is correct
165 Correct 1091 ms 114348 KB Output is correct
166 Correct 1028 ms 124208 KB Output is correct
167 Correct 1123 ms 114368 KB Output is correct
168 Correct 3 ms 7248 KB Output is correct
169 Correct 968 ms 39824 KB Output is correct
170 Correct 2133 ms 114360 KB Output is correct
171 Correct 2135 ms 114352 KB Output is correct
172 Correct 2048 ms 114328 KB Output is correct
173 Correct 2041 ms 114360 KB Output is correct
174 Correct 2028 ms 114316 KB Output is correct
175 Correct 2093 ms 114408 KB Output is correct
176 Correct 1347 ms 126872 KB Output is correct
177 Correct 1229 ms 114364 KB Output is correct
178 Correct 1450 ms 122296 KB Output is correct
179 Correct 1423 ms 114312 KB Output is correct