Submission #772384

# Submission time Handle Problem Language Result Execution time Memory
772384 2023-07-04T04:53:53 Z marvinthang Radio Towers (IOI22_towers) C++17
100 / 100
1247 ms 57768 KB
/*************************************
*    author: marvinthang             *
*    created: 04.07.2023 09:31:20    *
*************************************/

#include "towers.h"
#include <bits/stdc++.h>

using namespace std;

#define                  fi  first
#define                  se  second
#define                left  ___left
#define               right  ___right
#define                TIME  (1.0 * clock() / CLOCKS_PER_SEC)
#define             MASK(i)  (1LL << (i))
#define           BIT(x, i)  ((x) >> (i) & 1)
#define  __builtin_popcount  __builtin_popcountll
#define              ALL(v)  (v).begin(), (v).end()
#define           REP(i, n)  for (int i = 0, _n = (n); i < _n; ++i)
#define          REPD(i, n)  for (int i = (n); i--; )
#define        FOR(i, a, b)  for (int i = (a), _b = (b); i < _b; ++i) 
#define       FORD(i, b, a)  for (int i = (b), _a = (a); --i >= _a; ) 
#define       FORE(i, a, b)  for (int i = (a), _b = (b); i <= _b; ++i) 
#define      FORDE(i, b, a)  for (int i = (b), _a = (a); i >= _a; --i) 
#define        scan_op(...)  istream & operator >> (istream &in, __VA_ARGS__ &u)
#define       print_op(...)  ostream & operator << (ostream &out, const __VA_ARGS__ &u)
#ifdef LOCAL
		#include "debug.h"
#else
		#define file(name) if (fopen(name".inp", "r")) { freopen(name".inp", "r", stdin); freopen(name".out", "w", stdout); }
		#define DB(...) 23
		#define db(...) 23
		#define debug(...) 23
#endif

template <class U, class V> scan_op(pair <U, V>)  { return in >> u.first >> u.second; }
template <class T> scan_op(vector <T>)  { for (size_t i = 0; i < u.size(); ++i) in >> u[i]; return in; }
template <class U, class V> print_op(pair <U, V>)  { return out << '(' << u.first << ", " << u.second << ')'; }
template <size_t i, class T> ostream & print_tuple_utils(ostream &out, const T &tup) { if constexpr(i == tuple_size<T>::value) return out << ")";  else return print_tuple_utils<i + 1, T>(out << (i ? ", " : "(") << get<i>(tup), tup); }
template <class ...U> print_op(tuple<U...>) { return print_tuple_utils<0, tuple<U...>>(out, u); }
template <class Con, class = decltype(begin(declval<Con>()))> typename enable_if <!is_same<Con, string>::value, ostream&>::type operator << (ostream &out, const Con &con) { out << '{'; for (__typeof(con.begin()) it = con.begin(); it != con.end(); ++it) out << (it == con.begin() ? "" : ", ") << *it; return out << '}'; }

const int INF = 1e9;

struct Node {
	int ma, s_p, p_s;
	pair <int, int> mi;
	Node(): ma(-INF), mi(INF, INF), s_p(-INF), p_s(-INF) {}
	Node(int h, int i): ma(h), mi(h, i), s_p(-INF), p_s(-INF) {}
	Node operator + (const Node &other) const {
		Node res;
		res.ma = max(ma, other.ma);
		res.mi = min(mi, other.mi);
		res.s_p = max({s_p, other.s_p, other.ma - mi.fi});
		res.p_s = max({p_s, other.p_s, ma - other.mi.fi});
		return res;
	}
};

struct PNode {
	int mi, ma, cnt, left_child, right_child;
	PNode(): ma(-INF), mi(INF), cnt(0), left_child(-1), right_child(-1) {}
	PNode(int v): ma(v), mi(v), cnt(1), left_child(-1), right_child(-1) {}
	PNode operator + (const PNode &other) const {
		PNode res;
		res.mi = min(mi, other.mi);
		res.ma = max(ma, other.ma);
		res.cnt = cnt + other.cnt;
		return res;
	}
};

// end of template

int N;
vector <int> H, val, versions;
vector <Node> st;

void build(int i, int l, int r) {
	if (r - l == 1) {
		st[i] = Node(H[l], l);
		return;
	}
	int m = l + r >> 1;
	build(i << 1, l, m);
	build(i << 1 | 1, m, r);
	st[i] = st[i << 1] + st[i << 1 | 1];
}

Node get(int i, int l, int r, int u, int v) {
	if (l >= v || r <= u || u >= v) return Node();
	if (u <= l && r <= v) return st[i];
	int m = l + r >> 1;
	return get(i << 1, l, m, u, v) + get(i << 1 | 1, m, r, u, v);
}

