#include <bits/stdc++.h>
using namespace std;
using i32 = int;
using i64 = long long;
template <typename T>
using V = vector<T>;
template <typename T>
using VV = V<V<T>>;
template <typename T>
using VVV = V<V<V<T>>>;
template <typename T>
bool chmin(T &x, const T &y) {
if (x > y) {
x = y;
return true;
}
return false;
}
template <typename T>
bool chmax(T &x, const T &y) {
if (x < y) {
x = y;
return true;
}
return false;
}
#define OVERRIDE4(a, b, c, d, ...) d
#define REP2(i, n) for (i32 i = 0; i < (i32)(n); ++i)
#define REP3(i, l, r) for (i32 i = (i32)(l); i < (i32)(r); ++i)
#define REP(...) OVERRIDE4(__VA_ARGS__, REP3, REP2)(__VA_ARGS__)
#define PER2(i, n) for (i32 i = (i32)(n)-1; i >= 0; --i)
#define PER3(i, l, r) for (i32 i = (i32)(r)-1; i >= (i32)(l); --i)
#define PER(...) OVERRIDE4(__VA_ARGS__, PER3, PER2)(__VA_ARGS__)
#define ALL(x) begin(x), end(x)
#define LEN(x) (i32) size(x)
void dbg(i32 x) { cerr << x; }
void dbg(i64 x) { cerr << x; }
template <typename T, typename U>
void dbg(pair<T, U> p) {
cerr << '(' << p.first << ", " << p.second << ')';
}
template <typename T>
void dbg(V<T> arr) {
cerr << '[';
REP(i, LEN(arr)) {
if (i) {
cerr << ", ";
}
dbg(arr[i]);
}
cerr << ']';
}
void debug() { cerr << '\n'; }
template <typename Head, typename... Tail>
void debug(Head head, Tail... tail) {
dbg(head);
cerr << ", ";
debug(tail...);
}
#ifdef DEBUGF
#define DBG(...) \
do { \
cerr << #__VA_ARGS__ << " : "; \
debug(__VA_ARGS__); \
} while (false)
#else
#define DBG(...) (void)0
#endif
#include "towers.h"
constexpr i32 INF = 1001001001;
template <typename T>
i32 lob(const V<T> &arr, T v) {
return (i32)(lower_bound(ALL(arr), v) - begin(arr));
}
template <typename T>
i32 upb(const V<T> &arr, T v) {
return (i32)(upper_bound(ALL(arr), v) - begin(arr));
}
struct RMQ {
i32 n;
V<i32> dat;
RMQ(i32 n) : n(n), dat(2 * n, -INF) {}
void update(i32 idx, i32 val) {
idx += n;
dat[idx] = val;
while ((idx /= 2) >= 1) {
dat[idx] = max(dat[2 * idx], dat[2 * idx + 1]);
}
}
i32 rmq(i32 l, i32 r) const {
l += n;
r += n;
i32 m = -INF;
while (l < r) {
if (l & 1) {
chmax(m, dat[l++]);
}
if (r & 1) {
chmax(m, dat[--r]);
}
l /= 2;
r /= 2;
}
return m;
}
void trc() const {
V<i32> arr(n + ALL(dat));
DBG(arr);
}
};
template <typename T>
class RemovableQueue {
priority_queue<T, V<T>, greater<>> pq, rm;
public:
RemovableQueue() : pq(), rm() {}
void add(T x) {
pq.push(x);
}
void remove(T x) {
rm.push(x);
}
T getmin() {
while (!rm.empty() && rm.top() == pq.top()) {
rm.pop();
pq.pop();
}
return pq.top();
}
i32 size() const {
return (i32)pq.size() - (i32)rm.size();
}
};
V<pair<i32, i32>> calc_all_ans(i32 n, V<i32> h) {
V<pair<i32, i32>> ret;
V<i32> down(n, 0), up(n, 0);
REP(i, 1, n - 1) {
if (h[i - 1] < h[i] && h[i] > h[i + 1]) {
up[i] = 1;
}
if (h[i - 1] > h[i] && h[i] < h[i + 1]) {
down[i] = 1;
}
}
if (accumulate(ALL(up), 0) == 0) {
ret.emplace_back(1, 1);
return ret;
}
i32 l = 0;
while (h[l] > h[l + 1]) {
++l;
}
i32 r = n;
while (h[r - 2] < h[r - 1]) {
--r;
}
down[l] = down[r - 1] = 1;
V<i32> imp;
REP(i, n) {
if (down[i] || up[i]) {
imp.push_back(i);
}
}
DBG(imp);
RemovableQueue<tuple<i32, i32, i32>> pq;
V<i32> lft(LEN(imp), -1), rgt(LEN(imp), -1);
REP(i, LEN(imp) - 1) {
pq.add(make_tuple(abs(h[imp[i]] - h[imp[i + 1]]), i, i + 1));
lft[i + 1] = i;
rgt[i] = i + 1;
}
ret.emplace_back(1, LEN(pq) / 2 + 1);
while (LEN(pq) >= 2) {
auto [d, l, r] = pq.getmin();
ret.emplace_back(d + 1, LEN(pq) / 2);
pq.remove(make_tuple(d, l, r));
i32 ll = lft[l], rr = rgt[r];
DBG(d, l, r, ll, rr);
if (ll != -1) {
pq.remove(make_tuple(abs(h[imp[ll]] - h[imp[l]]), ll, l));
rgt[ll] = rr;
}
if (rr != -1) {
pq.remove(make_tuple(abs(h[imp[r]] - h[imp[rr]]), r, rr));
lft[rr] = ll;
}
if (ll != -1 && rr != -1) {
pq.add(make_tuple(abs(h[imp[ll]] - h[imp[rr]]), ll, rr));
}
}
V<pair<i32, i32>> simp;
REP(i, LEN(ret)) {
if (i == LEN(ret) - 1 || ret[i].first != ret[i + 1].first) {
simp.push_back(ret[i]);
}
}
ret = simp;
DBG(ret);
return ret;
}
i32 n;
V<i32> h;
V<i32> psum;
i32 peak;
V<pair<i32, i32>> allans;
void init(i32 _n, V<i32> _h) {
n = _n;
h = _h;
psum.resize(n + 1, 0);
REP(i, n) {
psum[i + 1] = psum[i] + (0 < i && i < n - 1 && h[i - 1] < h[i] && h[i] > h[i + 1]);
}
{
i32 mi = (i32)(max_element(ALL(h)) - begin(h));
peak = mi;
REP(i, mi) {
if (h[i] > h[i + 1]) {
peak = -1;
}
}
REP(i, mi, n - 1) {
if (h[i] < h[i + 1]) {
peak = -1;
}
}
}
allans = calc_all_ans(n, h);
}
i32 max_towers(i32 l, i32 r, i32 delta) {
++r;
if (r - l == 1) {
return 1;
}
if (delta == 1) {
i32 ans = psum[r - 1] - psum[l + 1] + 1;
return ans;
}
if (peak != -1) {
if (l <= peak && peak < r && max(h[l], h[r - 1]) + delta <= h[peak]) {
return 2;
} else {
return 1;
}
}
if (l == 0 && r == n) {
auto itr = lower_bound(ALL(allans), pair<i32, i32>(delta + 1, 0));
--itr;
return itr->second;
}
V<i32> g(begin(h) + l, begin(h) + r);
i32 m = r - l;
V<i32> hs;
hs.reserve(3 * m);
REP(i, m) {
hs.push_back(g[i] - delta);
hs.push_back(g[i]);
hs.push_back(g[i] + delta);
}
sort(ALL(hs));
hs.erase(unique(ALL(hs)), end(hs));
i32 k = LEN(hs);
RMQ down(k);
RMQ up(k);
REP(i, m) {
i32 d = max(1, up.rmq(lob(hs, g[i] + delta), k) + 1);
i32 u = down.rmq(0, lob(hs, g[i] - delta) + 1);
i32 idx = lob(hs, g[i]);
down.update(idx, d);
up.update(idx, u);
}
i32 ans = down.rmq(0, k);
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
228 ms |
1880 KB |
Output is correct |
2 |
Correct |
584 ms |
3160 KB |
Output is correct |
3 |
Correct |
486 ms |
3160 KB |
Output is correct |
4 |
Correct |
525 ms |
3160 KB |
Output is correct |
5 |
Correct |
538 ms |
3160 KB |
Output is correct |
6 |
Correct |
527 ms |
3160 KB |
Output is correct |
7 |
Correct |
492 ms |
3160 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
568 KB |
Output is correct |
7 |
Correct |
1 ms |
344 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
1 ms |
344 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
0 ms |
344 KB |
Output is correct |
12 |
Correct |
0 ms |
344 KB |
Output is correct |
13 |
Correct |
0 ms |
344 KB |
Output is correct |
14 |
Correct |
1 ms |
344 KB |
Output is correct |
15 |
Correct |
1 ms |
344 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
344 KB |
Output is correct |
18 |
Correct |
0 ms |
344 KB |
Output is correct |
19 |
Correct |
0 ms |
344 KB |
Output is correct |
20 |
Correct |
1 ms |
344 KB |
Output is correct |
21 |
Correct |
2 ms |
344 KB |
Output is correct |
22 |
Correct |
1 ms |
344 KB |
Output is correct |
23 |
Correct |
0 ms |
344 KB |
Output is correct |
24 |
Correct |
1 ms |
344 KB |
Output is correct |
25 |
Correct |
1 ms |
344 KB |
Output is correct |
26 |
Correct |
1 ms |
344 KB |
Output is correct |
27 |
Correct |
1 ms |
344 KB |
Output is correct |
28 |
Correct |
1 ms |
344 KB |
Output is correct |
29 |
Correct |
1 ms |
344 KB |
Output is correct |
30 |
Correct |
1 ms |
408 KB |
Output is correct |
31 |
Correct |
1 ms |
344 KB |
Output is correct |
32 |
Correct |
0 ms |
344 KB |
Output is correct |
33 |
Correct |
1 ms |
344 KB |
Output is correct |
34 |
Correct |
0 ms |
344 KB |
Output is correct |
35 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
568 KB |
Output is correct |
7 |
Correct |
1 ms |
344 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
1 ms |
344 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
0 ms |
344 KB |
Output is correct |
12 |
Correct |
0 ms |
344 KB |
Output is correct |
13 |
Correct |
0 ms |
344 KB |
Output is correct |
14 |
Correct |
1 ms |
344 KB |
Output is correct |
15 |
Correct |
1 ms |
344 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
344 KB |
Output is correct |
18 |
Correct |
0 ms |
344 KB |
Output is correct |
19 |
Correct |
0 ms |
344 KB |
Output is correct |
20 |
Correct |
1 ms |
344 KB |
Output is correct |
21 |
Correct |
2 ms |
344 KB |
Output is correct |
22 |
Correct |
1 ms |
344 KB |
Output is correct |
23 |
Correct |
0 ms |
344 KB |
Output is correct |
24 |
Correct |
1 ms |
344 KB |
Output is correct |
25 |
Correct |
1 ms |
344 KB |
Output is correct |
26 |
Correct |
1 ms |
344 KB |
Output is correct |
27 |
Correct |
1 ms |
344 KB |
Output is correct |
28 |
Correct |
1 ms |
344 KB |
Output is correct |
29 |
Correct |
1 ms |
344 KB |
Output is correct |
30 |
Correct |
1 ms |
408 KB |
Output is correct |
31 |
Correct |
1 ms |
344 KB |
Output is correct |
32 |
Correct |
0 ms |
344 KB |
Output is correct |
33 |
Correct |
1 ms |
344 KB |
Output is correct |
34 |
Correct |
0 ms |
344 KB |
Output is correct |
35 |
Correct |
0 ms |
344 KB |
Output is correct |
36 |
Correct |
41 ms |
3908 KB |
Output is correct |
37 |
Correct |
56 ms |
5952 KB |
Output is correct |
38 |
Correct |
38 ms |
5960 KB |
Output is correct |
39 |
Correct |
60 ms |
6976 KB |
Output is correct |
40 |
Correct |
52 ms |
7132 KB |
Output is correct |
41 |
Correct |
95 ms |
7668 KB |
Output is correct |
42 |
Correct |
40 ms |
6976 KB |
Output is correct |
43 |
Correct |
13 ms |
3040 KB |
Output is correct |
44 |
Correct |
8 ms |
3160 KB |
Output is correct |
45 |
Correct |
9 ms |
3160 KB |
Output is correct |
46 |
Correct |
9 ms |
3132 KB |
Output is correct |
47 |
Correct |
30 ms |
5960 KB |
Output is correct |
48 |
Correct |
51 ms |
6948 KB |
Output is correct |
49 |
Correct |
46 ms |
7144 KB |
Output is correct |
50 |
Correct |
8 ms |
3160 KB |
Output is correct |
51 |
Correct |
13 ms |
3160 KB |
Output is correct |
52 |
Correct |
30 ms |
5960 KB |
Output is correct |
53 |
Correct |
46 ms |
6976 KB |
Output is correct |
54 |
Correct |
41 ms |
6976 KB |
Output is correct |
55 |
Correct |
13 ms |
3160 KB |
Output is correct |
56 |
Correct |
8 ms |
2988 KB |
Output is correct |
57 |
Correct |
28 ms |
5444 KB |
Output is correct |
58 |
Correct |
36 ms |
5844 KB |
Output is correct |
59 |
Correct |
31 ms |
5952 KB |
Output is correct |
60 |
Correct |
51 ms |
6976 KB |
Output is correct |
61 |
Correct |
41 ms |
6976 KB |
Output is correct |
62 |
Correct |
42 ms |
7148 KB |
Output is correct |
63 |
Correct |
40 ms |
7128 KB |
Output is correct |
64 |
Correct |
8 ms |
3160 KB |
Output is correct |
65 |
Correct |
8 ms |
2992 KB |
Output is correct |
66 |
Correct |
8 ms |
3160 KB |
Output is correct |
67 |
Correct |
12 ms |
3132 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
380 ms |
5868 KB |
Output is correct |
2 |
Correct |
468 ms |
5952 KB |
Output is correct |
3 |
Correct |
525 ms |
5952 KB |
Output is correct |
4 |
Correct |
535 ms |
6976 KB |
Output is correct |
5 |
Correct |
511 ms |
6972 KB |
Output is correct |
6 |
Correct |
542 ms |
6976 KB |
Output is correct |
7 |
Correct |
546 ms |
6976 KB |
Output is correct |
8 |
Correct |
469 ms |
3160 KB |
Output is correct |
9 |
Correct |
426 ms |
3136 KB |
Output is correct |
10 |
Correct |
508 ms |
3160 KB |
Output is correct |
11 |
Correct |
392 ms |
3160 KB |
Output is correct |
12 |
Correct |
466 ms |
3160 KB |
Output is correct |
13 |
Correct |
470 ms |
3132 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
0 ms |
344 KB |
Output is correct |
16 |
Correct |
1 ms |
344 KB |
Output is correct |
17 |
Correct |
29 ms |
5912 KB |
Output is correct |
18 |
Correct |
53 ms |
6976 KB |
Output is correct |
19 |
Correct |
46 ms |
7144 KB |
Output is correct |
20 |
Correct |
8 ms |
3160 KB |
Output is correct |
21 |
Correct |
12 ms |
3136 KB |
Output is correct |
22 |
Correct |
30 ms |
5952 KB |
Output is correct |
23 |
Correct |
42 ms |
6948 KB |
Output is correct |
24 |
Correct |
41 ms |
6976 KB |
Output is correct |
25 |
Correct |
10 ms |
3160 KB |
Output is correct |
26 |
Correct |
16 ms |
3132 KB |
Output is correct |
27 |
Correct |
1 ms |
344 KB |
Output is correct |
28 |
Correct |
1 ms |
344 KB |
Output is correct |
29 |
Correct |
1 ms |
344 KB |
Output is correct |
30 |
Correct |
0 ms |
344 KB |
Output is correct |
31 |
Correct |
0 ms |
344 KB |
Output is correct |
32 |
Correct |
1 ms |
344 KB |
Output is correct |
33 |
Correct |
1 ms |
344 KB |
Output is correct |
34 |
Correct |
1 ms |
344 KB |
Output is correct |
35 |
Correct |
0 ms |
344 KB |
Output is correct |
36 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
183 ms |
1608 KB |
Output is correct |
2 |
Correct |
578 ms |
5952 KB |
Output is correct |
3 |
Correct |
557 ms |
5952 KB |
Output is correct |
4 |
Correct |
561 ms |
7048 KB |
Output is correct |
5 |
Correct |
563 ms |
6912 KB |
Output is correct |
6 |
Correct |
547 ms |
6960 KB |
Output is correct |
7 |
Correct |
581 ms |
6976 KB |
Output is correct |
8 |
Correct |
452 ms |
3160 KB |
Output is correct |
9 |
Correct |
489 ms |
3160 KB |
Output is correct |
10 |
Correct |
469 ms |
3160 KB |
Output is correct |
11 |
Correct |
433 ms |
3160 KB |
Output is correct |
12 |
Correct |
30 ms |
5996 KB |
Output is correct |
13 |
Correct |
41 ms |
7000 KB |
Output is correct |
14 |
Correct |
54 ms |
6952 KB |
Output is correct |
15 |
Correct |
8 ms |
3160 KB |
Output is correct |
16 |
Correct |
8 ms |
3160 KB |
Output is correct |
17 |
Correct |
29 ms |
5640 KB |
Output is correct |
18 |
Correct |
30 ms |
5960 KB |
Output is correct |
19 |
Correct |
35 ms |
5952 KB |
Output is correct |
20 |
Correct |
53 ms |
6896 KB |
Output is correct |
21 |
Correct |
40 ms |
6928 KB |
Output is correct |
22 |
Correct |
42 ms |
6976 KB |
Output is correct |
23 |
Correct |
40 ms |
7020 KB |
Output is correct |
24 |
Correct |
8 ms |
3160 KB |
Output is correct |
25 |
Correct |
14 ms |
3136 KB |
Output is correct |
26 |
Correct |
8 ms |
3140 KB |
Output is correct |
27 |
Correct |
8 ms |
3160 KB |
Output is correct |
28 |
Correct |
1 ms |
344 KB |
Output is correct |
29 |
Correct |
1 ms |
344 KB |
Output is correct |
30 |
Correct |
1 ms |
344 KB |
Output is correct |
31 |
Correct |
0 ms |
344 KB |
Output is correct |
32 |
Correct |
0 ms |
344 KB |
Output is correct |
33 |
Correct |
0 ms |
344 KB |
Output is correct |
34 |
Correct |
1 ms |
344 KB |
Output is correct |
35 |
Correct |
1 ms |
344 KB |
Output is correct |
36 |
Correct |
1 ms |
344 KB |
Output is correct |
37 |
Correct |
1 ms |
344 KB |
Output is correct |
38 |
Correct |
1 ms |
344 KB |
Output is correct |
39 |
Correct |
1 ms |
344 KB |
Output is correct |
40 |
Correct |
0 ms |
344 KB |
Output is correct |
41 |
Correct |
0 ms |
344 KB |
Output is correct |
42 |
Correct |
1 ms |
344 KB |
Output is correct |
43 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
568 KB |
Output is correct |
7 |
Correct |
1 ms |
344 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
1 ms |
344 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
0 ms |
344 KB |
Output is correct |
12 |
Correct |
0 ms |
344 KB |
Output is correct |
13 |
Correct |
0 ms |
344 KB |
Output is correct |
14 |
Correct |
1 ms |
344 KB |
Output is correct |
15 |
Correct |
1 ms |
344 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
344 KB |
Output is correct |
18 |
Correct |
0 ms |
344 KB |
Output is correct |
19 |
Correct |
0 ms |
344 KB |
Output is correct |
20 |
Correct |
1 ms |
344 KB |
Output is correct |
21 |
Correct |
2 ms |
344 KB |
Output is correct |
22 |
Correct |
1 ms |
344 KB |
Output is correct |
23 |
Correct |
0 ms |
344 KB |
Output is correct |
24 |
Correct |
1 ms |
344 KB |
Output is correct |
25 |
Correct |
1 ms |
344 KB |
Output is correct |
26 |
Correct |
1 ms |
344 KB |
Output is correct |
27 |
Correct |
1 ms |
344 KB |
Output is correct |
28 |
Correct |
1 ms |
344 KB |
Output is correct |
29 |
Correct |
1 ms |
344 KB |
Output is correct |
30 |
Correct |
1 ms |
408 KB |
Output is correct |
31 |
Correct |
1 ms |
344 KB |
Output is correct |
32 |
Correct |
0 ms |
344 KB |
Output is correct |
33 |
Correct |
1 ms |
344 KB |
Output is correct |
34 |
Correct |
0 ms |
344 KB |
Output is correct |
35 |
Correct |
0 ms |
344 KB |
Output is correct |
36 |
Correct |
41 ms |
3908 KB |
Output is correct |
37 |
Correct |
56 ms |
5952 KB |
Output is correct |
38 |
Correct |
38 ms |
5960 KB |
Output is correct |
39 |
Correct |
60 ms |
6976 KB |
Output is correct |
40 |
Correct |
52 ms |
7132 KB |
Output is correct |
41 |
Correct |
95 ms |
7668 KB |
Output is correct |
42 |
Correct |
40 ms |
6976 KB |
Output is correct |
43 |
Correct |
13 ms |
3040 KB |
Output is correct |
44 |
Correct |
8 ms |
3160 KB |
Output is correct |
45 |
Correct |
9 ms |
3160 KB |
Output is correct |
46 |
Correct |
9 ms |
3132 KB |
Output is correct |
47 |
Correct |
30 ms |
5960 KB |
Output is correct |
48 |
Correct |
51 ms |
6948 KB |
Output is correct |
49 |
Correct |
46 ms |
7144 KB |
Output is correct |
50 |
Correct |
8 ms |
3160 KB |
Output is correct |
51 |
Correct |
13 ms |
3160 KB |
Output is correct |
52 |
Correct |
30 ms |
5960 KB |
Output is correct |
53 |
Correct |
46 ms |
6976 KB |
Output is correct |
54 |
Correct |
41 ms |
6976 KB |
Output is correct |
55 |
Correct |
13 ms |
3160 KB |
Output is correct |
56 |
Correct |
8 ms |
2988 KB |
Output is correct |
57 |
Correct |
28 ms |
5444 KB |
Output is correct |
58 |
Correct |
36 ms |
5844 KB |
Output is correct |
59 |
Correct |
31 ms |
5952 KB |
Output is correct |
60 |
Correct |
51 ms |
6976 KB |
Output is correct |
61 |
Correct |
41 ms |
6976 KB |
Output is correct |
62 |
Correct |
42 ms |
7148 KB |
Output is correct |
63 |
Correct |
40 ms |
7128 KB |
Output is correct |
64 |
Correct |
8 ms |
3160 KB |
Output is correct |
65 |
Correct |
8 ms |
2992 KB |
Output is correct |
66 |
Correct |
8 ms |
3160 KB |
Output is correct |
67 |
Correct |
12 ms |
3132 KB |
Output is correct |
68 |
Correct |
380 ms |
5868 KB |
Output is correct |
69 |
Correct |
468 ms |
5952 KB |
Output is correct |
70 |
Correct |
525 ms |
5952 KB |
Output is correct |
71 |
Correct |
535 ms |
6976 KB |
Output is correct |
72 |
Correct |
511 ms |
6972 KB |
Output is correct |
73 |
Correct |
542 ms |
6976 KB |
Output is correct |
74 |
Correct |
546 ms |
6976 KB |
Output is correct |
75 |
Correct |
469 ms |
3160 KB |
Output is correct |
76 |
Correct |
426 ms |
3136 KB |
Output is correct |
77 |
Correct |
508 ms |
3160 KB |
Output is correct |
78 |
Correct |
392 ms |
3160 KB |
Output is correct |
79 |
Correct |
466 ms |
3160 KB |
Output is correct |
80 |
Correct |
470 ms |
3132 KB |
Output is correct |
81 |
Correct |
1 ms |
340 KB |
Output is correct |
82 |
Correct |
0 ms |
344 KB |
Output is correct |
83 |
Correct |
1 ms |
344 KB |
Output is correct |
84 |
Correct |
29 ms |
5912 KB |
Output is correct |
85 |
Correct |
53 ms |
6976 KB |
Output is correct |
86 |
Correct |
46 ms |
7144 KB |
Output is correct |
87 |
Correct |
8 ms |
3160 KB |
Output is correct |
88 |
Correct |
12 ms |
3136 KB |
Output is correct |
89 |
Correct |
30 ms |
5952 KB |
Output is correct |
90 |
Correct |
42 ms |
6948 KB |
Output is correct |
91 |
Correct |
41 ms |
6976 KB |
Output is correct |
92 |
Correct |
10 ms |
3160 KB |
Output is correct |
93 |
Correct |
16 ms |
3132 KB |
Output is correct |
94 |
Correct |
1 ms |
344 KB |
Output is correct |
95 |
Correct |
1 ms |
344 KB |
Output is correct |
96 |
Correct |
1 ms |
344 KB |
Output is correct |
97 |
Correct |
0 ms |
344 KB |
Output is correct |
98 |
Correct |
0 ms |
344 KB |
Output is correct |
99 |
Correct |
1 ms |
344 KB |
Output is correct |
100 |
Correct |
1 ms |
344 KB |
Output is correct |
101 |
Correct |
1 ms |
344 KB |
Output is correct |
102 |
Correct |
0 ms |
344 KB |
Output is correct |
103 |
Correct |
1 ms |
344 KB |
Output is correct |
104 |
Execution timed out |
4040 ms |
7384 KB |
Time limit exceeded |
105 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
228 ms |
1880 KB |
Output is correct |
2 |
Correct |
584 ms |
3160 KB |
Output is correct |
3 |
Correct |
486 ms |
3160 KB |
Output is correct |
4 |
Correct |
525 ms |
3160 KB |
Output is correct |
5 |
Correct |
538 ms |
3160 KB |
Output is correct |
6 |
Correct |
527 ms |
3160 KB |
Output is correct |
7 |
Correct |
492 ms |
3160 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
0 ms |
344 KB |
Output is correct |
12 |
Correct |
1 ms |
344 KB |
Output is correct |
13 |
Correct |
1 ms |
344 KB |
Output is correct |
14 |
Correct |
1 ms |
344 KB |
Output is correct |
15 |
Correct |
1 ms |
344 KB |
Output is correct |
16 |
Correct |
1 ms |
568 KB |
Output is correct |
17 |
Correct |
1 ms |
344 KB |
Output is correct |
18 |
Correct |
0 ms |
344 KB |
Output is correct |
19 |
Correct |
1 ms |
344 KB |
Output is correct |
20 |
Correct |
1 ms |
344 KB |
Output is correct |
21 |
Correct |
0 ms |
344 KB |
Output is correct |
22 |
Correct |
0 ms |
344 KB |
Output is correct |
23 |
Correct |
0 ms |
344 KB |
Output is correct |
24 |
Correct |
1 ms |
344 KB |
Output is correct |
25 |
Correct |
1 ms |
344 KB |
Output is correct |
26 |
Correct |
1 ms |
340 KB |
Output is correct |
27 |
Correct |
1 ms |
344 KB |
Output is correct |
28 |
Correct |
0 ms |
344 KB |
Output is correct |
29 |
Correct |
0 ms |
344 KB |
Output is correct |
30 |
Correct |
1 ms |
344 KB |
Output is correct |
31 |
Correct |
2 ms |
344 KB |
Output is correct |
32 |
Correct |
1 ms |
344 KB |
Output is correct |
33 |
Correct |
0 ms |
344 KB |
Output is correct |
34 |
Correct |
1 ms |
344 KB |
Output is correct |
35 |
Correct |
1 ms |
344 KB |
Output is correct |
36 |
Correct |
1 ms |
344 KB |
Output is correct |
37 |
Correct |
1 ms |
344 KB |
Output is correct |
38 |
Correct |
1 ms |
344 KB |
Output is correct |
39 |
Correct |
1 ms |
344 KB |
Output is correct |
40 |
Correct |
1 ms |
408 KB |
Output is correct |
41 |
Correct |
1 ms |
344 KB |
Output is correct |
42 |
Correct |
0 ms |
344 KB |
Output is correct |
43 |
Correct |
1 ms |
344 KB |
Output is correct |
44 |
Correct |
0 ms |
344 KB |
Output is correct |
45 |
Correct |
0 ms |
344 KB |
Output is correct |
46 |
Correct |
41 ms |
3908 KB |
Output is correct |
47 |
Correct |
56 ms |
5952 KB |
Output is correct |
48 |
Correct |
38 ms |
5960 KB |
Output is correct |
49 |
Correct |
60 ms |
6976 KB |
Output is correct |
50 |
Correct |
52 ms |
7132 KB |
Output is correct |
51 |
Correct |
95 ms |
7668 KB |
Output is correct |
52 |
Correct |
40 ms |
6976 KB |
Output is correct |
53 |
Correct |
13 ms |
3040 KB |
Output is correct |
54 |
Correct |
8 ms |
3160 KB |
Output is correct |
55 |
Correct |
9 ms |
3160 KB |
Output is correct |
56 |
Correct |
9 ms |
3132 KB |
Output is correct |
57 |
Correct |
30 ms |
5960 KB |
Output is correct |
58 |
Correct |
51 ms |
6948 KB |
Output is correct |
59 |
Correct |
46 ms |
7144 KB |
Output is correct |
60 |
Correct |
8 ms |
3160 KB |
Output is correct |
61 |
Correct |
13 ms |
3160 KB |
Output is correct |
62 |
Correct |
30 ms |
5960 KB |
Output is correct |
63 |
Correct |
46 ms |
6976 KB |
Output is correct |
64 |
Correct |
41 ms |
6976 KB |
Output is correct |
65 |
Correct |
13 ms |
3160 KB |
Output is correct |
66 |
Correct |
8 ms |
2988 KB |
Output is correct |
67 |
Correct |
28 ms |
5444 KB |
Output is correct |
68 |
Correct |
36 ms |
5844 KB |
Output is correct |
69 |
Correct |
31 ms |
5952 KB |
Output is correct |
70 |
Correct |
51 ms |
6976 KB |
Output is correct |
71 |
Correct |
41 ms |
6976 KB |
Output is correct |
72 |
Correct |
42 ms |
7148 KB |
Output is correct |
73 |
Correct |
40 ms |
7128 KB |
Output is correct |
74 |
Correct |
8 ms |
3160 KB |
Output is correct |
75 |
Correct |
8 ms |
2992 KB |
Output is correct |
76 |
Correct |
8 ms |
3160 KB |
Output is correct |
77 |
Correct |
12 ms |
3132 KB |
Output is correct |
78 |
Correct |
380 ms |
5868 KB |
Output is correct |
79 |
Correct |
468 ms |
5952 KB |
Output is correct |
80 |
Correct |
525 ms |
5952 KB |
Output is correct |
81 |
Correct |
535 ms |
6976 KB |
Output is correct |
82 |
Correct |
511 ms |
6972 KB |
Output is correct |
83 |
Correct |
542 ms |
6976 KB |
Output is correct |
84 |
Correct |
546 ms |
6976 KB |
Output is correct |
85 |
Correct |
469 ms |
3160 KB |
Output is correct |
86 |
Correct |
426 ms |
3136 KB |
Output is correct |
87 |
Correct |
508 ms |
3160 KB |
Output is correct |
88 |
Correct |
392 ms |
3160 KB |
Output is correct |
89 |
Correct |
466 ms |
3160 KB |
Output is correct |
90 |
Correct |
470 ms |
3132 KB |
Output is correct |
91 |
Correct |
1 ms |
340 KB |
Output is correct |
92 |
Correct |
0 ms |
344 KB |
Output is correct |
93 |
Correct |
1 ms |
344 KB |
Output is correct |
94 |
Correct |
29 ms |
5912 KB |
Output is correct |
95 |
Correct |
53 ms |
6976 KB |
Output is correct |
96 |
Correct |
46 ms |
7144 KB |
Output is correct |
97 |
Correct |
8 ms |
3160 KB |
Output is correct |
98 |
Correct |
12 ms |
3136 KB |
Output is correct |
99 |
Correct |
30 ms |
5952 KB |
Output is correct |
100 |
Correct |
42 ms |
6948 KB |
Output is correct |
101 |
Correct |
41 ms |
6976 KB |
Output is correct |
102 |
Correct |
10 ms |
3160 KB |
Output is correct |
103 |
Correct |
16 ms |
3132 KB |
Output is correct |
104 |
Correct |
1 ms |
344 KB |
Output is correct |
105 |
Correct |
1 ms |
344 KB |
Output is correct |
106 |
Correct |
1 ms |
344 KB |
Output is correct |
107 |
Correct |
0 ms |
344 KB |
Output is correct |
108 |
Correct |
0 ms |
344 KB |
Output is correct |
109 |
Correct |
1 ms |
344 KB |
Output is correct |
110 |
Correct |
1 ms |
344 KB |
Output is correct |
111 |
Correct |
1 ms |
344 KB |
Output is correct |
112 |
Correct |
0 ms |
344 KB |
Output is correct |
113 |
Correct |
1 ms |
344 KB |
Output is correct |
114 |
Correct |
183 ms |
1608 KB |
Output is correct |
115 |
Correct |
578 ms |
5952 KB |
Output is correct |
116 |
Correct |
557 ms |
5952 KB |
Output is correct |
117 |
Correct |
561 ms |
7048 KB |
Output is correct |
118 |
Correct |
563 ms |
6912 KB |
Output is correct |
119 |
Correct |
547 ms |
6960 KB |
Output is correct |
120 |
Correct |
581 ms |
6976 KB |
Output is correct |
121 |
Correct |
452 ms |
3160 KB |
Output is correct |
122 |
Correct |
489 ms |
3160 KB |
Output is correct |
123 |
Correct |
469 ms |
3160 KB |
Output is correct |
124 |
Correct |
433 ms |
3160 KB |
Output is correct |
125 |
Correct |
30 ms |
5996 KB |
Output is correct |
126 |
Correct |
41 ms |
7000 KB |
Output is correct |
127 |
Correct |
54 ms |
6952 KB |
Output is correct |
128 |
Correct |
8 ms |
3160 KB |
Output is correct |
129 |
Correct |
8 ms |
3160 KB |
Output is correct |
130 |
Correct |
29 ms |
5640 KB |
Output is correct |
131 |
Correct |
30 ms |
5960 KB |
Output is correct |
132 |
Correct |
35 ms |
5952 KB |
Output is correct |
133 |
Correct |
53 ms |
6896 KB |
Output is correct |
134 |
Correct |
40 ms |
6928 KB |
Output is correct |
135 |
Correct |
42 ms |
6976 KB |
Output is correct |
136 |
Correct |
40 ms |
7020 KB |
Output is correct |
137 |
Correct |
8 ms |
3160 KB |
Output is correct |
138 |
Correct |
14 ms |
3136 KB |
Output is correct |
139 |
Correct |
8 ms |
3140 KB |
Output is correct |
140 |
Correct |
8 ms |
3160 KB |
Output is correct |
141 |
Correct |
1 ms |
344 KB |
Output is correct |
142 |
Correct |
1 ms |
344 KB |
Output is correct |
143 |
Correct |
1 ms |
344 KB |
Output is correct |
144 |
Correct |
0 ms |
344 KB |
Output is correct |
145 |
Correct |
0 ms |
344 KB |
Output is correct |
146 |
Correct |
0 ms |
344 KB |
Output is correct |
147 |
Correct |
1 ms |
344 KB |
Output is correct |
148 |
Correct |
1 ms |
344 KB |
Output is correct |
149 |
Correct |
1 ms |
344 KB |
Output is correct |
150 |
Correct |
1 ms |
344 KB |
Output is correct |
151 |
Correct |
1 ms |
344 KB |
Output is correct |
152 |
Correct |
1 ms |
344 KB |
Output is correct |
153 |
Correct |
0 ms |
344 KB |
Output is correct |
154 |
Correct |
0 ms |
344 KB |
Output is correct |
155 |
Correct |
1 ms |
344 KB |
Output is correct |
156 |
Correct |
0 ms |
344 KB |
Output is correct |
157 |
Execution timed out |
4040 ms |
7384 KB |
Time limit exceeded |
158 |
Halted |
0 ms |
0 KB |
- |