// correct/solution-prabowo-wavelet.cpp
#include "towers.h"
#include <algorithm>
#include <utility>
#include <vector>
const int kInf = 1e9 + 5;
struct Node {
int cnt, max, min, maxmin, minmax;
Node(int val=-1): cnt(1), max(val), min(val), maxmin(-1), minmax(-1) {
if (val == -1) cnt = 0, max = -1, min = kInf;
}
};
Node operator + (const Node &p, const Node &q) {
Node ret;
ret.cnt = p.cnt + q.cnt;
ret.max = std::max(p.max, q.max); ret.min = std::min(p.min, q.min);
ret.maxmin = std::max({p.maxmin, q.maxmin, p.max - q.min});
ret.minmax = std::max({p.minmax, q.minmax, q.max - p.min});
return ret;
}
int N;
std::vector<int> H;
std::vector<Node> tree;
Node query(int l, int r) {
Node lft, rgt;
for (l = std::max(0, l) + N, r = std::min(N, r) + N; l < r; l >>= 1, r >>= 1) {
if (l & 1) lft = lft + tree[l++];
if (r & 1) rgt = tree[--r] + rgt;
}
return lft + rgt;
}
class Wavelet {
private:
std::vector<std::vector<int>> partitions, pos;
std::vector<int> alphabet;
void build(int idx, int l, int r, int ll, int rr, std::vector<std::pair<int, int>> &val) {
int mid = (l + r) / 2;
partitions[idx] = {0};
for (int i = ll; i < rr; ++i) {
partitions[idx].push_back(partitions[idx].back() + (val[i].first < alphabet[mid]));
pos[idx].push_back(val[i].second);
}
if (l + 1 == r) return;
int mmid = std::stable_partition(val.begin() + ll, val.begin() + rr,
[&](std::pair<int, int> v) { return v.first < alphabet[mid]; }) - val.begin();
build(idx + 1, l, mid, ll, mmid, val);
build(idx + (mid - l) * 2, mid, r, mmid, rr, val);
}
Node range(int idx, int l, int r, int ll, int rr, int parL, int parR) {
if (parL == parR || l >= rr || r <= ll) return Node();
if (l >= ll && r <= rr) {
Node ret;
ret.cnt = parR - parL; ret.max = pos[idx][parR - 1]; ret.min = pos[idx][parL];
return ret;
}
int mid = (l + r) / 2;
return range(idx + 1, l, mid, ll, rr, partitions[idx][parL], partitions[idx][parR]) +
range(idx + (mid - l) * 2, mid, r, ll, rr, parL - partitions[idx][parL], parR - partitions[idx][parR]);
}
public:
void build(std::vector<int> val) {
alphabet = val;
std::sort(alphabet.begin(), alphabet.end());
alphabet.erase(std::unique(alphabet.begin(), alphabet.end()), alphabet.end());
std::vector<std::pair<int, int>> valPos(val.size());
for (int i = 0; i < static_cast<int>(val.size()); ++i) valPos[i] = {val[i], i};
partitions.resize(alphabet.size() * 2); pos.resize(alphabet.size() * 2);
build(0, 0, alphabet.size(), 0, val.size(), valPos);
}
// Correctly returns (cnt(i), min(i), max(i)) in val[l..r) s.t. a <= val[i] <= b
Node range(int l, int r, int a, int b) {
return range(0, 0, alphabet.size(),
std::lower_bound(alphabet.begin(), alphabet.end(), a) - alphabet.begin(),
std::upper_bound(alphabet.begin(), alphabet.end(), b) - alphabet.begin(),
l, r);
}
} waveletH, waveletDelta;
void init(int _N, std::vector<int> _H) {
N = _N; H = _H; tree.resize(N * 2);
for (int i = 0; i < N; ++i) tree[i + N] = Node(H[i]);
for (int i = N - 1; i > 0; --i) tree[i] = tree[i * 2] + tree[i * 2 + 1];
waveletH.build(H);
std::vector<int> delta(N);
for (int i = 0; i < N; ++i) {
delta[i] = kInf;
int lft = waveletH.range(0, i, 0, H[i] - 1).max, rgt = waveletH.range(i, N, 0, H[i] - 1).min;
if (lft >= 0) delta[i] = std::min(delta[i], query(lft + 1, i).max - H[i]);
if (rgt < N) delta[i] = std::min(delta[i], query(i + 1, rgt).max - H[i]);
}
waveletDelta.build(delta);
}
int max_towers(int L, int R, int D) {
Node res = waveletDelta.range(L, ++R, D, kInf);
int cnt = res.cnt, lft = res.min, rgt = res.max;
if (cnt == 0) { cnt = 1; lft = rgt = waveletH.range(L, R, 0, query(L, R).min).min; }
cnt += query(L, waveletH.range(L, lft, D + H[lft], kInf).max + 1).minmax >= D;
cnt += query(waveletH.range(rgt, R, D + H[rgt], kInf).min, R).maxmin >= D;
return cnt;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1004 ms |
44460 KB |
Output is correct |
2 |
Correct |
2087 ms |
79224 KB |
Output is correct |
3 |
Correct |
1814 ms |
79272 KB |
Output is correct |
4 |
Correct |
1780 ms |
79156 KB |
Output is correct |
5 |
Correct |
1964 ms |
79204 KB |
Output is correct |
6 |
Correct |
2170 ms |
79172 KB |
Output is correct |
7 |
Correct |
2181 ms |
79088 KB |
Output is correct |
8 |
Correct |
1 ms |
208 KB |
Output is correct |
9 |
Correct |
6 ms |
1512 KB |
Output is correct |
10 |
Correct |
5 ms |
1488 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
464 KB |
Output is correct |
2 |
Correct |
8 ms |
1552 KB |
Output is correct |
3 |
Correct |
8 ms |
1500 KB |
Output is correct |
4 |
Correct |
6 ms |
1532 KB |
Output is correct |
5 |
Correct |
6 ms |
1636 KB |
Output is correct |
6 |
Correct |
9 ms |
1516 KB |
Output is correct |
7 |
Correct |
7 ms |
1488 KB |
Output is correct |
8 |
Correct |
8 ms |
1508 KB |
Output is correct |
9 |
Correct |
6 ms |
1496 KB |
Output is correct |
10 |
Correct |
7 ms |
1488 KB |
Output is correct |
11 |
Correct |
6 ms |
1488 KB |
Output is correct |
12 |
Correct |
1 ms |
208 KB |
Output is correct |
13 |
Correct |
8 ms |
1488 KB |
Output is correct |
14 |
Correct |
8 ms |
1484 KB |
Output is correct |
15 |
Correct |
5 ms |
1488 KB |
Output is correct |
16 |
Correct |
5 ms |
1488 KB |
Output is correct |
17 |
Correct |
8 ms |
1488 KB |
Output is correct |
18 |
Correct |
5 ms |
1476 KB |
Output is correct |
19 |
Correct |
5 ms |
1488 KB |
Output is correct |
20 |
Correct |
7 ms |
1608 KB |
Output is correct |
21 |
Correct |
7 ms |
1488 KB |
Output is correct |
22 |
Correct |
7 ms |
1488 KB |
Output is correct |
23 |
Correct |
5 ms |
1488 KB |
Output is correct |
24 |
Correct |
5 ms |
1488 KB |
Output is correct |
25 |
Correct |
4 ms |
848 KB |
Output is correct |
26 |
Correct |
8 ms |
1492 KB |
Output is correct |
27 |
Correct |
11 ms |
1524 KB |
Output is correct |
28 |
Correct |
8 ms |
1584 KB |
Output is correct |
29 |
Correct |
6 ms |
1500 KB |
Output is correct |
30 |
Correct |
7 ms |
1596 KB |
Output is correct |
31 |
Correct |
5 ms |
1488 KB |
Output is correct |
32 |
Correct |
7 ms |
1492 KB |
Output is correct |
33 |
Correct |
6 ms |
1520 KB |
Output is correct |
34 |
Correct |
7 ms |
1556 KB |
Output is correct |
35 |
Correct |
7 ms |
1548 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
464 KB |
Output is correct |
2 |
Correct |
8 ms |
1552 KB |
Output is correct |
3 |
Correct |
8 ms |
1500 KB |
Output is correct |
4 |
Correct |
6 ms |
1532 KB |
Output is correct |
5 |
Correct |
6 ms |
1636 KB |
Output is correct |
6 |
Correct |
9 ms |
1516 KB |
Output is correct |
7 |
Correct |
7 ms |
1488 KB |
Output is correct |
8 |
Correct |
8 ms |
1508 KB |
Output is correct |
9 |
Correct |
6 ms |
1496 KB |
Output is correct |
10 |
Correct |
7 ms |
1488 KB |
Output is correct |
11 |
Correct |
6 ms |
1488 KB |
Output is correct |
12 |
Correct |
1 ms |
208 KB |
Output is correct |
13 |
Correct |
8 ms |
1488 KB |
Output is correct |
14 |
Correct |
8 ms |
1484 KB |
Output is correct |
15 |
Correct |
5 ms |
1488 KB |
Output is correct |
16 |
Correct |
5 ms |
1488 KB |
Output is correct |
17 |
Correct |
8 ms |
1488 KB |
Output is correct |
18 |
Correct |
5 ms |
1476 KB |
Output is correct |
19 |
Correct |
5 ms |
1488 KB |
Output is correct |
20 |
Correct |
7 ms |
1608 KB |
Output is correct |
21 |
Correct |
7 ms |
1488 KB |
Output is correct |
22 |
Correct |
7 ms |
1488 KB |
Output is correct |
23 |
Correct |
5 ms |
1488 KB |
Output is correct |
24 |
Correct |
5 ms |
1488 KB |
Output is correct |
25 |
Correct |
4 ms |
848 KB |
Output is correct |
26 |
Correct |
8 ms |
1492 KB |
Output is correct |
27 |
Correct |
11 ms |
1524 KB |
Output is correct |
28 |
Correct |
8 ms |
1584 KB |
Output is correct |
29 |
Correct |
6 ms |
1500 KB |
Output is correct |
30 |
Correct |
7 ms |
1596 KB |
Output is correct |
31 |
Correct |
5 ms |
1488 KB |
Output is correct |
32 |
Correct |
7 ms |
1492 KB |
Output is correct |
33 |
Correct |
6 ms |
1520 KB |
Output is correct |
34 |
Correct |
7 ms |
1556 KB |
Output is correct |
35 |
Correct |
7 ms |
1548 KB |
Output is correct |
36 |
Correct |
319 ms |
49100 KB |
Output is correct |
37 |
Correct |
515 ms |
79312 KB |
Output is correct |
38 |
Correct |
567 ms |
79232 KB |
Output is correct |
39 |
Correct |
552 ms |
79340 KB |
Output is correct |
40 |
Correct |
549 ms |
79284 KB |
Output is correct |
41 |
Correct |
516 ms |
79240 KB |
Output is correct |
42 |
Correct |
495 ms |
79208 KB |
Output is correct |
43 |
Correct |
399 ms |
79300 KB |
Output is correct |
44 |
Correct |
322 ms |
79136 KB |
Output is correct |
45 |
Correct |
391 ms |
79160 KB |
Output is correct |
46 |
Correct |
384 ms |
79272 KB |
Output is correct |
47 |
Correct |
621 ms |
79264 KB |
Output is correct |
48 |
Correct |
533 ms |
79268 KB |
Output is correct |
49 |
Correct |
455 ms |
79280 KB |
Output is correct |
50 |
Correct |
382 ms |
79152 KB |
Output is correct |
51 |
Correct |
413 ms |
79164 KB |
Output is correct |
52 |
Correct |
601 ms |
79304 KB |
Output is correct |
53 |
Correct |
548 ms |
79188 KB |
Output is correct |
54 |
Correct |
499 ms |
79272 KB |
Output is correct |
55 |
Correct |
312 ms |
79204 KB |
Output is correct |
56 |
Correct |
336 ms |
79152 KB |
Output is correct |
57 |
Correct |
586 ms |
77312 KB |
Output is correct |
58 |
Correct |
543 ms |
79316 KB |
Output is correct |
59 |
Correct |
525 ms |
79200 KB |
Output is correct |
60 |
Correct |
487 ms |
79224 KB |
Output is correct |
61 |
Correct |
457 ms |
79220 KB |
Output is correct |
62 |
Correct |
578 ms |
79276 KB |
Output is correct |
63 |
Correct |
650 ms |
79340 KB |
Output is correct |
64 |
Correct |
399 ms |
79344 KB |
Output is correct |
65 |
Correct |
404 ms |
79236 KB |
Output is correct |
66 |
Correct |
394 ms |
79208 KB |
Output is correct |
67 |
Correct |
435 ms |
79144 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1745 ms |
78856 KB |
Output is correct |
2 |
Correct |
2011 ms |
79224 KB |
Output is correct |
3 |
Correct |
2098 ms |
79236 KB |
Output is correct |
4 |
Correct |
2085 ms |
79228 KB |
Output is correct |
5 |
Correct |
2142 ms |
79240 KB |
Output is correct |
6 |
Correct |
2197 ms |
79244 KB |
Output is correct |
7 |
Correct |
2180 ms |
79228 KB |
Output is correct |
8 |
Correct |
1897 ms |
79220 KB |
Output is correct |
9 |
Correct |
2149 ms |
79232 KB |
Output is correct |
10 |
Correct |
1786 ms |
79180 KB |
Output is correct |
11 |
Correct |
1912 ms |
79232 KB |
Output is correct |
12 |
Correct |
2183 ms |
79136 KB |
Output is correct |
13 |
Correct |
2031 ms |
79140 KB |
Output is correct |
14 |
Correct |
1 ms |
252 KB |
Output is correct |
15 |
Correct |
7 ms |
1672 KB |
Output is correct |
16 |
Correct |
7 ms |
1548 KB |
Output is correct |
17 |
Correct |
576 ms |
79212 KB |
Output is correct |
18 |
Correct |
462 ms |
79212 KB |
Output is correct |
19 |
Correct |
459 ms |
79280 KB |
Output is correct |
20 |
Correct |
317 ms |
79192 KB |
Output is correct |
21 |
Correct |
313 ms |
79136 KB |
Output is correct |
22 |
Correct |
505 ms |
79264 KB |
Output is correct |
23 |
Correct |
498 ms |
79216 KB |
Output is correct |
24 |
Correct |
530 ms |
79356 KB |
Output is correct |
25 |
Correct |
319 ms |
79216 KB |
Output is correct |
26 |
Correct |
309 ms |
79328 KB |
Output is correct |
27 |
Correct |
6 ms |
1488 KB |
Output is correct |
28 |
Correct |
8 ms |
1488 KB |
Output is correct |
29 |
Correct |
7 ms |
1488 KB |
Output is correct |
30 |
Correct |
4 ms |
1488 KB |
Output is correct |
31 |
Correct |
5 ms |
1488 KB |
Output is correct |
32 |
Correct |
5 ms |
1488 KB |
Output is correct |
33 |
Correct |
16 ms |
1604 KB |
Output is correct |
34 |
Correct |
8 ms |
1488 KB |
Output is correct |
35 |
Correct |
7 ms |
1488 KB |
Output is correct |
36 |
Correct |
5 ms |
1488 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
434 ms |
18520 KB |
Output is correct |
2 |
Correct |
1945 ms |
79324 KB |
Output is correct |
3 |
Correct |
1916 ms |
79276 KB |
Output is correct |
4 |
Correct |
1628 ms |
79244 KB |
Output is correct |
5 |
Correct |
1508 ms |
79212 KB |
Output is correct |
6 |
Correct |
1861 ms |
79224 KB |
Output is correct |
7 |
Correct |
1934 ms |
79236 KB |
Output is correct |
8 |
Correct |
1931 ms |
79208 KB |
Output is correct |
9 |
Correct |
1831 ms |
79076 KB |
Output is correct |
10 |
Correct |
1525 ms |
79220 KB |
Output is correct |
11 |
Correct |
1582 ms |
79248 KB |
Output is correct |
12 |
Correct |
584 ms |
79284 KB |
Output is correct |
13 |
Correct |
566 ms |
79372 KB |
Output is correct |
14 |
Correct |
507 ms |
79280 KB |
Output is correct |
15 |
Correct |
338 ms |
79196 KB |
Output is correct |
16 |
Correct |
340 ms |
79152 KB |
Output is correct |
17 |
Correct |
527 ms |
77340 KB |
Output is correct |
18 |
Correct |
612 ms |
79288 KB |
Output is correct |
19 |
Correct |
601 ms |
79248 KB |
Output is correct |
20 |
Correct |
590 ms |
79260 KB |
Output is correct |
21 |
Correct |
599 ms |
79228 KB |
Output is correct |
22 |
Correct |
560 ms |
79212 KB |
Output is correct |
23 |
Correct |
592 ms |
79336 KB |
Output is correct |
24 |
Correct |
353 ms |
79160 KB |
Output is correct |
25 |
Correct |
309 ms |
79176 KB |
Output is correct |
26 |
Correct |
393 ms |
79312 KB |
Output is correct |
27 |
Correct |
342 ms |
79248 KB |
Output is correct |
28 |
Correct |
6 ms |
1488 KB |
Output is correct |
29 |
Correct |
6 ms |
1488 KB |
Output is correct |
30 |
Correct |
8 ms |
1488 KB |
Output is correct |
31 |
Correct |
5 ms |
1488 KB |
Output is correct |
32 |
Correct |
6 ms |
1488 KB |
Output is correct |
33 |
Correct |
3 ms |
848 KB |
Output is correct |
34 |
Correct |
6 ms |
1488 KB |
Output is correct |
35 |
Correct |
6 ms |
1488 KB |
Output is correct |
36 |
Correct |
8 ms |
1588 KB |
Output is correct |
37 |
Correct |
8 ms |
1488 KB |
Output is correct |
38 |
Correct |
8 ms |
1488 KB |
Output is correct |
39 |
Correct |
6 ms |
1488 KB |
Output is correct |
40 |
Correct |
5 ms |
1488 KB |
Output is correct |
41 |
Correct |
5 ms |
1536 KB |
Output is correct |
42 |
Correct |
7 ms |
1488 KB |
Output is correct |
43 |
Correct |
8 ms |
1592 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
464 KB |
Output is correct |
2 |
Correct |
8 ms |
1552 KB |
Output is correct |
3 |
Correct |
8 ms |
1500 KB |
Output is correct |
4 |
Correct |
6 ms |
1532 KB |
Output is correct |
5 |
Correct |
6 ms |
1636 KB |
Output is correct |
6 |
Correct |
9 ms |
1516 KB |
Output is correct |
7 |
Correct |
7 ms |
1488 KB |
Output is correct |
8 |
Correct |
8 ms |
1508 KB |
Output is correct |
9 |
Correct |
6 ms |
1496 KB |
Output is correct |
10 |
Correct |
7 ms |
1488 KB |
Output is correct |
11 |
Correct |
6 ms |
1488 KB |
Output is correct |
12 |
Correct |
1 ms |
208 KB |
Output is correct |
13 |
Correct |
8 ms |
1488 KB |
Output is correct |
14 |
Correct |
8 ms |
1484 KB |
Output is correct |
15 |
Correct |
5 ms |
1488 KB |
Output is correct |
16 |
Correct |
5 ms |
1488 KB |
Output is correct |
17 |
Correct |
8 ms |
1488 KB |
Output is correct |
18 |
Correct |
5 ms |
1476 KB |
Output is correct |
19 |
Correct |
5 ms |
1488 KB |
Output is correct |
20 |
Correct |
7 ms |
1608 KB |
Output is correct |
21 |
Correct |
7 ms |
1488 KB |
Output is correct |
22 |
Correct |
7 ms |
1488 KB |
Output is correct |
23 |
Correct |
5 ms |
1488 KB |
Output is correct |
24 |
Correct |
5 ms |
1488 KB |
Output is correct |
25 |
Correct |
4 ms |
848 KB |
Output is correct |
26 |
Correct |
8 ms |
1492 KB |
Output is correct |
27 |
Correct |
11 ms |
1524 KB |
Output is correct |
28 |
Correct |
8 ms |
1584 KB |
Output is correct |
29 |
Correct |
6 ms |
1500 KB |
Output is correct |
30 |
Correct |
7 ms |
1596 KB |
Output is correct |
31 |
Correct |
5 ms |
1488 KB |
Output is correct |
32 |
Correct |
7 ms |
1492 KB |
Output is correct |
33 |
Correct |
6 ms |
1520 KB |
Output is correct |
34 |
Correct |
7 ms |
1556 KB |
Output is correct |
35 |
Correct |
7 ms |
1548 KB |
Output is correct |
36 |
Correct |
319 ms |
49100 KB |
Output is correct |
37 |
Correct |
515 ms |
79312 KB |
Output is correct |
38 |
Correct |
567 ms |
79232 KB |
Output is correct |
39 |
Correct |
552 ms |
79340 KB |
Output is correct |
40 |
Correct |
549 ms |
79284 KB |
Output is correct |
41 |
Correct |
516 ms |
79240 KB |
Output is correct |
42 |
Correct |
495 ms |
79208 KB |
Output is correct |
43 |
Correct |
399 ms |
79300 KB |
Output is correct |
44 |
Correct |
322 ms |
79136 KB |
Output is correct |
45 |
Correct |
391 ms |
79160 KB |
Output is correct |
46 |
Correct |
384 ms |
79272 KB |
Output is correct |
47 |
Correct |
621 ms |
79264 KB |
Output is correct |
48 |
Correct |
533 ms |
79268 KB |
Output is correct |
49 |
Correct |
455 ms |
79280 KB |
Output is correct |
50 |
Correct |
382 ms |
79152 KB |
Output is correct |
51 |
Correct |
413 ms |
79164 KB |
Output is correct |
52 |
Correct |
601 ms |
79304 KB |
Output is correct |
53 |
Correct |
548 ms |
79188 KB |
Output is correct |
54 |
Correct |
499 ms |
79272 KB |
Output is correct |
55 |
Correct |
312 ms |
79204 KB |
Output is correct |
56 |
Correct |
336 ms |
79152 KB |
Output is correct |
57 |
Correct |
586 ms |
77312 KB |
Output is correct |
58 |
Correct |
543 ms |
79316 KB |
Output is correct |
59 |
Correct |
525 ms |
79200 KB |
Output is correct |
60 |
Correct |
487 ms |
79224 KB |
Output is correct |
61 |
Correct |
457 ms |
79220 KB |
Output is correct |
62 |
Correct |
578 ms |
79276 KB |
Output is correct |
63 |
Correct |
650 ms |
79340 KB |
Output is correct |
64 |
Correct |
399 ms |
79344 KB |
Output is correct |
65 |
Correct |
404 ms |
79236 KB |
Output is correct |
66 |
Correct |
394 ms |
79208 KB |
Output is correct |
67 |
Correct |
435 ms |
79144 KB |
Output is correct |
68 |
Correct |
1745 ms |
78856 KB |
Output is correct |
69 |
Correct |
2011 ms |
79224 KB |
Output is correct |
70 |
Correct |
2098 ms |
79236 KB |
Output is correct |
71 |
Correct |
2085 ms |
79228 KB |
Output is correct |
72 |
Correct |
2142 ms |
79240 KB |
Output is correct |
73 |
Correct |
2197 ms |
79244 KB |
Output is correct |
74 |
Correct |
2180 ms |
79228 KB |
Output is correct |
75 |
Correct |
1897 ms |
79220 KB |
Output is correct |
76 |
Correct |
2149 ms |
79232 KB |
Output is correct |
77 |
Correct |
1786 ms |
79180 KB |
Output is correct |
78 |
Correct |
1912 ms |
79232 KB |
Output is correct |
79 |
Correct |
2183 ms |
79136 KB |
Output is correct |
80 |
Correct |
2031 ms |
79140 KB |
Output is correct |
81 |
Correct |
1 ms |
252 KB |
Output is correct |
82 |
Correct |
7 ms |
1672 KB |
Output is correct |
83 |
Correct |
7 ms |
1548 KB |
Output is correct |
84 |
Correct |
576 ms |
79212 KB |
Output is correct |
85 |
Correct |
462 ms |
79212 KB |
Output is correct |
86 |
Correct |
459 ms |
79280 KB |
Output is correct |
87 |
Correct |
317 ms |
79192 KB |
Output is correct |
88 |
Correct |
313 ms |
79136 KB |
Output is correct |
89 |
Correct |
505 ms |
79264 KB |
Output is correct |
90 |
Correct |
498 ms |
79216 KB |
Output is correct |
91 |
Correct |
530 ms |
79356 KB |
Output is correct |
92 |
Correct |
319 ms |
79216 KB |
Output is correct |
93 |
Correct |
309 ms |
79328 KB |
Output is correct |
94 |
Correct |
6 ms |
1488 KB |
Output is correct |
95 |
Correct |
8 ms |
1488 KB |
Output is correct |
96 |
Correct |
7 ms |
1488 KB |
Output is correct |
97 |
Correct |
4 ms |
1488 KB |
Output is correct |
98 |
Correct |
5 ms |
1488 KB |
Output is correct |
99 |
Correct |
5 ms |
1488 KB |
Output is correct |
100 |
Correct |
16 ms |
1604 KB |
Output is correct |
101 |
Correct |
8 ms |
1488 KB |
Output is correct |
102 |
Correct |
7 ms |
1488 KB |
Output is correct |
103 |
Correct |
5 ms |
1488 KB |
Output is correct |
104 |
Correct |
1888 ms |
72940 KB |
Output is correct |
105 |
Correct |
1956 ms |
79240 KB |
Output is correct |
106 |
Correct |
1796 ms |
79240 KB |
Output is correct |
107 |
Correct |
1919 ms |
79232 KB |
Output is correct |
108 |
Correct |
1850 ms |
79356 KB |
Output is correct |
109 |
Correct |
2141 ms |
79248 KB |
Output is correct |
110 |
Correct |
2088 ms |
79284 KB |
Output is correct |
111 |
Correct |
2260 ms |
79204 KB |
Output is correct |
112 |
Correct |
2137 ms |
79112 KB |
Output is correct |
113 |
Correct |
1875 ms |
79152 KB |
Output is correct |
114 |
Correct |
2358 ms |
79244 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1004 ms |
44460 KB |
Output is correct |
2 |
Correct |
2087 ms |
79224 KB |
Output is correct |
3 |
Correct |
1814 ms |
79272 KB |
Output is correct |
4 |
Correct |
1780 ms |
79156 KB |
Output is correct |
5 |
Correct |
1964 ms |
79204 KB |
Output is correct |
6 |
Correct |
2170 ms |
79172 KB |
Output is correct |
7 |
Correct |
2181 ms |
79088 KB |
Output is correct |
8 |
Correct |
1 ms |
208 KB |
Output is correct |
9 |
Correct |
6 ms |
1512 KB |
Output is correct |
10 |
Correct |
5 ms |
1488 KB |
Output is correct |
11 |
Correct |
2 ms |
464 KB |
Output is correct |
12 |
Correct |
8 ms |
1552 KB |
Output is correct |
13 |
Correct |
8 ms |
1500 KB |
Output is correct |
14 |
Correct |
6 ms |
1532 KB |
Output is correct |
15 |
Correct |
6 ms |
1636 KB |
Output is correct |
16 |
Correct |
9 ms |
1516 KB |
Output is correct |
17 |
Correct |
7 ms |
1488 KB |
Output is correct |
18 |
Correct |
8 ms |
1508 KB |
Output is correct |
19 |
Correct |
6 ms |
1496 KB |
Output is correct |
20 |
Correct |
7 ms |
1488 KB |
Output is correct |
21 |
Correct |
6 ms |
1488 KB |
Output is correct |
22 |
Correct |
1 ms |
208 KB |
Output is correct |
23 |
Correct |
8 ms |
1488 KB |
Output is correct |
24 |
Correct |
8 ms |
1484 KB |
Output is correct |
25 |
Correct |
5 ms |
1488 KB |
Output is correct |
26 |
Correct |
5 ms |
1488 KB |
Output is correct |
27 |
Correct |
8 ms |
1488 KB |
Output is correct |
28 |
Correct |
5 ms |
1476 KB |
Output is correct |
29 |
Correct |
5 ms |
1488 KB |
Output is correct |
30 |
Correct |
7 ms |
1608 KB |
Output is correct |
31 |
Correct |
7 ms |
1488 KB |
Output is correct |
32 |
Correct |
7 ms |
1488 KB |
Output is correct |
33 |
Correct |
5 ms |
1488 KB |
Output is correct |
34 |
Correct |
5 ms |
1488 KB |
Output is correct |
35 |
Correct |
4 ms |
848 KB |
Output is correct |
36 |
Correct |
8 ms |
1492 KB |
Output is correct |
37 |
Correct |
11 ms |
1524 KB |
Output is correct |
38 |
Correct |
8 ms |
1584 KB |
Output is correct |
39 |
Correct |
6 ms |
1500 KB |
Output is correct |
40 |
Correct |
7 ms |
1596 KB |
Output is correct |
41 |
Correct |
5 ms |
1488 KB |
Output is correct |
42 |
Correct |
7 ms |
1492 KB |
Output is correct |
43 |
Correct |
6 ms |
1520 KB |
Output is correct |
44 |
Correct |
7 ms |
1556 KB |
Output is correct |
45 |
Correct |
7 ms |
1548 KB |
Output is correct |
46 |
Correct |
319 ms |
49100 KB |
Output is correct |
47 |
Correct |
515 ms |
79312 KB |
Output is correct |
48 |
Correct |
567 ms |
79232 KB |
Output is correct |
49 |
Correct |
552 ms |
79340 KB |
Output is correct |
50 |
Correct |
549 ms |
79284 KB |
Output is correct |
51 |
Correct |
516 ms |
79240 KB |
Output is correct |
52 |
Correct |
495 ms |
79208 KB |
Output is correct |
53 |
Correct |
399 ms |
79300 KB |
Output is correct |
54 |
Correct |
322 ms |
79136 KB |
Output is correct |
55 |
Correct |
391 ms |
79160 KB |
Output is correct |
56 |
Correct |
384 ms |
79272 KB |
Output is correct |
57 |
Correct |
621 ms |
79264 KB |
Output is correct |
58 |
Correct |
533 ms |
79268 KB |
Output is correct |
59 |
Correct |
455 ms |
79280 KB |
Output is correct |
60 |
Correct |
382 ms |
79152 KB |
Output is correct |
61 |
Correct |
413 ms |
79164 KB |
Output is correct |
62 |
Correct |
601 ms |
79304 KB |
Output is correct |
63 |
Correct |
548 ms |
79188 KB |
Output is correct |
64 |
Correct |
499 ms |
79272 KB |
Output is correct |
65 |
Correct |
312 ms |
79204 KB |
Output is correct |
66 |
Correct |
336 ms |
79152 KB |
Output is correct |
67 |
Correct |
586 ms |
77312 KB |
Output is correct |
68 |
Correct |
543 ms |
79316 KB |
Output is correct |
69 |
Correct |
525 ms |
79200 KB |
Output is correct |
70 |
Correct |
487 ms |
79224 KB |
Output is correct |
71 |
Correct |
457 ms |
79220 KB |
Output is correct |
72 |
Correct |
578 ms |
79276 KB |
Output is correct |
73 |
Correct |
650 ms |
79340 KB |
Output is correct |
74 |
Correct |
399 ms |
79344 KB |
Output is correct |
75 |
Correct |
404 ms |
79236 KB |
Output is correct |
76 |
Correct |
394 ms |
79208 KB |
Output is correct |
77 |
Correct |
435 ms |
79144 KB |
Output is correct |
78 |
Correct |
1745 ms |
78856 KB |
Output is correct |
79 |
Correct |
2011 ms |
79224 KB |
Output is correct |
80 |
Correct |
2098 ms |
79236 KB |
Output is correct |
81 |
Correct |
2085 ms |
79228 KB |
Output is correct |
82 |
Correct |
2142 ms |
79240 KB |
Output is correct |
83 |
Correct |
2197 ms |
79244 KB |
Output is correct |
84 |
Correct |
2180 ms |
79228 KB |
Output is correct |
85 |
Correct |
1897 ms |
79220 KB |
Output is correct |
86 |
Correct |
2149 ms |
79232 KB |
Output is correct |
87 |
Correct |
1786 ms |
79180 KB |
Output is correct |
88 |
Correct |
1912 ms |
79232 KB |
Output is correct |
89 |
Correct |
2183 ms |
79136 KB |
Output is correct |
90 |
Correct |
2031 ms |
79140 KB |
Output is correct |
91 |
Correct |
1 ms |
252 KB |
Output is correct |
92 |
Correct |
7 ms |
1672 KB |
Output is correct |
93 |
Correct |
7 ms |
1548 KB |
Output is correct |
94 |
Correct |
576 ms |
79212 KB |
Output is correct |
95 |
Correct |
462 ms |
79212 KB |
Output is correct |
96 |
Correct |
459 ms |
79280 KB |
Output is correct |
97 |
Correct |
317 ms |
79192 KB |
Output is correct |
98 |
Correct |
313 ms |
79136 KB |
Output is correct |
99 |
Correct |
505 ms |
79264 KB |
Output is correct |
100 |
Correct |
498 ms |
79216 KB |
Output is correct |
101 |
Correct |
530 ms |
79356 KB |
Output is correct |
102 |
Correct |
319 ms |
79216 KB |
Output is correct |
103 |
Correct |
309 ms |
79328 KB |
Output is correct |
104 |
Correct |
6 ms |
1488 KB |
Output is correct |
105 |
Correct |
8 ms |
1488 KB |
Output is correct |
106 |
Correct |
7 ms |
1488 KB |
Output is correct |
107 |
Correct |
4 ms |
1488 KB |
Output is correct |
108 |
Correct |
5 ms |
1488 KB |
Output is correct |
109 |
Correct |
5 ms |
1488 KB |
Output is correct |
110 |
Correct |
16 ms |
1604 KB |
Output is correct |
111 |
Correct |
8 ms |
1488 KB |
Output is correct |
112 |
Correct |
7 ms |
1488 KB |
Output is correct |
113 |
Correct |
5 ms |
1488 KB |
Output is correct |
114 |
Correct |
434 ms |
18520 KB |
Output is correct |
115 |
Correct |
1945 ms |
79324 KB |
Output is correct |
116 |
Correct |
1916 ms |
79276 KB |
Output is correct |
117 |
Correct |
1628 ms |
79244 KB |
Output is correct |
118 |
Correct |
1508 ms |
79212 KB |
Output is correct |
119 |
Correct |
1861 ms |
79224 KB |
Output is correct |
120 |
Correct |
1934 ms |
79236 KB |
Output is correct |
121 |
Correct |
1931 ms |
79208 KB |
Output is correct |
122 |
Correct |
1831 ms |
79076 KB |
Output is correct |
123 |
Correct |
1525 ms |
79220 KB |
Output is correct |
124 |
Correct |
1582 ms |
79248 KB |
Output is correct |
125 |
Correct |
584 ms |
79284 KB |
Output is correct |
126 |
Correct |
566 ms |
79372 KB |
Output is correct |
127 |
Correct |
507 ms |
79280 KB |
Output is correct |
128 |
Correct |
338 ms |
79196 KB |
Output is correct |
129 |
Correct |
340 ms |
79152 KB |
Output is correct |
130 |
Correct |
527 ms |
77340 KB |
Output is correct |
131 |
Correct |
612 ms |
79288 KB |
Output is correct |
132 |
Correct |
601 ms |
79248 KB |
Output is correct |
133 |
Correct |
590 ms |
79260 KB |
Output is correct |
134 |
Correct |
599 ms |
79228 KB |
Output is correct |
135 |
Correct |
560 ms |
79212 KB |
Output is correct |
136 |
Correct |
592 ms |
79336 KB |
Output is correct |
137 |
Correct |
353 ms |
79160 KB |
Output is correct |
138 |
Correct |
309 ms |
79176 KB |
Output is correct |
139 |
Correct |
393 ms |
79312 KB |
Output is correct |
140 |
Correct |
342 ms |
79248 KB |
Output is correct |
141 |
Correct |
6 ms |
1488 KB |
Output is correct |
142 |
Correct |
6 ms |
1488 KB |
Output is correct |
143 |
Correct |
8 ms |
1488 KB |
Output is correct |
144 |
Correct |
5 ms |
1488 KB |
Output is correct |
145 |
Correct |
6 ms |
1488 KB |
Output is correct |
146 |
Correct |
3 ms |
848 KB |
Output is correct |
147 |
Correct |
6 ms |
1488 KB |
Output is correct |
148 |
Correct |
6 ms |
1488 KB |
Output is correct |
149 |
Correct |
8 ms |
1588 KB |
Output is correct |
150 |
Correct |
8 ms |
1488 KB |
Output is correct |
151 |
Correct |
8 ms |
1488 KB |
Output is correct |
152 |
Correct |
6 ms |
1488 KB |
Output is correct |
153 |
Correct |
5 ms |
1488 KB |
Output is correct |
154 |
Correct |
5 ms |
1536 KB |
Output is correct |
155 |
Correct |
7 ms |
1488 KB |
Output is correct |
156 |
Correct |
8 ms |
1592 KB |
Output is correct |
157 |
Correct |
1888 ms |
72940 KB |
Output is correct |
158 |
Correct |
1956 ms |
79240 KB |
Output is correct |
159 |
Correct |
1796 ms |
79240 KB |
Output is correct |
160 |
Correct |
1919 ms |
79232 KB |
Output is correct |
161 |
Correct |
1850 ms |
79356 KB |
Output is correct |
162 |
Correct |
2141 ms |
79248 KB |
Output is correct |
163 |
Correct |
2088 ms |
79284 KB |
Output is correct |
164 |
Correct |
2260 ms |
79204 KB |
Output is correct |
165 |
Correct |
2137 ms |
79112 KB |
Output is correct |
166 |
Correct |
1875 ms |
79152 KB |
Output is correct |
167 |
Correct |
2358 ms |
79244 KB |
Output is correct |
168 |
Correct |
0 ms |
208 KB |
Output is correct |
169 |
Correct |
1294 ms |
29952 KB |
Output is correct |
170 |
Execution timed out |
2604 ms |
79280 KB |
Time limit exceeded |
171 |
Halted |
0 ms |
0 KB |
- |