vector <PNode> pnodes;

int createNode(int l, int r) {
	int i = pnodes.size();
	pnodes.push_back(pnodes[l] + pnodes[r]);
	pnodes[i].left_child = l;
	pnodes[i].right_child = r;
	return i;
}

int createNode(int v = -1) {
	int i = pnodes.size();
	if (v == -1) pnodes.push_back(PNode());
	else pnodes.push_back(PNode(v));
	return i;
}

int pbuild(int i, int l, int r) {
	if (r - l == 1) return createNode(-1);
	int m = l + r >> 1;
	return createNode(pbuild(i << 1, l, m), pbuild(i << 1 | 1, m, r));
}

int pupdate(int id, int l, int r, int p) {
	if (r - l == 1) return createNode(p);
	int m = l + r >> 1;
	if (p < m) return createNode(pupdate(pnodes[id].left_child, l, m, p), pnodes[id].right_child);
	return createNode(pnodes[id].left_child, pupdate(pnodes[id].right_child, m, r, p));
}

PNode pget(int id, int l, int r, int u, int v) {
	if (l >= v || r <= u || u >= v) return PNode();
	if (u <= l && r <= v) return pnodes[id];
	int m = l + r >> 1;
	return pget(pnodes[id].left_child, l, m, u, v) + pget(pnodes[id].right_child, m, r, u, v);
}

void init(int n, vector<int> h) {
	N = n;
	H = h;
	st.resize(N * 4 + 23);
	build(1, 0, N);
	stack <int> st;
	vector <int> v(N);
	REP(i, N) {
		while (!st.empty() && H[st.top()] >= H[i]) st.pop();
		v[i] = st.empty() ? INF : get(1, 0, N, st.top() + 1, i).ma - H[i];
		st.push(i);
	}
	while (!st.empty()) st.pop();
	REPD(i, N) {
		while (!st.empty() && H[st.top()] >= H[i]) st.pop();
		v[i] = min(v[i], st.empty() ? INF : get(1, 0, N, i + 1, st.top()).ma - H[i]);
		st.push(i);
		val.push_back(v[i]);
	}
	sort(ALL(val));
	val.erase(unique(ALL(val)), val.end());
	vector <vector <int>> add(val.size());
	REP(i, N) add[lower_bound(ALL(val), v[i]) - val.begin()].push_back(i);
	versions.resize(val.size() + 1);
	versions[val.size()] = pbuild(1, 0, N);
	REPD(i, val.size()) {
		versions[i] = versions[i + 1];
		for (int x: add[i]) versions[i] = pupdate(versions[i], 0, N, x);
		}
}

int max_towers(int l, int r, int d) {
	int p = lower_bound(ALL(val), d) - val.begin();
	PNode pn = pget(versions[p], 0, N, l, r + 1);
	int res = pn.cnt;
	int x = pn.mi;
	int y = pn.ma;
		if (!res) {
		x = y = get(1, 0, N, l, r + 1).mi.se;
		++res;
	}
	res += get(1, 0, N, l, x).s_p >= d;
	res += get(1, 0, N, y + 1, r + 1).p_s >= d;
	return res;
}

Compilation message

towers.cpp: In constructor 'Node::Node()':
towers.cpp:48:18: warning: 'Node::mi' will be initialized after [-Wreorder]
   48 |  pair <int, int> mi;
      |                  ^~
towers.cpp:47:10: warning:   'int Node::s_p' [-Wreorder]
   47 |  int ma, s_p, p_s;
      |          ^~~
towers.cpp:49:2: warning:   when initialized here [-Wreorder]
   49 |  Node(): ma(-INF), mi(INF, INF), s_p(-INF), p_s(-INF) {}
      |  ^~~~
towers.cpp: In constructor 'Node::Node(int, int)':
towers.cpp:48:18: warning: 'Node::mi' will be initialized after [-Wreorder]
   48 |  pair <int, int> mi;
      |                  ^~
towers.cpp:47:10: warning:   'int Node::s_p' [-Wreorder]
   47 |  int ma, s_p, p_s;
      |          ^~~
towers.cpp:50:2: warning:   when initialized here [-Wreorder]
   50 |  Node(int h, int i): ma(h), mi(h, i), s_p(-INF), p_s(-INF) {}
      |  ^~~~
towers.cpp: In constructor 'PNode::PNode()':
towers.cpp:62:10: warning: 'PNode::ma' will be initialized after [-Wreorder]
   62 |  int mi, ma, cnt, left_child, right_child;
      |          ^~
towers.cpp:62:6: warning:   'int PNode::mi' [-Wreorder]
   62 |  int mi, ma, cnt, left_child, right_child;
      |      ^~
