Submission #749095

# Submission time Handle Problem Language Result Execution time Memory
749095 2023-05-27T10:01:25 Z alex_2008 Radio Towers (IOI22_towers) C++17
100 / 100
2240 ms 188828 KB
#include "towers.h"
#include <iostream>
#include <vector>
#include <cmath>
#include <set>
#include <algorithm>
using namespace std;
int ind = -1;
bool ch = true;
vector <int> h;
const int N = 100100, M = 20;
struct Node {
	int val;
	int left;
	int right;
	Node* ls;
	Node* rs;
};
Node* roots[N];
int tree[4 * N], maxim[4 * N], minim[4 * N], mx[N][M], LS[N], RS[N];
int tree2[4 * N], maxim2[4 * N], minim2[4 * N];
int minnumber = 2e9, answer_for_another_tree = 0, maxnumber = 0;
void build_another_tree(int v, int tl, int tr) {
	if (tl == tr) {
		maxim[v] = h[tl];
		minim[v] = h[tl];
		tree[v] = 0;
	}
	else {
		int tm = (tl + tr) / 2;
		build_another_tree(2 * v, tl, tm);
		build_another_tree(2 * v + 1, tm + 1, tr);
		maxim[v] = max({ maxim[2 * v], maxim[2 * v + 1] });
		minim[v] = min({ minim[2 * v], minim[2 * v + 1] });
		tree[v] = max({ tree[2 * v], tree[2 * v + 1], maxim[2 * v + 1] - minim[2 * v] });
	}
}
void query_in_another_tree(int v, int tl, int tr, int l, int r) {
	if (tr < l || tl > r) return;
	if (tl >= l && tr <= r) {
		answer_for_another_tree = max({ answer_for_another_tree, tree[v], maxim[v] - minnumber});
		minnumber = min(minnumber, minim[v]);
		return;
	}
	int tm = (tl + tr) / 2;
	query_in_another_tree(2 * v, tl, tm, l, r);
	query_in_another_tree(2 * v + 1, tm + 1, tr, l, r);
}
void build_another_tree2(int v, int tl, int tr) {
	if (tl == tr) {
		maxim2[v] = h[tl];
		minim2[v] = h[tl];
		tree2[v] = 0;
	}
	else {
		int tm = (tl + tr) / 2;
		build_another_tree2(2 * v, tl, tm);
		build_another_tree2(2 * v + 1, tm + 1, tr);
		maxim2[v] = max({ maxim2[2 * v], maxim2[2 * v + 1] });
		minim2[v] = min({ minim2[2 * v], minim2[2 * v + 1] });
		tree2[v] = max({ tree2[2 * v], tree2[2 * v + 1], maxim2[2 * v] - minim2[2 * v + 1] });
	}
}
void query_in_another_tree2(int v, int tl, int tr, int l, int r) {
	if (tr < l || tl > r) return;
	if (tl >= l && tr <= r) {
		answer_for_another_tree = max({ answer_for_another_tree, tree2[v], maxnumber - minim2[v] });
		maxnumber = max(maxnumber, maxim2[v]);
		return;
	}
	int tm = (tl + tr) / 2;
	query_in_another_tree2(2 * v, tl, tm, l, r);
	query_in_another_tree2(2 * v + 1, tm + 1, tr, l, r);
}
void build_tree(Node* v) {
	if (v->left == v->right) {
		v->val = 1;
		return;
	}
	else {
		int tm = (v->left + v->right) / 2;
		Node* ls = new Node{ 0, v->left, tm, nullptr, nullptr };
		Node* rs = new Node{ 0, tm + 1, v->right, nullptr, nullptr };
		build_tree(ls);
		build_tree(rs);
		v->ls = ls;
		v->rs = rs;
		v->val = ls->val + rs->val;
	}
}
void update(Node* old, Node* neww, int pos) {
	*neww = *old;
	if (neww->left > pos || neww->right < pos) return;
	if (neww->left == neww->right) {
		neww->val = 0;
		return;
	}
	int tm = (neww->left + neww->right) / 2;
	Node* ls = new Node{ 0, neww->left, tm, nullptr, nullptr };
	Node* rs = new Node{ 0, tm + 1, neww->right, nullptr, nullptr };
	update(old->ls, ls, pos);
	update(old->rs, rs, pos);
	neww->ls = ls;
	neww->rs = rs;
	neww->val = ls->val + rs->val;
}
int ql = 2e9, qr = -1;
void query1(Node* v, int l) {
	if (v->right < l) return;
	if (v->left >= l) {
		if (v->val > 0) {
			while (v->left != v->right) {
				if (v->ls->val > 0) {
					v = v->ls;
				}
				else v = v->rs;
			}
			ql = min(ql, v->left);
		}
		return;
	}
	query1(v->ls, l);
	query1(v->rs, l);
}
void query2(Node* v, int r) {
	if (v->left > r) return;
	if (v->right <= r) {
		if (v->val > 0) {
			while (v->left != v->right) {
				if (v->rs->val > 0) {
					v = v->rs;
				}
				else v = v->ls;
			}
			qr = max(qr, v->left);
		}
		return;
	}
	query2(v->ls, r);
	query2(v->rs, r);
}
int query3(Node* v, int l, int r) {
	if (v->left > r || v->right < l) return 0;
	if (v->left >= l && v->right <= r) return v->val;
	return query3(v->ls, l, r) +
		query3(v->rs, l, r);
}
vector <pair<int, int>> esim;
int findmaxinrange(int L, int R) {
	if (L > R) return 0;
	int u = log2(R - L + 1);
	return max(mx[L][u], mx[R - (1 << u) + 1][u]);
}
void init(int n, vector<int> a) {
	ch = true;
	h = a;
	LS[0] = -1;
	RS[n - 1] = -1;
	for (int i = 1; i < n; i++) {
		int v = i - 1;
		while (v != -1 && a[i] < a[v]) {
			v = LS[v];
		}
		LS[i] = v;
	}
	for (int i = n - 2; i >= 0; i--) {
		int v = i + 1;
		while (v != -1 && a[i] < a[v]) {
			v = RS[v];
		}
		RS[i] = v;
	}
	for (int i = 0; i < n; i++) {
		mx[i][0] = a[i];
	}
	for (int j = 1; j < 20; j++) {
		for (int i = n - 1; i >= 0; i--) {
			mx[i][j] = max(mx[i][j - 1], mx[min(n - 1, i + (1 << (j - 1)))][j - 1]);
		}
	}
	for (int i = 0; i < n; i++) {
		int hmn = 2e9;
		if (LS[i] != -1) {
			hmn = min(hmn, findmaxinrange(LS[i] + 1, i - 1));
		}
		if (RS[i] != -1) {
			hmn = min(hmn, findmaxinrange(i + 1, RS[i] - 1));
		}
		int u = hmn - a[i];
		esim.push_back({ u, i });
	}
	sort(esim.begin(), esim.end());
	roots[0] = new Node{ 0, 0, n - 1, nullptr, nullptr };
	build_tree(roots[0]);
	for (int i = 1; i < n; i++) {
		roots[i] = new Node{ 0, 0, n - 1, nullptr, nullptr };
		update(roots[i - 1], roots[i], esim[i - 1].second);
	}
	build_another_tree(1, 0, n - 1);
  	build_another_tree2(1, 0, n - 1);
}
int max_towers(int L, int R, int D) {
	int n = (int)h.size();
	int left = 0, right = n - 1, answ = -1;
	while (left <= right) {
		int mid = (left + right) / 2;
		if (esim[mid].first >= D) {
			answ = mid;
			right = mid - 1;
		}
		else left = mid + 1;
	}
	if (answ == -1) return 1;
	int ans = query3(roots[answ], L, R);
	ql = 2e9;
	qr = -1;
	query1(roots[answ], L);
	query2(roots[answ], R);
	minnumber = 2e9;
	answer_for_another_tree = 0;
	if (ql != 2e9) {
		int left = L, right = ql - 1, r__ = -1;
		while (left <= right) {
			int mid = (left + right) / 2;
			if (findmaxinrange(mid, ql) - h[ql] >= D) {
				r__ = mid;
				left = mid + 1;
			}
			else right = mid - 1;
		}
		if (r__ != -1) {
			query_in_another_tree(1, 0, n - 1, L, r__);
			if (answer_for_another_tree >= D) ++ans;
		}
	}
	maxnumber = 0;
	answer_for_another_tree = 0;
	if (qr != -1) {
		int left = qr + 1, right = R, r__ = -1;
		while (left <= right) {
			int mid = (left + right) / 2;
			if (findmaxinrange(qr, mid) - h[qr] >= D) {
				r__ = mid;
				right = mid - 1;
			}
			else left = mid + 1;
		}
		if (r__ != -1) {
			query_in_another_tree2(1, 0, n - 1, r__, R);
			if (answer_for_another_tree >= D) ++ans;
		}
	}
	if (ans == 0) ++ans;
	return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 796 ms 107692 KB Output is correct
2 Correct 1710 ms 188696 KB Output is correct
3 Correct 1745 ms 188776 KB Output is correct
4 Correct 1459 ms 188656 KB Output is correct
5 Correct 1310 ms 188716 KB Output is correct
6 Correct 1311 ms 188696 KB Output is correct
7 Correct 1391 ms 188644 KB Output is correct
8 Correct 0 ms 336 KB Output is correct
9 Correct 3 ms 3000 KB Output is correct
10 Correct 3 ms 3024 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 848 KB Output is correct
2 Correct 3 ms 3024 KB Output is correct
3 Correct 5 ms 3024 KB Output is correct
4 Correct 3 ms 2896 KB Output is correct
5 Correct 3 ms 2896 KB Output is correct
6 Correct 3 ms 3024 KB Output is correct
7 Correct 4 ms 2928 KB Output is correct
8 Correct 4 ms 3024 KB Output is correct
9 Correct 3 ms 2896 KB Output is correct
10 Correct 3 ms 3024 KB Output is correct
11 Correct 3 ms 3024 KB Output is correct
12 Correct 0 ms 336 KB Output is correct
13 Correct 3 ms 2984 KB Output is correct
14 Correct 3 ms 3024 KB Output is correct
15 Correct 4 ms 3024 KB Output is correct
16 Correct 3 ms 2940 KB Output is correct
17 Correct 4 ms 3024 KB Output is correct
18 Correct 3 ms 2896 KB Output is correct
19 Correct 5 ms 3140 KB Output is correct
20 Correct 4 ms 3024 KB Output is correct
21 Correct 3 ms 2896 KB Output is correct
22 Correct 3 ms 2896 KB Output is correct
23 Correct 3 ms 3024 KB Output is correct
24 Correct 3 ms 3024 KB Output is correct
25 Correct 2 ms 1360 KB Output is correct
26 Correct 3 ms 3024 KB Output is correct
27 Correct 4 ms 3024 KB Output is correct
28 Correct 4 ms 3024 KB Output is correct
29 Correct 3 ms 3024 KB Output is correct
30 Correct 3 ms 2896 KB Output is correct
31 Correct 4 ms 3024 KB Output is correct
32 Correct 3 ms 3024 KB Output is correct
33 Correct 3 ms 3024 KB Output is correct
34 Correct 3 ms 3024 KB Output is correct
35 Correct 3 ms 3024 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 848 KB Output is correct
2 Correct 3 ms 3024 KB Output is correct
3 Correct 5 ms 3024 KB Output is correct
4 Correct 3 ms 2896 KB Output is correct
5 Correct 3 ms 2896 KB Output is correct
6 Correct 3 ms 3024 KB Output is correct
7 Correct 4 ms 2928 KB Output is correct
8 Correct 4 ms 3024 KB Output is correct
9 Correct 3 ms 2896 KB Output is correct
10 Correct 3 ms 3024 KB Output is correct
11 Correct 3 ms 3024 KB Output is correct
12 Correct 0 ms 336 KB Output is correct
13 Correct 3 ms 2984 KB Output is correct
14 Correct 3 ms 3024 KB Output is correct
15 Correct 4 ms 3024 KB Output is correct
16 Correct 3 ms 2940 KB Output is correct
17 Correct 4 ms 3024 KB Output is correct
18 Correct 3 ms 2896 KB Output is correct
19 Correct 5 ms 3140 KB Output is correct
20 Correct 4 ms 3024 KB Output is correct
21 Correct 3 ms 2896 KB Output is correct
22 Correct 3 ms 2896 KB Output is correct
23 Correct 3 ms 3024 KB Output is correct
24 Correct 3 ms 3024 KB Output is correct
25 Correct 2 ms 1360 KB Output is correct
26 Correct 3 ms 3024 KB Output is correct
27 Correct 4 ms 3024 KB Output is correct
28 Correct 4 ms 3024 KB Output is correct
29 Correct 3 ms 3024 KB Output is correct
30 Correct 3 ms 2896 KB Output is correct
31 Correct 4 ms 3024 KB Output is correct
32 Correct 3 ms 3024 KB Output is correct
33 Correct 3 ms 3024 KB Output is correct
34 Correct 3 ms 3024 KB Output is correct
35 Correct 3 ms 3024 KB Output is correct
36 Correct 158 ms 117656 KB Output is correct
37 Correct 237 ms 188604 KB Output is correct
38 Correct 254 ms 188668 KB Output is correct
39 Correct 270 ms 188720 KB Output is correct
40 Correct 232 ms 188828 KB Output is correct
41 Correct 235 ms 188576 KB Output is correct
42 Correct 238 ms 188636 KB Output is correct
43 Correct 193 ms 188672 KB Output is correct
44 Correct 195 ms 188564 KB Output is correct
45 Correct 186 ms 188644 KB Output is correct
46 Correct 187 ms 188616 KB Output is correct
47 Correct 239 ms 188632 KB Output is correct
48 Correct 242 ms 188696 KB Output is correct
49 Correct 225 ms 188604 KB Output is correct
50 Correct 190 ms 188624 KB Output is correct
51 Correct 195 ms 188604 KB Output is correct
52 Correct 230 ms 188660 KB Output is correct
53 Correct 236 ms 188696 KB Output is correct
54 Correct 267 ms 188684 KB Output is correct
55 Correct 178 ms 188584 KB Output is correct
56 Correct 198 ms 188612 KB Output is correct
57 Correct 231 ms 182140 KB Output is correct
58 Correct 244 ms 188568 KB Output is correct
59 Correct 252 ms 188576 KB Output is correct
60 Correct 240 ms 188604 KB Output is correct
61 Correct 230 ms 188608 KB Output is correct
62 Correct 234 ms 188604 KB Output is correct
63 Correct 241 ms 188600 KB Output is correct
64 Correct 199 ms 188648 KB Output is correct
65 Correct 186 ms 188636 KB Output is correct
66 Correct 200 ms 188640 KB Output is correct
67 Correct 190 ms 188608 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1378 ms 187228 KB Output is correct
2 Correct 1689 ms 188620 KB Output is correct
3 Correct 1733 ms 188728 KB Output is correct
4 Correct 1577 ms 188692 KB Output is correct
5 Correct 1512 ms 188668 KB Output is correct
6 Correct 1540 ms 188684 KB Output is correct
7 Correct 1567 ms 188604 KB Output is correct
8 Correct 1290 ms 188636 KB Output is correct
9 Correct 1282 ms 188576 KB Output is correct
10 Correct 1472 ms 188624 KB Output is correct
11 Correct 1701 ms 188608 KB Output is correct
12 Correct 1433 ms 188628 KB Output is correct
13 Correct 1357 ms 188584 KB Output is correct
14 Correct 0 ms 336 KB Output is correct
15 Correct 3 ms 3024 KB Output is correct
16 Correct 3 ms 2896 KB Output is correct
17 Correct 243 ms 188716 KB Output is correct
18 Correct 239 ms 188592 KB Output is correct
19 Correct 226 ms 188568 KB Output is correct
20 Correct 181 ms 188604 KB Output is correct
21 Correct 184 ms 188564 KB Output is correct
22 Correct 258 ms 188644 KB Output is correct
23 Correct 235 ms 188684 KB Output is correct
24 Correct 239 ms 188604 KB Output is correct
25 Correct 191 ms 188696 KB Output is correct
26 Correct 188 ms 188652 KB Output is correct
27 Correct 4 ms 2896 KB Output is correct
28 Correct 3 ms 2940 KB Output is correct
29 Correct 3 ms 3024 KB Output is correct
30 Correct 5 ms 3024 KB Output is correct
31 Correct 3 ms 3024 KB Output is correct
32 Correct 3 ms 2896 KB Output is correct
33 Correct 4 ms 3024 KB Output is correct
34 Correct 3 ms 3024 KB Output is correct
35 Correct 3 ms 2896 KB Output is correct
36 Correct 3 ms 2896 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 319 ms 40736 KB Output is correct
2 Correct 1283 ms 188764 KB Output is correct
3 Correct 1185 ms 188696 KB Output is correct
4 Correct 1363 ms 188640 KB Output is correct
5 Correct 1299 ms 188676 KB Output is correct
6 Correct 1264 ms 188700 KB Output is correct
7 Correct 1368 ms 188608 KB Output is correct
8 Correct 1149 ms 188748 KB Output is correct
9 Correct 1162 ms 188568 KB Output is correct
10 Correct 1091 ms 188736 KB Output is correct
11 Correct 1149 ms 188604 KB Output is correct
12 Correct 254 ms 188696 KB Output is correct
13 Correct 227 ms 188688 KB Output is correct
14 Correct 237 ms 188628 KB Output is correct
15 Correct 185 ms 188812 KB Output is correct
16 Correct 197 ms 188628 KB Output is correct
17 Correct 233 ms 182048 KB Output is correct
18 Correct 242 ms 188732 KB Output is correct
19 Correct 229 ms 188688 KB Output is correct
20 Correct 259 ms 188664 KB Output is correct
21 Correct 236 ms 188796 KB Output is correct
22 Correct 237 ms 188696 KB Output is correct
23 Correct 225 ms 188760 KB Output is correct
24 Correct 191 ms 188692 KB Output is correct
25 Correct 188 ms 188692 KB Output is correct
26 Correct 198 ms 188644 KB Output is correct
27 Correct 207 ms 188652 KB Output is correct
28 Correct 4 ms 2980 KB Output is correct
29 Correct 4 ms 2936 KB Output is correct
30 Correct 4 ms 3024 KB Output is correct
31 Correct 3 ms 3024 KB Output is correct
32 Correct 4 ms 3024 KB Output is correct
33 Correct 2 ms 1360 KB Output is correct
34 Correct 3 ms 2896 KB Output is correct
35 Correct 4 ms 2924 KB Output is correct
36 Correct 4 ms 2932 KB Output is correct
37 Correct 4 ms 3024 KB Output is correct
38 Correct 4 ms 3024 KB Output is correct
39 Correct 4 ms 3024 KB Output is correct
40 Correct 3 ms 3024 KB Output is correct
41 Correct 3 ms 3024 KB Output is correct
42 Correct 5 ms 2896 KB Output is correct
43 Correct 3 ms 3024 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 848 KB Output is correct
2 Correct 3 ms 3024 KB Output is correct
3 Correct 5 ms 3024 KB Output is correct
4 Correct 3 ms 2896 KB Output is correct
5 Correct 3 ms 2896 KB Output is correct
6 Correct 3 ms 3024 KB Output is correct
7 Correct 4 ms 2928 KB Output is correct
8 Correct 4 ms 3024 KB Output is correct
9 Correct 3 ms 2896 KB Output is correct
10 Correct 3 ms 3024 KB Output is correct
11 Correct 3 ms 3024 KB Output is correct
12 Correct 0 ms 336 KB Output is correct
13 Correct 3 ms 2984 KB Output is correct
14 Correct 3 ms 3024 KB Output is correct
15 Correct 4 ms 3024 KB Output is correct
16 Correct 3 ms 2940 KB Output is correct
17 Correct 4 ms 3024 KB Output is correct
18 Correct 3 ms 2896 KB Output is correct
19 Correct 5 ms 3140 KB Output is correct
20 Correct 4 ms 3024 KB Output is correct
21 Correct 3 ms 2896 KB Output is correct
22 Correct 3 ms 2896 KB Output is correct
23 Correct 3 ms 3024 KB Output is correct
24 Correct 3 ms 3024 KB Output is correct
25 Correct 2 ms 1360 KB Output is correct
26 Correct 3 ms 3024 KB Output is correct
27 Correct 4 ms 3024 KB Output is correct
28 Correct 4 ms 3024 KB Output is correct
29 Correct 3 ms 3024 KB Output is correct
30 Correct 3 ms 2896 KB Output is correct
31 Correct 4 ms 3024 KB Output is correct
32 Correct 3 ms 3024 KB Output is correct
33 Correct 3 ms 3024 KB Output is correct
34 Correct 3 ms 3024 KB Output is correct
35 Correct 3 ms 3024 KB Output is correct
36 Correct 158 ms 117656 KB Output is correct
37 Correct 237 ms 188604 KB Output is correct
38 Correct 254 ms 188668 KB Output is correct
39 Correct 270 ms 188720 KB Output is correct
40 Correct 232 ms 188828 KB Output is correct
41 Correct 235 ms 188576 KB Output is correct
42 Correct 238 ms 188636 KB Output is correct
43 Correct 193 ms 188672 KB Output is correct
44 Correct 195 ms 188564 KB Output is correct
45 Correct 186 ms 188644 KB Output is correct
46 Correct 187 ms 188616 KB Output is correct
47 Correct 239 ms 188632 KB Output is correct
48 Correct 242 ms 188696 KB Output is correct
49 Correct 225 ms 188604 KB Output is correct
50 Correct 190 ms 188624 KB Output is correct
51 Correct 195 ms 188604 KB Output is correct
52 Correct 230 ms 188660 KB Output is correct
53 Correct 236 ms 188696 KB Output is correct
54 Correct 267 ms 188684 KB Output is correct
55 Correct 178 ms 188584 KB Output is correct
56 Correct 198 ms 188612 KB Output is correct
57 Correct 231 ms 182140 KB Output is correct
58 Correct 244 ms 188568 KB Output is correct
59 Correct 252 ms 188576 KB Output is correct
60 Correct 240 ms 188604 KB Output is correct
61 Correct 230 ms 188608 KB Output is correct
62 Correct 234 ms 188604 KB Output is correct
63 Correct 241 ms 188600 KB Output is correct
64 Correct 199 ms 188648 KB Output is correct
65 Correct 186 ms 188636 KB Output is correct
66 Correct 200 ms 188640 KB Output is correct
67 Correct 190 ms 188608 KB Output is correct
68 Correct 1378 ms 187228 KB Output is correct
69 Correct 1689 ms 188620 KB Output is correct
70 Correct 1733 ms 188728 KB Output is correct
71 Correct 1577 ms 188692 KB Output is correct
72 Correct 1512 ms 188668 KB Output is correct
73 Correct 1540 ms 188684 KB Output is correct
74 Correct 1567 ms 188604 KB Output is correct
75 Correct 1290 ms 188636 KB Output is correct
76 Correct 1282 ms 188576 KB Output is correct
77 Correct 1472 ms 188624 KB Output is correct
78 Correct 1701 ms 188608 KB Output is correct
79 Correct 1433 ms 188628 KB Output is correct
80 Correct 1357 ms 188584 KB Output is correct
81 Correct 0 ms 336 KB Output is correct
82 Correct 3 ms 3024 KB Output is correct
83 Correct 3 ms 2896 KB Output is correct
84 Correct 243 ms 188716 KB Output is correct
85 Correct 239 ms 188592 KB Output is correct
86 Correct 226 ms 188568 KB Output is correct
87 Correct 181 ms 188604 KB Output is correct
88 Correct 184 ms 188564 KB Output is correct
89 Correct 258 ms 188644 KB Output is correct
90 Correct 235 ms 188684 KB Output is correct
91 Correct 239 ms 188604 KB Output is correct
92 Correct 191 ms 188696 KB Output is correct
93 Correct 188 ms 188652 KB Output is correct
94 Correct 4 ms 2896 KB Output is correct
95 Correct 3 ms 2940 KB Output is correct
96 Correct 3 ms 3024 KB Output is correct
97 Correct 5 ms 3024 KB Output is correct
98 Correct 3 ms 3024 KB Output is correct
99 Correct 3 ms 2896 KB Output is correct
100 Correct 4 ms 3024 KB Output is correct
101 Correct 3 ms 3024 KB Output is correct
102 Correct 3 ms 2896 KB Output is correct
103 Correct 3 ms 2896 KB Output is correct
104 Correct 1582 ms 166768 KB Output is correct
105 Correct 1702 ms 188668 KB Output is correct
106 Correct 1826 ms 188696 KB Output is correct
107 Correct 1775 ms 188640 KB Output is correct
108 Correct 1567 ms 188608 KB Output is correct
109 Correct 1598 ms 188692 KB Output is correct
110 Correct 1477 ms 188664 KB Output is correct
111 Correct 1304 ms 188604 KB Output is correct
112 Correct 1187 ms 188668 KB Output is correct
113 Correct 1603 ms 188592 KB Output is correct
114 Correct 1511 ms 188672 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 796 ms 107692 KB Output is correct
2 Correct 1710 ms 188696 KB Output is correct
3 Correct 1745 ms 188776 KB Output is correct
4 Correct 1459 ms 188656 KB Output is correct
5 Correct 1310 ms 188716 KB Output is correct
6 Correct 1311 ms 188696 KB Output is correct
7 Correct 1391 ms 188644 KB Output is correct
8 Correct 0 ms 336 KB Output is correct
9 Correct 3 ms 3000 KB Output is correct
10 Correct 3 ms 3024 KB Output is correct
11 Correct 1 ms 848 KB Output is correct
12 Correct 3 ms 3024 KB Output is correct
13 Correct 5 ms 3024 KB Output is correct
14 Correct 3 ms 2896 KB Output is correct
15 Correct 3 ms 2896 KB Output is correct
16 Correct 3 ms 3024 KB Output is correct
17 Correct 4 ms 2928 KB Output is correct
18 Correct 4 ms 3024 KB Output is correct
19 Correct 3 ms 2896 KB Output is correct
20 Correct 3 ms 3024 KB Output is correct
21 Correct 3 ms 3024 KB Output is correct
22 Correct 0 ms 336 KB Output is correct
23 Correct 3 ms 2984 KB Output is correct
24 Correct 3 ms 3024 KB Output is correct
25 Correct 4 ms 3024 KB Output is correct
26 Correct 3 ms 2940 KB Output is correct
27 Correct 4 ms 3024 KB Output is correct
28 Correct 3 ms 2896 KB Output is correct
29 Correct 5 ms 3140 KB Output is correct
30 Correct 4 ms 3024 KB Output is correct
31 Correct 3 ms 2896 KB Output is correct
32 Correct 3 ms 2896 KB Output is correct
33 Correct 3 ms 3024 KB Output is correct
34 Correct 3 ms 3024 KB Output is correct
35 Correct 2 ms 1360 KB Output is correct
36 Correct 3 ms 3024 KB Output is correct
37 Correct 4 ms 3024 KB Output is correct
38 Correct 4 ms 3024 KB Output is correct
39 Correct 3 ms 3024 KB Output is correct
40 Correct 3 ms 2896 KB Output is correct
41 Correct 4 ms 3024 KB Output is correct
42 Correct 3 ms 3024 KB Output is correct
43 Correct 3 ms 3024 KB Output is correct
44 Correct 3 ms 3024 KB Output is correct
45 Correct 3 ms 3024 KB Output is correct
46 Correct 158 ms 117656 KB Output is correct
47 Correct 237 ms 188604 KB Output is correct
48 Correct 254 ms 188668 KB Output is correct
49 Correct 270 ms 188720 KB Output is correct
50 Correct 232 ms 188828 KB Output is correct
51 Correct 235 ms 188576 KB Output is correct
52 Correct 238 ms 188636 KB Output is correct
53 Correct 193 ms 188672 KB Output is correct
54 Correct 195 ms 188564 KB Output is correct
55 Correct 186 ms 188644 KB Output is correct
56 Correct 187 ms 188616 KB Output is correct
57 Correct 239 ms 188632 KB Output is correct
58 Correct 242 ms 188696 KB Output is correct
59 Correct 225 ms 188604 KB Output is correct
60 Correct 190 ms 188624 KB Output is correct
61 Correct 195 ms 188604 KB Output is correct
62 Correct 230 ms 188660 KB Output is correct
63 Correct 236 ms 188696 KB Output is correct
64 Correct 267 ms 188684 KB Output is correct
65 Correct 178 ms 188584 KB Output is correct
66 Correct 198 ms 188612 KB Output is correct
67 Correct 231 ms 182140 KB Output is correct
68 Correct 244 ms 188568 KB Output is correct
69 Correct 252 ms 188576 KB Output is correct
70 Correct 240 ms 188604 KB Output is correct
71 Correct 230 ms 188608 KB Output is correct
72 Correct 234 ms 188604 KB Output is correct
73 Correct 241 ms 188600 KB Output is correct
74 Correct 199 ms 188648 KB Output is correct
75 Correct 186 ms 188636 KB Output is correct
76 Correct 200 ms 188640 KB Output is correct
77 Correct 190 ms 188608 KB Output is correct
78 Correct 1378 ms 187228 KB Output is correct
79 Correct 1689 ms 188620 KB Output is correct
80 Correct 1733 ms 188728 KB Output is correct
81 Correct 1577 ms 188692 KB Output is correct
82 Correct 1512 ms 188668 KB Output is correct
83 Correct 1540 ms 188684 KB Output is correct
84 Correct 1567 ms 188604 KB Output is correct
85 Correct 1290 ms 188636 KB Output is correct
86 Correct 1282 ms 188576 KB Output is correct
87 Correct 1472 ms 188624 KB Output is correct
88 Correct 1701 ms 188608 KB Output is correct
89 Correct 1433 ms 188628 KB Output is correct
90 Correct 1357 ms 188584 KB Output is correct
91 Correct 0 ms 336 KB Output is correct
92 Correct 3 ms 3024 KB Output is correct
93 Correct 3 ms 2896 KB Output is correct
94 Correct 243 ms 188716 KB Output is correct
95 Correct 239 ms 188592 KB Output is correct
96 Correct 226 ms 188568 KB Output is correct
97 Correct 181 ms 188604 KB Output is correct
98 Correct 184 ms 188564 KB Output is correct
99 Correct 258 ms 188644 KB Output is correct
100 Correct 235 ms 188684 KB Output is correct
101 Correct 239 ms 188604 KB Output is correct
102 Correct 191 ms 188696 KB Output is correct
103 Correct 188 ms 188652 KB Output is correct
104 Correct 4 ms 2896 KB Output is correct
105 Correct 3 ms 2940 KB Output is correct
106 Correct 3 ms 3024 KB Output is correct
107 Correct 5 ms 3024 KB Output is correct
108 Correct 3 ms 3024 KB Output is correct
109 Correct 3 ms 2896 KB Output is correct
110 Correct 4 ms 3024 KB Output is correct
111 Correct 3 ms 3024 KB Output is correct
112 Correct 3 ms 2896 KB Output is correct
113 Correct 3 ms 2896 KB Output is correct
114 Correct 319 ms 40736 KB Output is correct
115 Correct 1283 ms 188764 KB Output is correct
116 Correct 1185 ms 188696 KB Output is correct
117 Correct 1363 ms 188640 KB Output is correct
118 Correct 1299 ms 188676 KB Output is correct
119 Correct 1264 ms 188700 KB Output is correct
120 Correct 1368 ms 188608 KB Output is correct
121 Correct 1149 ms 188748 KB Output is correct
122 Correct 1162 ms 188568 KB Output is correct
123 Correct 1091 ms 188736 KB Output is correct
124 Correct 1149 ms 188604 KB Output is correct
125 Correct 254 ms 188696 KB Output is correct
126 Correct 227 ms 188688 KB Output is correct
127 Correct 237 ms 188628 KB Output is correct
128 Correct 185 ms 188812 KB Output is correct
129 Correct 197 ms 188628 KB Output is correct
130 Correct 233 ms 182048 KB Output is correct
131 Correct 242 ms 188732 KB Output is correct
132 Correct 229 ms 188688 KB Output is correct
133 Correct 259 ms 188664 KB Output is correct
134 Correct 236 ms 188796 KB Output is correct
135 Correct 237 ms 188696 KB Output is correct
136 Correct 225 ms 188760 KB Output is correct
137 Correct 191 ms 188692 KB Output is correct
138 Correct 188 ms 188692 KB Output is correct
139 Correct 198 ms 188644 KB Output is correct
140 Correct 207 ms 188652 KB Output is correct
141 Correct 4 ms 2980 KB Output is correct
142 Correct 4 ms 2936 KB Output is correct
143 Correct 4 ms 3024 KB Output is correct
144 Correct 3 ms 3024 KB Output is correct
145 Correct 4 ms 3024 KB Output is correct
146 Correct 2 ms 1360 KB Output is correct
147 Correct 3 ms 2896 KB Output is correct
148 Correct 4 ms 2924 KB Output is correct
149 Correct 4 ms 2932 KB Output is correct
150 Correct 4 ms 3024 KB Output is correct
151 Correct 4 ms 3024 KB Output is correct
152 Correct 4 ms 3024 KB Output is correct
153 Correct 3 ms 3024 KB Output is correct
154 Correct 3 ms 3024 KB Output is correct
155 Correct 5 ms 2896 KB Output is correct
156 Correct 3 ms 3024 KB Output is correct
157 Correct 1582 ms 166768 KB Output is correct
158 Correct 1702 ms 188668 KB Output is correct
159 Correct 1826 ms 188696 KB Output is correct
160 Correct 1775 ms 188640 KB Output is correct
161 Correct 1567 ms 188608 KB Output is correct
162 Correct 1598 ms 188692 KB Output is correct
163 Correct 1477 ms 188664 KB Output is correct
164 Correct 1304 ms 188604 KB Output is correct
165 Correct 1187 ms 188668 KB Output is correct
166 Correct 1603 ms 188592 KB Output is correct
167 Correct 1511 ms 188672 KB Output is correct
168 Correct 0 ms 336 KB Output is correct
169 Correct 1038 ms 61376 KB Output is correct
170 Correct 1788 ms 188696 KB Output is correct
171 Correct 1999 ms 188604 KB Output is correct
172 Correct 1833 ms 188708 KB Output is correct
173 Correct 1899 ms 188572 KB Output is correct
174 Correct 2240 ms 188600 KB Output is correct
175 Correct 2017 ms 188604 KB Output is correct
176 Correct 1494 ms 188728 KB Output is correct
177 Correct 1326 ms 188588 KB Output is correct
178 Correct 1437 ms 188624 KB Output is correct
179 Correct 1271 ms 188604 KB Output is correct