towers.cpp:63:2: warning:   when initialized here [-Wreorder]
   63 |  PNode(): ma(-INF), mi(INF), cnt(0), left_child(-1), right_child(-1) {}
      |  ^~~~~
towers.cpp: In constructor 'PNode::PNode(int)':
towers.cpp:62:10: warning: 'PNode::ma' will be initialized after [-Wreorder]
   62 |  int mi, ma, cnt, left_child, right_child;
      |          ^~
towers.cpp:62:6: warning:   'int PNode::mi' [-Wreorder]
   62 |  int mi, ma, cnt, left_child, right_child;
      |      ^~
towers.cpp:64:2: warning:   when initialized here [-Wreorder]
   64 |  PNode(int v): ma(v), mi(v), cnt(1), left_child(-1), right_child(-1) {}
      |  ^~~~~
towers.cpp: In function 'void build(int, int, int)':
towers.cpp:85:12: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   85 |  int m = l + r >> 1;
      |          ~~^~~
towers.cpp: In function 'Node get(int, int, int, int, int)':
towers.cpp:94:12: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   94 |  int m = l + r >> 1;
      |          ~~^~~
towers.cpp: In function 'int pbuild(int, int, int)':
towers.cpp:117:12: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
  117 |  int m = l + r >> 1;
      |          ~~^~~
towers.cpp: In function 'int pupdate(int, int, int, int)':
towers.cpp:123:12: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
  123 |  int m = l + r >> 1;
      |          ~~^~~
towers.cpp: In function 'PNode pget(int, int, int, int, int)':
towers.cpp:131:12: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
  131 |  int m = l + r >> 1;
      |          ~~^~~
# Verdict Execution time Memory Grader output
1 Correct 531 ms 51020 KB Output is correct
2 Correct 1068 ms 57288 KB Output is correct
3 Correct 1050 ms 57224 KB Output is correct
4 Correct 987 ms 57328 KB Output is correct
5 Correct 956 ms 57680 KB Output is correct
6 Correct 1158 ms 57324 KB Output is correct
7 Correct 992 ms 57740 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 3 ms 1292 KB Output is correct
10 Correct 2 ms 1292 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 592 KB Output is correct
2 Correct 2 ms 1292 KB Output is correct
3 Correct 2 ms 1292 KB Output is correct
4 Correct 2 ms 1292 KB Output is correct
5 Correct 3 ms 1292 KB Output is correct
6 Correct 2 ms 1292 KB Output is correct
7 Correct 2 ms 1292 KB Output is correct
8 Correct 2 ms 1292 KB Output is correct
9 Correct 2 ms 1292 KB Output is correct
10 Correct 2 ms 1296 KB Output is correct
11 Correct 2 ms 1292 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 2 ms 1292 KB Output is correct
14 Correct 2 ms 1292 KB Output is correct
15 Correct 2 ms 1292 KB Output is correct
16 Correct 2 ms 1292 KB Output is correct
17 Correct 2 ms 1292 KB Output is correct
18 Correct 2 ms 1368 KB Output is correct
19 Correct 2 ms 1296 KB Output is correct
20 Correct 2 ms 1292 KB Output is correct
21 Correct 2 ms 1292 KB Output is correct
22 Correct 2 ms 1292 KB Output is correct
23 Correct 2 ms 1292 KB Output is correct
24 Correct 2 ms 1292 KB Output is correct
25 Correct 2 ms 816 KB Output is correct
26 Correct 3 ms 1292 KB Output is correct
27 Correct 2 ms 1292 KB Output is correct
28 Correct 2 ms 1292 KB Output is correct
29 Correct 3 ms 1292 KB Output is correct
30 Correct 3 ms 1292 KB Output is correct
31 Correct 2 ms 1292 KB Output is correct
32 Correct 2 ms 1292 KB Output is correct
33 Correct 2 ms 1312 KB Output is correct
34 Correct 2 ms 1292 KB Output is correct
35 Correct 3 ms 1292 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 592 KB Output is correct
2 Correct 2 ms 1292 KB Output is correct
3 Correct 2 ms 1292 KB Output is correct
4 Correct 2 ms 1292 KB Output is correct
5 Correct 3 ms 1292 KB Output is correct
6 Correct 2 ms 1292 KB Output is correct
7 Correct 2 ms 1292 KB Output is correct
8 Correct 2 ms 1292 KB Output is correct
9 Correct 2 ms 1292 KB Output is correct
10 Correct 2 ms 1296 KB Output is correct
11 Correct 2 ms 1292 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 2 ms 1292 KB Output is correct
14 Correct 2 ms 1292 KB Output is correct
15 Correct 2 ms 1292 KB Output is correct
16 Correct 2 ms 1292 KB Output is correct
17 Correct 2 ms 1292 KB Output is correct
18 Correct 2 ms 1368 KB Output is correct
19 Correct 2 ms 1296 KB Output is correct
20 Correct 2 ms 1292 KB Output is correct
21 Correct 2 ms 1292 KB Output is correct
22 Correct 2 ms 1292 KB Output is correct
23 Correct 2 ms 1292 KB Output is correct
24 Correct 2 ms 1292 KB Output is correct
25 Correct 2 ms 816 KB Output is correct
26 Correct 3 ms 1292 KB Output is correct
27 Correct 2 ms 1292 KB Output is correct
28 Correct 2 ms 1292 KB Output is correct
29 Correct 3 ms 1292 KB Output is correct
30 Correct 3 ms 1292 KB Output is correct
31 Correct 2 ms 1292 KB Output is correct
32 Correct 2 ms 1292 KB Output is correct
33 Correct 2 ms 1312 KB Output is correct
34 Correct 2 ms 1292 KB Output is correct
35 Correct 3 ms 1292 KB Output is correct
36 Correct 118 ms 51700 KB Output is correct
37 Correct 190 ms 57236 KB Output is correct
38 Correct 218 ms 57236 KB Output is correct
39 Correct 191 ms 57308 KB Output is correct
40 Correct 195 ms 57316 KB Output is correct
41 Correct 180 ms 57296 KB Output is correct
42 Correct 186 ms 57300 KB Output is correct
43 Correct 104 ms 57360 KB Output is correct
44 Correct 95 ms 57664 KB Output is correct
45 Correct 110 ms 57344 KB Output is correct
46 Correct 125 ms 57576 KB Output is correct
47 Correct 225 ms 57312 KB Output is correct
48 Correct 179 ms 57256 KB Output is correct
49 Correct 188 ms 57296 KB Output is correct
50 Correct 99 ms 57664 KB Output is correct
51 Correct 130 ms 57288 KB Output is correct
52 Correct 199 ms 57220 KB Output is correct
53 Correct 207 ms 57316 KB Output is correct
54 Correct 203 ms 57232 KB Output is correct
55 Correct 90 ms 57752 KB Output is correct
56 Correct 101 ms 57280 KB Output is correct
57 Correct 172 ms 56684 KB Output is correct
58 Correct 197 ms 57268 KB Output is correct
59 Correct 172 ms 57340 KB Output is correct
60 Correct 181 ms 57260 KB Output is correct
61 Correct 175 ms 57320 KB Output is correct
62 Correct 168 ms 57268 KB Output is correct
63 Correct 168 ms 57356 KB Output is correct
64 Correct 95 ms 57284 KB Output is correct
65 Correct 85 ms 57640 KB Output is correct
66 Correct 107 ms 57344 KB Output is correct
67 Correct 93 ms 57612 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 850 ms 57152 KB Output is correct
2 Correct 929 ms 57320 KB Output is correct
3 Correct 1083 ms 57256 KB Output is correct
4 Correct 1065 ms 57360 KB Output is correct
5 Correct 1044 ms 57296 KB Output is correct
6 Correct 1022 ms 57336 KB Output is correct
7 Correct 1181 ms 57248 KB Output is correct
8 Correct 1119 ms 57340 KB Output is correct
9 Correct 941 ms 57716 KB Output is correct
10 Correct 1037 ms 57284 KB Output is correct
11 Correct 992 ms 57528 KB Output is correct
12 Correct 1016 ms 57216 KB Output is correct
13 Correct 1044 ms 57656 KB Output is correct
14 Correct 0 ms 208 KB Output is correct
15 Correct 2 ms 1296 KB Output is correct
16 Correct 1 ms 1292 KB Output is correct
17 Correct 163 ms 57292 KB Output is correct
18 Correct 190 ms 57316 KB Output is correct
19 Correct 165 ms 57288 KB Output is correct
20 Correct 85 ms 57624 KB Output is correct
21 Correct 94 ms 57260 KB Output is correct
22 Correct 162 ms 57304 KB Output is correct
23 Correct 175 ms 57312 KB Output is correct
24 Correct 164 ms 57276 KB Output is correct
25 Correct 101 ms 57768 KB Output is correct
26 Correct 118 ms 57324 KB Output is correct
27 Correct 3 ms 1304 KB Output is correct
28 Correct 2 ms 1292 KB Output is correct
29 Correct 2 ms 1292 KB Output is correct
30 Correct 2 ms 1292 KB Output is correct
31 Correct 2 ms 1296 KB Output is correct
32 Correct 2 ms 1292 KB Output is correct
33 Correct 2 ms 1292 KB Output is correct
34 Correct 3 ms 1292 KB Output is correct
35 Correct 2 ms 1292 KB Output is correct
36 Correct 2 ms 1292 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 309 ms 14420 KB Output is correct
2 Correct 1000 ms 57284 KB Output is correct
3 Correct 1055 ms 57324 KB Output is correct
4 Correct 782 ms 57328 KB Output is correct
5 Correct 1002 ms 57288 KB Output is correct
6 Correct 977 ms 57284 KB Output is correct
7 Correct 754 ms 57228 KB Output is correct
8 Correct 917 ms 57256 KB Output is correct
9 Correct 920 ms 57684 KB Output is correct
10 Correct 833 ms 57236 KB Output is correct
11 Correct 692 ms 57432 KB Output is correct
12 Correct 162 ms 57264 KB Output is correct
13 Correct 174 ms 57376 KB Output is correct
14 Correct 164 ms 57284 KB Output is correct
15 Correct 91 ms 57676 KB Output is correct
16 Correct 100 ms 57248 KB Output is correct
17 Correct 156 ms 56968 KB Output is correct
18 Correct 165 ms 57372 KB Output is correct
19 Correct 163 ms 57308 KB Output is correct
20 Correct 177 ms 57240 KB Output is correct
21 Correct 159 ms 57292 KB Output is correct
22 Correct 189 ms 57204 KB Output is correct
23 Correct 173 ms 57364 KB Output is correct
24 Correct 101 ms 57324 KB Output is correct
25 Correct 97 ms 57632 KB Output is correct
26 Correct 115 ms 57320 KB Output is correct
27 Correct 92 ms 57648 KB Output is correct
28 Correct 3 ms 1292 KB Output is correct
29 Correct 3 ms 1292 KB Output is correct
30 Correct 2 ms 1292 KB Output is correct
31 Correct 4 ms 1292 KB Output is correct
32 Correct 2 ms 1292 KB Output is correct
33 Correct 1 ms 816 KB Output is correct
34 Correct 2 ms 1292 KB Output is correct
35 Correct 3 ms 1292 KB Output is correct
36 Correct 2 ms 1292 KB Output is correct
37 Correct 6 ms 1276 KB Output is correct
38 Correct 2 ms 1292 KB Output is correct
39 Correct 3 ms 1292 KB Output is correct
40 Correct 2 ms 1292 KB Output is correct
41 Correct 2 ms 1292 KB Output is correct
42 Correct 3 ms 1292 KB Output is correct
43 Correct 3 ms 1292 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 592 KB Output is correct
2 Correct 2 ms 1292 KB Output is correct
3 Correct 2 ms 1292 KB Output is correct
4 Correct 2 ms 1292 KB Output is correct
5 Correct 3 ms 1292 KB Output is correct
6 Correct 2 ms 1292 KB Output is correct
7 Correct 2 ms 1292 KB Output is correct
8 Correct 2 ms 1292 KB Output is correct
9 Correct 2 ms 1292 KB Output is correct
10 Correct 2 ms 1296 KB Output is correct
11 Correct 2 ms 1292 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 2 ms 1292 KB Output is correct
14 Correct 2 ms 1292 KB Output is correct
15 Correct 2 ms 1292 KB Output is correct
16 Correct 2 ms 1292 KB Output is correct
17 Correct 2 ms 1292 KB Output is correct
18 Correct 2 ms 1368 KB Output is correct
19 Correct 2 ms 1296 KB Output is correct
20 Correct 2 ms 1292 KB Output is correct
21 Correct 2 ms 1292 KB Output is correct
22 Correct 2 ms 1292 KB Output is correct
23 Correct 2 ms 1292 KB Output is correct
24 Correct 2 ms 1292 KB Output is correct
25 Correct 2 ms 816 KB Output is correct
26 Correct 3 ms 1292 KB Output is correct
27 Correct 2 ms 1292 KB Output is correct
28 Correct 2 ms 1292 KB Output is correct
29 Correct 3 ms 1292 KB Output is correct
30 Correct 3 ms 1292 KB Output is correct
31 Correct 2 ms 1292 KB Output is correct
32 Correct 2 ms 1292 KB Output is correct
33 Correct 2 ms 1312 KB Output is correct
34 Correct 2 ms 1292 KB Output is correct
35 Correct 3 ms 1292 KB Output is correct
36 Correct 118 ms 51700 KB Output is correct
37 Correct 190 ms 57236 KB Output is correct
38 Correct 218 ms 57236 KB Output is correct
39 Correct 191 ms 57308 KB Output is correct
40 Correct 195 ms 57316 KB Output is correct
41 Correct 180 ms 57296 KB Output is correct
42 Correct 186 ms 57300 KB Output is correct
43 Correct 104 ms 57360 KB Output is correct
44 Correct 95 ms 57664 KB Output is correct
45 Correct 110 ms 57344 KB Output is correct
46 Correct 125 ms 57576 KB Output is correct
47 Correct 225 ms 57312 KB Output is correct
48 Correct 179 ms 57256 KB Output is correct
49 Correct 188 ms 57296 KB Output is correct
50 Correct 99 ms 57664 KB Output is correct
51 Correct 130 ms 57288 KB Output is correct
52 Correct 199 ms 57220 KB Output is correct
53 Correct 207 ms 57316 KB Output is correct
54 Correct 203 ms 57232 KB Output is correct
55 Correct 90 ms 57752 KB Output is correct
56 Correct 101 ms 57280 KB Output is correct
57 Correct 172 ms 56684 KB Output is correct
58 Correct 197 ms 57268 KB Output is correct
59 Correct 172 ms 57340 KB Output is correct
60 Correct 181 ms 57260 KB Output is correct
61 Correct 175 ms 57320 KB Output is correct
62 Correct 168 ms 57268 KB Output is correct
63 Correct 168 ms 57356 KB Output is correct
64 Correct 95 ms 57284 KB Output is correct
65 Correct 85 ms 57640 KB Output is correct
66 Correct 107 ms 57344 KB Output is correct
67 Correct 93 ms 57612 KB Output is correct
68 Correct 850 ms 57152 KB Output is correct
69 Correct 929 ms 57320 KB Output is correct
70 Correct 1083 ms 57256 KB Output is correct
71 Correct 1065 ms 57360 KB Output is correct
72 Correct 1044 ms 57296 KB Output is correct
73 Correct 1022 ms 57336 KB Output is correct
74 Correct 1181 ms 57248 KB Output is correct
75 Correct 1119 ms 57340 KB Output is correct
76 Correct 941 ms 57716 KB Output is correct
77 Correct 1037 ms 57284 KB Output is correct
78 Correct 992 ms 57528 KB Output is correct
79 Correct 1016 ms 57216 KB Output is correct
80 Correct 1044 ms 57656 KB Output is correct
81 Correct 0 ms 208 KB Output is correct
82 Correct 2 ms 1296 KB Output is correct
83 Correct 1 ms 1292 KB Output is correct
84 Correct 163 ms 57292 KB Output is correct
85 Correct 190 ms 57316 KB Output is correct
86 Correct 165 ms 57288 KB Output is correct
87 Correct 85 ms 57624 KB Output is correct
88 Correct 94 ms 57260 KB Output is correct
89 Correct 162 ms 57304 KB Output is correct
90 Correct 175 ms 57312 KB Output is correct
91 Correct 164 ms 57276 KB Output is correct
92 Correct 101 ms 57768 KB Output is correct
93 Correct 118 ms 57324 KB Output is correct
94 Correct 3 ms 1304 KB Output is correct
95 Correct 2 ms 1292 KB Output is correct
96 Correct 2 ms 1292 KB Output is correct
97 Correct 2 ms 1292 KB Output is correct
98 Correct 2 ms 1296 KB Output is correct
99 Correct 2 ms 1292 KB Output is correct
100 Correct 2 ms 1292 KB Output is correct
101 Correct 3 ms 1292 KB Output is correct
102 Correct 2 ms 1292 KB Output is correct
103 Correct 2 ms 1292 KB Output is correct
104 Correct 912 ms 55480 KB Output is correct
105 Correct 920 ms 57260 KB Output is correct
106 Correct 1044 ms 57288 KB Output is correct
107 Correct 1031 ms 57336 KB Output is correct
108 Correct 1012 ms 57272 KB Output is correct
109 Correct 1083 ms 57236 KB Output is correct
110 Correct 1074 ms 57312 KB Output is correct
111 Correct 1020 ms 57304 KB Output is correct
112 Correct 1014 ms 57700 KB Output is correct
113 Correct 997 ms 57260 KB Output is correct
114 Correct 968 ms 57460 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 531 ms 51020 KB Output is correct
2 Correct 1068 ms 57288 KB Output is correct
3 Correct 1050 ms 57224 KB Output is correct
4 Correct 987 ms 57328 KB Output is correct
5 Correct 956 ms 57680 KB Output is correct
6 Correct 1158 ms 57324 KB Output is correct
7 Correct 992 ms 57740 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 3 ms 1292 KB Output is correct
10 Correct 2 ms 1292 KB Output is correct
11 Correct 1 ms 592 KB Output is correct
12 Correct 2 ms 1292 KB Output is correct
13 Correct 2 ms 1292 KB Output is correct
14 Correct 2 ms 1292 KB Output is correct
15 Correct 3 ms 1292 KB Output is correct
16 Correct 2 ms 1292 KB Output is correct
17 Correct 2 ms 1292 KB Output is correct
18 Correct 2 ms 1292 KB Output is correct
19 Correct 2 ms 1292 KB Output is correct
20 Correct 2 ms 1296 KB Output is correct
21 Correct 2 ms 1292 KB Output is correct
22 Correct 0 ms 208 KB Output is correct
23 Correct 2 ms 1292 KB Output is correct
24 Correct 2 ms 1292 KB Output is correct
25 Correct 2 ms 1292 KB Output is correct
26 Correct 2 ms 1292 KB Output is correct
27 Correct 2 ms 1292 KB Output is correct
28 Correct 2 ms 1368 KB Output is correct
29 Correct 2 ms 1296 KB Output is correct
30 Correct 2 ms 1292 KB Output is correct
31 Correct 2 ms 1292 KB Output is correct
32 Correct 2 ms 1292 KB Output is correct
33 Correct 2 ms 1292 KB Output is correct
34 Correct 2 ms 1292 KB Output is correct
35 Correct 2 ms 816 KB Output is correct
36 Correct 3 ms 1292 KB Output is correct
37 Correct 2 ms 1292 KB Output is correct
38 Correct 2 ms 1292 KB Output is correct
39 Correct 3 ms 1292 KB Output is correct
40 Correct 3 ms 1292 KB Output is correct
41 Correct 2 ms 1292 KB Output is correct
42 Correct 2 ms 1292 KB Output is correct
43 Correct 2 ms 1312 KB Output is correct
44 Correct 2 ms 1292 KB Output is correct
45 Correct 3 ms 1292 KB Output is correct
46 Correct 118 ms 51700 KB Output is correct
47 Correct 190 ms 57236 KB Output is correct
48 Correct 218 ms 57236 KB Output is correct
49 Correct 191 ms 57308 KB Output is correct
50 Correct 195 ms 57316 KB Output is correct
51 Correct 180 ms 57296 KB Output is correct
52 Correct 186 ms 57300 KB Output is correct
53 Correct 104 ms 57360 KB Output is correct
54 Correct 95 ms 57664 KB Output is correct
55 Correct 110 ms 57344 KB Output is correct
56 Correct 125 ms 57576 KB Output is correct
57 Correct 225 ms 57312 KB Output is correct
58 Correct 179 ms 57256 KB Output is correct
59 Correct 188 ms 57296 KB Output is correct
60 Correct 99 ms 57664 KB Output is correct
61 Correct 130 ms 57288 KB Output is correct
62 Correct 199 ms 57220 KB Output is correct
63 Correct 207 ms 57316 KB Output is correct
64 Correct 203 ms 57232 KB Output is correct
65 Correct 90 ms 57752 KB Output is correct
66 Correct 101 ms 57280 KB Output is correct
67 Correct 172 ms 56684 KB Output is correct
68 Correct 197 ms 57268 KB Output is correct
69 Correct 172 ms 57340 KB Output is correct
70 Correct 181 ms 57260 KB Output is correct
71 Correct 175 ms 57320 KB Output is correct
72 Correct 168 ms 57268 KB Output is correct
73 Correct 168 ms 57356 KB Output is correct
74 Correct 95 ms 57284 KB Output is correct
75 Correct 85 ms 57640 KB Output is correct
76 Correct 107 ms 57344 KB Output is correct
77 Correct 93 ms 57612 KB Output is correct
78 Correct 850 ms 57152 KB Output is correct
79 Correct 929 ms 57320 KB Output is correct
80 Correct 1083 ms 57256 KB Output is correct
81 Correct 1065 ms 57360 KB Output is correct
82 Correct 1044 ms 57296 KB Output is correct
83 Correct 1022 ms 57336 KB Output is correct
84 Correct 1181 ms 57248 KB Output is correct
85 Correct 1119 ms 57340 KB Output is correct
86 Correct 941 ms 57716 KB Output is correct
87 Correct 1037 ms 57284 KB Output is correct
88 Correct 992 ms 57528 KB Output is correct
89 Correct 1016 ms 57216 KB Output is correct
90 Correct 1044 ms 57656 KB Output is correct
91 Correct 0 ms 208 KB Output is correct
92 Correct 2 ms 1296 KB Output is correct
93 Correct 1 ms 1292 KB Output is correct
94 Correct 163 ms 57292 KB Output is correct
95 Correct 190 ms 57316 KB Output is correct
96 Correct 165 ms 57288 KB Output is correct
97 Correct 85 ms 57624 KB Output is correct
98 Correct 94 ms 57260 KB Output is correct
99 Correct 162 ms 57304 KB Output is correct
100 Correct 175 ms 57312 KB Output is correct
101 Correct 164 ms 57276 KB Output is correct
102 Correct 101 ms 57768 KB Output is correct
103 Correct 118 ms 57324 KB Output is correct
104 Correct 3 ms 1304 KB Output is correct
105 Correct 2 ms 1292 KB Output is correct
106 Correct 2 ms 1292 KB Output is correct
107 Correct 2 ms 1292 KB Output is correct
108 Correct 2 ms 1296 KB Output is correct
109 Correct 2 ms 1292 KB Output is correct
110 Correct 2 ms 1292 KB Output is correct
111 Correct 3 ms 1292 KB Output is correct
112 Correct 2 ms 1292 KB Output is correct
113 Correct 2 ms 1292 KB Output is correct
114 Correct 309 ms 14420 KB Output is correct
115 Correct 1000 ms 57284 KB Output is correct
116 Correct 1055 ms 57324 KB Output is correct
117 Correct 782 ms 57328 KB Output is correct
118 Correct 1002 ms 57288 KB Output is correct
119 Correct 977 ms 57284 KB Output is correct
120 Correct 754 ms 57228 KB Output is correct
121 Correct 917 ms 57256 KB Output is correct
122 Correct 920 ms 57684 KB Output is correct
123 Correct 833 ms 57236 KB Output is correct
124 Correct 692 ms 57432 KB Output is correct
125 Correct 162 ms 57264 KB Output is correct
126 Correct 174 ms 57376 KB Output is correct
127 Correct 164 ms 57284 KB Output is correct
128 Correct 91 ms 57676 KB Output is correct
129 Correct 100 ms 57248 KB Output is correct
130 Correct 156 ms 56968 KB Output is correct
131 Correct 165 ms 57372 KB Output is correct
132 Correct 163 ms 57308 KB Output is correct
133 Correct 177 ms 57240 KB Output is correct
134 Correct 159 ms 57292 KB Output is correct
135 Correct 189 ms 57204 KB Output is correct
136 Correct 173 ms 57364 KB Output is correct
137 Correct 101 ms 57324 KB Output is correct
138 Correct 97 ms 57632 KB Output is correct
139 Correct 115 ms 57320 KB Output is correct
140 Correct 92 ms 57648 KB Output is correct
141 Correct 3 ms 1292 KB Output is correct
142 Correct 3 ms 1292 KB Output is correct
143 Correct 2 ms 1292 KB Output is correct
144 Correct 4 ms 1292 KB Output is correct
145 Correct 2 ms 1292 KB Output is correct
146 Correct 1 ms 816 KB Output is correct
147 Correct 2 ms 1292 KB Output is correct
148 Correct 3 ms 1292 KB Output is correct
149 Correct 2 ms 1292 KB Output is correct
150 Correct 6 ms 1276 KB Output is correct
151 Correct 2 ms 1292 KB Output is correct
152 Correct 3 ms 1292 KB Output is correct
153 Correct 2 ms 1292 KB Output is correct
154 Correct 2 ms 1292 KB Output is correct
155 Correct 3 ms 1292 KB Output is correct
156 Correct 3 ms 1292 KB Output is correct
157 Correct 912 ms 55480 KB Output is correct
158 Correct 920 ms 57260 KB Output is correct
159 Correct 1044 ms 57288 KB Output is correct
160 Correct 1031 ms 57336 KB Output is correct
161 Correct 1012 ms 57272 KB Output is correct
162 Correct 1083 ms 57236 KB Output is correct
163 Correct 1074 ms 57312 KB Output is correct
164 Correct 1020 ms 57304 KB Output is correct
165 Correct 1014 ms 57700 KB Output is correct
166 Correct 997 ms 57260 KB Output is correct
167 Correct 968 ms 57460 KB Output is correct
168 Correct 0 ms 208 KB Output is correct
169 Correct 707 ms 26368 KB Output is correct
170 Correct 1051 ms 57240 KB Output is correct
171 Correct 1014 ms 57308 KB Output is correct
172 Correct 1185 ms 57316 KB Output is correct
173 Correct 1167 ms 57264 KB Output is correct
174 Correct 1247 ms 57232 KB Output is correct
175 Correct 1210 ms 57232 KB Output is correct
176 Correct 950 ms 57404 KB Output is correct
177 Correct 929 ms 57748 KB Output is correct
178 Correct 1032 ms 57344 KB Output is correct
179 Correct 881 ms 57428 KB Output is correct