#include "towers.h"
#include <bits/stdc++.h>
using namespace std;
#define sz(v) int(v.size())
#define ar array
typedef long long ll;
const int N = 1e5+10, MOD = 1e9+7;
const ll INF = 1e18+10;
const int L = 20;
struct D1 {
int sum, mn, mx;
D1() {
sum = 0;
mn = MOD;
mx = -1;
}
D1(int x, int loc) {
sum = x;
if (x) mn = mx = loc;
else mn = MOD, mx = -1;
}
friend D1 operator + (const D1& one, const D1& two) {
D1 ans;
ans.sum = one.sum + two.sum;
ans.mn = min(one.mn, two.mn);
ans.mx = max(one.mx, two.mx);
return ans;
}
};
struct T1 {
D1 d;
T1 *l, *r;
T1(D1 _d): d(_d) {
l = nullptr;
r = nullptr;
}
T1(T1* _l, T1* _r): l(_l), r(_r) {
d = l->d + r->d;
}
};
T1* build1(int tl, int tr, const vector<int>& v) {
if (tl == tr) {
return new T1(D1(v[tl], tl));
}
else {
int tm = (tl + tr) / 2;
T1* ans = new T1(build1(tl, tm, v), build1(tm+1, tr, v));
return ans;
}
}
T1* upd1(T1* t, int tl, int tr, int pos, int x) {
if (tl == tr) {
return new T1(D1(x, tl));
}
int tm = (tl + tr) / 2;
if (pos <= tm)
return new T1(upd1(t->l, tl, tm, pos, x), t->r);
else
return new T1(t->l, upd1(t->r, tm+1, tr, pos, x));
}
D1 qry1(T1* t, int tl, int tr, int l, int r) {
if (r < tl || l > tr) return D1();
if (l <= tl && tr <= r) return t->d;
int tm = (tl + tr) / 2;
return qry1(t->l, tl, tm, l, r) + qry1(t->r, tm+1, tr, l, r);
}
struct D2 {
int mn, left_big, right_big, mx_active;
D2() {
mn = MOD;
left_big = right_big = -1;
mx_active = -MOD;
}
D2(int x, bool active) {
mn = x;
left_big = right_big = -1;
if (active) mx_active = x;
else mx_active = -MOD;
}
friend D2 operator + (const D2& one, const D2& two) {
D2 res;
res.mn = min(one.mn, two.mn);
res.mx_active = max(one.mx_active, two.mx_active);
res.right_big = max({one.right_big, two.right_big, two.mx_active - one.mn});
res.left_big = max({one.left_big, two.left_big, one.mx_active - two.mn});
return res;
}
};
struct T2 {
D2 d;
T2 *l, *r;
T2(D2 _d): d(_d) {
l = nullptr;
r = nullptr;
}
T2(T2* _l, T2* _r): l(_l), r(_r) {
d = l->d + r->d;
}
};
T2* build2(int tl, int tr, const vector<int>& v) {
if (tl == tr) {
return new T2(D2(v[tl], false));
}
else {
int tm = (tl + tr) / 2;
T2* ans = new T2(build2(tl, tm, v), build2(tm+1, tr, v));
return ans;
}
}
T2* upd2(T2* t, int tl, int tr, int pos, int x) {
if (tl == tr) {
return new T2(D2(x, true));
}
int tm = (tl + tr) / 2;
if (pos <= tm)
return new T2(upd2(t->l, tl, tm, pos, x), t->r);
else
return new T2(t->l, upd2(t->r, tm+1, tr, pos, x));
}
D2 qry2(T2* t, int tl, int tr, int l, int r) {
if (r < tl || l > tr) return D2();
if (l <= tl && tr <= r) return t->d;
int tm = (tl + tr) / 2;
return qry2(t->l, tl, tm, l, r) + qry2(t->r, tm+1, tr, l, r);
}
int n, a[N], st[N][L];
vector<pair<int, int>> store;
vector<int> base;
vector<int> ord;
T1* vers[N];
pair<int, int> sorted[N];
T2* vers2[N];
void build_rmq() {
for (int i = 0; i < n; i++) st[i][0] = a[i];
for (int k = 2, l = 1; k <= n; k *= 2, l++) {
for (int i = 0; i + k <= n; i++) {
st[i][l] = max(st[i][l-1], st[i + k / 2][l-1]);
}
}
}
int qry_max(int l, int r) {
int len = r - l + 1;
int use = 31 - __builtin_clz(len);
return max(st[l][use], st[r - (1 << use) + 1][use]);
}
void init(int _n, vector<int> H) {
n = _n;
for (int i = 0; i < n; i++) {
a[i] = H[i];
}
build_rmq();
set<int> s;
for (int i = 0; i < n; i++) {
bool use = 1;
if (i && a[i-1] < a[i]) use = 0;
if (i < n-1 && a[i+1] < a[i]) use = 0;
if (use) s.insert(i);
}
base = vector<int>(s.begin(), s.end());
auto f = [&](int i) {
auto it = s.lower_bound(i); assert(*it == i);
--it;
return qry_max(*it, i) - max(a[*it], a[i]);
};
set<pair<int, int>> q;
auto get_v = [&](int x) {
return pair<int, int>{f(x), x};
};
for (auto it = next(s.begin()); it != s.end(); it++) {
q.insert(get_v(*it));
}
vector<pair<int, int>> v;
v.emplace_back(0, sz(s)); // d > 0, ans = sz(s)
while (sz(q)) {
auto [d, i] = *q.begin(); q.erase(q.begin());
v.emplace_back(d, -1); // need to update v.back().second
auto it = s.lower_bound(i); assert(*it == i);
int one = i;
int two = *prev(it);
if (next(it) != s.end()) {
q.erase(get_v(*next(it)));
}
if (prev(it) != s.begin()) {
q.erase(get_v(two));
}
if (a[one] > a[two]) {
s.erase(one);
ord.push_back(one);
it = s.lower_bound(two);
if (next(it) != s.end()) {
q.insert(get_v(*next(it)));
}
if (it != s.begin()) {
q.insert(get_v(*it));
}
} else {
s.erase(two);
ord.push_back(two);
it = s.lower_bound(one);
if (next(it) != s.end()) {
q.insert(get_v(*next(it)));
}
if (it != s.begin()) {
q.insert(get_v(*it));
}
}
v.back().second = sz(s);
}
store.push_back(v[0]);
for (int i = 1; i < sz(v); i++) {
if (v[i].first <= store.back().first) {
store.back().second = v[i].second;
} else {
store.push_back(v[i]);
}
}
vector<int> aux_base(n);
for (int x : base) aux_base[x] = 1;
vers[0] = build1(0, n-1, aux_base);
// cerr << "done\n";
for (int i = 1; i <= sz(ord); i++) {
vers[i] = upd1(vers[i-1], 0, n-1, ord[i-1], 0);
}
// cerr << "done\n";
for (int i = 0; i < n; i++) {
sorted[i] = {a[i], i};
}
sort(sorted, sorted + n);
vector<int> av(a, a + n);
vers2[n] = build2(0, n-1, av);
for (int i = n-1; i >= 0; i--) {
vers2[i] = upd2(vers2[i+1], 0, n-1, sorted[i].second, sorted[i].first);
}
}
int max_towers(int l, int r, int d) {
// find the last thing < d
int idx = lower_bound(store.begin(), store.end(), pair<int, int>{d, -1}) - store.begin() - 1;
int gone = sz(base) - store[idx].second;
D1 dd = qry1(vers[gone], 0, n-1, l, r);
int ans = dd.sum;
int first = dd.mn, last = dd.mx;
if (ans == 0) {
int mx = qry_max(l, r);
return max(1, (mx - d >= a[l]) + (mx - d >= a[r]));
}
bool one = 0, two = 0;
int idx1 = lower_bound(sorted, sorted + n, pair<int, int>{a[first] + d, -1}) - sorted;
int idx2 = lower_bound(sorted, sorted + n, pair<int, int>{a[last] + d, -1}) - sorted;
one = qry2(vers2[idx1], 0, n-1, l, first).right_big >= d;
two = qry2(vers2[idx2], 0, n-1, last, r).left_big >= d;
/*
bool one = 0, two = 0;
for (int i = l; i < first; i++) {
int x = qry_max(i, first);
if (a[i] <= x - d && x - d >= a[first]) {
one = 1;
break;
}
}
for (int i = last+1; i <= r; i++) {
int x = qry_max(last, i);
if (a[i] <= x - d && x - d >= a[last]) {
two = 1;
break;
}
}
*/
ans += one;
ans += two;
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
420 ms |
65608 KB |
Output is correct |
2 |
Correct |
866 ms |
113448 KB |
Output is correct |
3 |
Correct |
878 ms |
113392 KB |
Output is correct |
4 |
Correct |
800 ms |
113496 KB |
Output is correct |
5 |
Correct |
880 ms |
113476 KB |
Output is correct |
6 |
Correct |
807 ms |
113476 KB |
Output is correct |
7 |
Correct |
941 ms |
113392 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
2 ms |
2000 KB |
Output is correct |
10 |
Correct |
2 ms |
2000 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
708 KB |
Output is correct |
2 |
Correct |
4 ms |
2384 KB |
Output is correct |
3 |
Correct |
3 ms |
2384 KB |
Output is correct |
4 |
Correct |
4 ms |
2640 KB |
Output is correct |
5 |
Correct |
5 ms |
2644 KB |
Output is correct |
6 |
Correct |
4 ms |
2640 KB |
Output is correct |
7 |
Correct |
4 ms |
2640 KB |
Output is correct |
8 |
Correct |
2 ms |
2000 KB |
Output is correct |
9 |
Correct |
2 ms |
2000 KB |
Output is correct |
10 |
Correct |
2 ms |
2000 KB |
Output is correct |
11 |
Correct |
2 ms |
2000 KB |
Output is correct |
12 |
Correct |
0 ms |
336 KB |
Output is correct |
13 |
Correct |
2 ms |
2000 KB |
Output is correct |
14 |
Correct |
3 ms |
2000 KB |
Output is correct |
15 |
Correct |
4 ms |
2416 KB |
Output is correct |
16 |
Correct |
3 ms |
2640 KB |
Output is correct |
17 |
Correct |
4 ms |
2640 KB |
Output is correct |
18 |
Correct |
2 ms |
2000 KB |
Output is correct |
19 |
Correct |
2 ms |
2000 KB |
Output is correct |
20 |
Correct |
3 ms |
2384 KB |
Output is correct |
21 |
Correct |
4 ms |
2640 KB |
Output is correct |
22 |
Correct |
4 ms |
2648 KB |
Output is correct |
23 |
Correct |
2 ms |
2000 KB |
Output is correct |
24 |
Correct |
2 ms |
2000 KB |
Output is correct |
25 |
Correct |
2 ms |
1104 KB |
Output is correct |
26 |
Correct |
3 ms |
2384 KB |
Output is correct |
27 |
Correct |
3 ms |
2384 KB |
Output is correct |
28 |
Correct |
4 ms |
2640 KB |
Output is correct |
29 |
Correct |
4 ms |
2640 KB |
Output is correct |
30 |
Correct |
4 ms |
2640 KB |
Output is correct |
31 |
Correct |
4 ms |
2640 KB |
Output is correct |
32 |
Correct |
2 ms |
2000 KB |
Output is correct |
33 |
Correct |
2 ms |
2000 KB |
Output is correct |
34 |
Correct |
2 ms |
2000 KB |
Output is correct |
35 |
Correct |
2 ms |
2052 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
708 KB |
Output is correct |
2 |
Correct |
4 ms |
2384 KB |
Output is correct |
3 |
Correct |
3 ms |
2384 KB |
Output is correct |
4 |
Correct |
4 ms |
2640 KB |
Output is correct |
5 |
Correct |
5 ms |
2644 KB |
Output is correct |
6 |
Correct |
4 ms |
2640 KB |
Output is correct |
7 |
Correct |
4 ms |
2640 KB |
Output is correct |
8 |
Correct |
2 ms |
2000 KB |
Output is correct |
9 |
Correct |
2 ms |
2000 KB |
Output is correct |
10 |
Correct |
2 ms |
2000 KB |
Output is correct |
11 |
Correct |
2 ms |
2000 KB |
Output is correct |
12 |
Correct |
0 ms |
336 KB |
Output is correct |
13 |
Correct |
2 ms |
2000 KB |
Output is correct |
14 |
Correct |
3 ms |
2000 KB |
Output is correct |
15 |
Correct |
4 ms |
2416 KB |
Output is correct |
16 |
Correct |
3 ms |
2640 KB |
Output is correct |
17 |
Correct |
4 ms |
2640 KB |
Output is correct |
18 |
Correct |
2 ms |
2000 KB |
Output is correct |
19 |
Correct |
2 ms |
2000 KB |
Output is correct |
20 |
Correct |
3 ms |
2384 KB |
Output is correct |
21 |
Correct |
4 ms |
2640 KB |
Output is correct |
22 |
Correct |
4 ms |
2648 KB |
Output is correct |
23 |
Correct |
2 ms |
2000 KB |
Output is correct |
24 |
Correct |
2 ms |
2000 KB |
Output is correct |
25 |
Correct |
2 ms |
1104 KB |
Output is correct |
26 |
Correct |
3 ms |
2384 KB |
Output is correct |
27 |
Correct |
3 ms |
2384 KB |
Output is correct |
28 |
Correct |
4 ms |
2640 KB |
Output is correct |
29 |
Correct |
4 ms |
2640 KB |
Output is correct |
30 |
Correct |
4 ms |
2640 KB |
Output is correct |
31 |
Correct |
4 ms |
2640 KB |
Output is correct |
32 |
Correct |
2 ms |
2000 KB |
Output is correct |
33 |
Correct |
2 ms |
2000 KB |
Output is correct |
34 |
Correct |
2 ms |
2000 KB |
Output is correct |
35 |
Correct |
2 ms |
2052 KB |
Output is correct |
36 |
Correct |
148 ms |
89776 KB |
Output is correct |
37 |
Correct |
328 ms |
142588 KB |
Output is correct |
38 |
Correct |
267 ms |
142416 KB |
Output is correct |
39 |
Correct |
301 ms |
156632 KB |
Output is correct |
40 |
Correct |
331 ms |
156716 KB |
Output is correct |
41 |
Correct |
328 ms |
156628 KB |
Output is correct |
42 |
Correct |
357 ms |
156740 KB |
Output is correct |
43 |
Correct |
102 ms |
113488 KB |
Output is correct |
44 |
Correct |
106 ms |
113480 KB |
Output is correct |
45 |
Correct |
95 ms |
113476 KB |
Output is correct |
46 |
Correct |
115 ms |
113452 KB |
Output is correct |
47 |
Correct |
279 ms |
142396 KB |
Output is correct |
48 |
Correct |
305 ms |
156800 KB |
Output is correct |
49 |
Correct |
367 ms |
156664 KB |
Output is correct |
50 |
Correct |
115 ms |
113480 KB |
Output is correct |
51 |
Correct |
108 ms |
113476 KB |
Output is correct |
52 |
Correct |
262 ms |
142412 KB |
Output is correct |
53 |
Correct |
330 ms |
156736 KB |
Output is correct |
54 |
Correct |
358 ms |
156840 KB |
Output is correct |
55 |
Correct |
98 ms |
113496 KB |
Output is correct |
56 |
Correct |
108 ms |
113480 KB |
Output is correct |
57 |
Correct |
279 ms |
137192 KB |
Output is correct |
58 |
Correct |
265 ms |
142532 KB |
Output is correct |
59 |
Correct |
271 ms |
142596 KB |
Output is correct |
60 |
Correct |
324 ms |
156632 KB |
Output is correct |
61 |
Correct |
361 ms |
156712 KB |
Output is correct |
62 |
Correct |
334 ms |
156904 KB |
Output is correct |
63 |
Correct |
324 ms |
156712 KB |
Output is correct |
64 |
Correct |
99 ms |
113412 KB |
Output is correct |
65 |
Correct |
120 ms |
113392 KB |
Output is correct |
66 |
Correct |
100 ms |
113436 KB |
Output is correct |
67 |
Correct |
98 ms |
113480 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1207 ms |
141368 KB |
Output is correct |
2 |
Correct |
1454 ms |
142500 KB |
Output is correct |
3 |
Correct |
1443 ms |
142588 KB |
Output is correct |
4 |
Correct |
1517 ms |
156628 KB |
Output is correct |
5 |
Correct |
1461 ms |
156628 KB |
Output is correct |
6 |
Correct |
1629 ms |
156736 KB |
Output is correct |
7 |
Correct |
1452 ms |
156648 KB |
Output is correct |
8 |
Correct |
855 ms |
113484 KB |
Output is correct |
9 |
Correct |
806 ms |
113492 KB |
Output is correct |
10 |
Correct |
791 ms |
113448 KB |
Output is correct |
11 |
Correct |
1000 ms |
113404 KB |
Output is correct |
12 |
Correct |
840 ms |
113444 KB |
Output is correct |
13 |
Correct |
797 ms |
113480 KB |
Output is correct |
14 |
Correct |
0 ms |
336 KB |
Output is correct |
15 |
Correct |
2 ms |
2000 KB |
Output is correct |
16 |
Correct |
2 ms |
2000 KB |
Output is correct |
17 |
Correct |
248 ms |
142404 KB |
Output is correct |
18 |
Correct |
338 ms |
156716 KB |
Output is correct |
19 |
Correct |
328 ms |
156728 KB |
Output is correct |
20 |
Correct |
112 ms |
113480 KB |
Output is correct |
21 |
Correct |
101 ms |
113476 KB |
Output is correct |
22 |
Correct |
274 ms |
142524 KB |
Output is correct |
23 |
Correct |
325 ms |
156712 KB |
Output is correct |
24 |
Correct |
353 ms |
156664 KB |
Output is correct |
25 |
Correct |
100 ms |
113496 KB |
Output is correct |
26 |
Correct |
114 ms |
113500 KB |
Output is correct |
27 |
Correct |
4 ms |
2448 KB |
Output is correct |
28 |
Correct |
5 ms |
2640 KB |
Output is correct |
29 |
Correct |
4 ms |
2608 KB |
Output is correct |
30 |
Correct |
2 ms |
2000 KB |
Output is correct |
31 |
Correct |
3 ms |
2000 KB |
Output is correct |
32 |
Correct |
3 ms |
2384 KB |
Output is correct |
33 |
Correct |
4 ms |
2640 KB |
Output is correct |
34 |
Correct |
4 ms |
2640 KB |
Output is correct |
35 |
Correct |
2 ms |
2000 KB |
Output is correct |
36 |
Correct |
2 ms |
2000 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
250 ms |
31144 KB |
Output is correct |
2 |
Correct |
1100 ms |
142472 KB |
Output is correct |
3 |
Correct |
1188 ms |
142556 KB |
Output is correct |
4 |
Correct |
1201 ms |
156740 KB |
Output is correct |
5 |
Correct |
1294 ms |
156636 KB |
Output is correct |
6 |
Correct |
1200 ms |
156636 KB |
Output is correct |
7 |
Correct |
1216 ms |
156716 KB |
Output is correct |
8 |
Correct |
907 ms |
113400 KB |
Output is correct |
9 |
Correct |
831 ms |
113512 KB |
Output is correct |
10 |
Correct |
874 ms |
113468 KB |
Output is correct |
11 |
Correct |
832 ms |
113440 KB |
Output is correct |
12 |
Correct |
248 ms |
142376 KB |
Output is correct |
13 |
Correct |
310 ms |
156628 KB |
Output is correct |
14 |
Correct |
340 ms |
156680 KB |
Output is correct |
15 |
Correct |
98 ms |
113476 KB |
Output is correct |
16 |
Correct |
97 ms |
113460 KB |
Output is correct |
17 |
Correct |
260 ms |
137124 KB |
Output is correct |
18 |
Correct |
252 ms |
142532 KB |
Output is correct |
19 |
Correct |
242 ms |
142532 KB |
Output is correct |
20 |
Correct |
339 ms |
156648 KB |
Output is correct |
21 |
Correct |
300 ms |
156700 KB |
Output is correct |
22 |
Correct |
313 ms |
156672 KB |
Output is correct |
23 |
Correct |
302 ms |
156708 KB |
Output is correct |
24 |
Correct |
94 ms |
113456 KB |
Output is correct |
25 |
Correct |
97 ms |
113436 KB |
Output is correct |
26 |
Correct |
98 ms |
113460 KB |
Output is correct |
27 |
Correct |
100 ms |
113480 KB |
Output is correct |
28 |
Correct |
3 ms |
2384 KB |
Output is correct |
29 |
Correct |
4 ms |
2640 KB |
Output is correct |
30 |
Correct |
4 ms |
2640 KB |
Output is correct |
31 |
Correct |
2 ms |
2000 KB |
Output is correct |
32 |
Correct |
2 ms |
2000 KB |
Output is correct |
33 |
Correct |
1 ms |
1104 KB |
Output is correct |
34 |
Correct |
5 ms |
2384 KB |
Output is correct |
35 |
Correct |
3 ms |
2384 KB |
Output is correct |
36 |
Correct |
4 ms |
2544 KB |
Output is correct |
37 |
Correct |
4 ms |
2648 KB |
Output is correct |
38 |
Correct |
4 ms |
2600 KB |
Output is correct |
39 |
Correct |
3 ms |
2640 KB |
Output is correct |
40 |
Correct |
2 ms |
2000 KB |
Output is correct |
41 |
Correct |
2 ms |
2000 KB |
Output is correct |
42 |
Correct |
2 ms |
2000 KB |
Output is correct |
43 |
Correct |
2 ms |
2000 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
708 KB |
Output is correct |
2 |
Correct |
4 ms |
2384 KB |
Output is correct |
3 |
Correct |
3 ms |
2384 KB |
Output is correct |
4 |
Correct |
4 ms |
2640 KB |
Output is correct |
5 |
Correct |
5 ms |
2644 KB |
Output is correct |
6 |
Correct |
4 ms |
2640 KB |
Output is correct |
7 |
Correct |
4 ms |
2640 KB |
Output is correct |
8 |
Correct |
2 ms |
2000 KB |
Output is correct |
9 |
Correct |
2 ms |
2000 KB |
Output is correct |
10 |
Correct |
2 ms |
2000 KB |
Output is correct |
11 |
Correct |
2 ms |
2000 KB |
Output is correct |
12 |
Correct |
0 ms |
336 KB |
Output is correct |
13 |
Correct |
2 ms |
2000 KB |
Output is correct |
14 |
Correct |
3 ms |
2000 KB |
Output is correct |
15 |
Correct |
4 ms |
2416 KB |
Output is correct |
16 |
Correct |
3 ms |
2640 KB |
Output is correct |
17 |
Correct |
4 ms |
2640 KB |
Output is correct |
18 |
Correct |
2 ms |
2000 KB |
Output is correct |
19 |
Correct |
2 ms |
2000 KB |
Output is correct |
20 |
Correct |
3 ms |
2384 KB |
Output is correct |
21 |
Correct |
4 ms |
2640 KB |
Output is correct |
22 |
Correct |
4 ms |
2648 KB |
Output is correct |
23 |
Correct |
2 ms |
2000 KB |
Output is correct |
24 |
Correct |
2 ms |
2000 KB |
Output is correct |
25 |
Correct |
2 ms |
1104 KB |
Output is correct |
26 |
Correct |
3 ms |
2384 KB |
Output is correct |
27 |
Correct |
3 ms |
2384 KB |
Output is correct |
28 |
Correct |
4 ms |
2640 KB |
Output is correct |
29 |
Correct |
4 ms |
2640 KB |
Output is correct |
30 |
Correct |
4 ms |
2640 KB |
Output is correct |
31 |
Correct |
4 ms |
2640 KB |
Output is correct |
32 |
Correct |
2 ms |
2000 KB |
Output is correct |
33 |
Correct |
2 ms |
2000 KB |
Output is correct |
34 |
Correct |
2 ms |
2000 KB |
Output is correct |
35 |
Correct |
2 ms |
2052 KB |
Output is correct |
36 |
Correct |
148 ms |
89776 KB |
Output is correct |
37 |
Correct |
328 ms |
142588 KB |
Output is correct |
38 |
Correct |
267 ms |
142416 KB |
Output is correct |
39 |
Correct |
301 ms |
156632 KB |
Output is correct |
40 |
Correct |
331 ms |
156716 KB |
Output is correct |
41 |
Correct |
328 ms |
156628 KB |
Output is correct |
42 |
Correct |
357 ms |
156740 KB |
Output is correct |
43 |
Correct |
102 ms |
113488 KB |
Output is correct |
44 |
Correct |
106 ms |
113480 KB |
Output is correct |
45 |
Correct |
95 ms |
113476 KB |
Output is correct |
46 |
Correct |
115 ms |
113452 KB |
Output is correct |
47 |
Correct |
279 ms |
142396 KB |
Output is correct |
48 |
Correct |
305 ms |
156800 KB |
Output is correct |
49 |
Correct |
367 ms |
156664 KB |
Output is correct |
50 |
Correct |
115 ms |
113480 KB |
Output is correct |
51 |
Correct |
108 ms |
113476 KB |
Output is correct |
52 |
Correct |
262 ms |
142412 KB |
Output is correct |
53 |
Correct |
330 ms |
156736 KB |
Output is correct |
54 |
Correct |
358 ms |
156840 KB |
Output is correct |
55 |
Correct |
98 ms |
113496 KB |
Output is correct |
56 |
Correct |
108 ms |
113480 KB |
Output is correct |
57 |
Correct |
279 ms |
137192 KB |
Output is correct |
58 |
Correct |
265 ms |
142532 KB |
Output is correct |
59 |
Correct |
271 ms |
142596 KB |
Output is correct |
60 |
Correct |
324 ms |
156632 KB |
Output is correct |
61 |
Correct |
361 ms |
156712 KB |
Output is correct |
62 |
Correct |
334 ms |
156904 KB |
Output is correct |
63 |
Correct |
324 ms |
156712 KB |
Output is correct |
64 |
Correct |
99 ms |
113412 KB |
Output is correct |
65 |
Correct |
120 ms |
113392 KB |
Output is correct |
66 |
Correct |
100 ms |
113436 KB |
Output is correct |
67 |
Correct |
98 ms |
113480 KB |
Output is correct |
68 |
Correct |
1207 ms |
141368 KB |
Output is correct |
69 |
Correct |
1454 ms |
142500 KB |
Output is correct |
70 |
Correct |
1443 ms |
142588 KB |
Output is correct |
71 |
Correct |
1517 ms |
156628 KB |
Output is correct |
72 |
Correct |
1461 ms |
156628 KB |
Output is correct |
73 |
Correct |
1629 ms |
156736 KB |
Output is correct |
74 |
Correct |
1452 ms |
156648 KB |
Output is correct |
75 |
Correct |
855 ms |
113484 KB |
Output is correct |
76 |
Correct |
806 ms |
113492 KB |
Output is correct |
77 |
Correct |
791 ms |
113448 KB |
Output is correct |
78 |
Correct |
1000 ms |
113404 KB |
Output is correct |
79 |
Correct |
840 ms |
113444 KB |
Output is correct |
80 |
Correct |
797 ms |
113480 KB |
Output is correct |
81 |
Correct |
0 ms |
336 KB |
Output is correct |
82 |
Correct |
2 ms |
2000 KB |
Output is correct |
83 |
Correct |
2 ms |
2000 KB |
Output is correct |
84 |
Correct |
248 ms |
142404 KB |
Output is correct |
85 |
Correct |
338 ms |
156716 KB |
Output is correct |
86 |
Correct |
328 ms |
156728 KB |
Output is correct |
87 |
Correct |
112 ms |
113480 KB |
Output is correct |
88 |
Correct |
101 ms |
113476 KB |
Output is correct |
89 |
Correct |
274 ms |
142524 KB |
Output is correct |
90 |
Correct |
325 ms |
156712 KB |
Output is correct |
91 |
Correct |
353 ms |
156664 KB |
Output is correct |
92 |
Correct |
100 ms |
113496 KB |
Output is correct |
93 |
Correct |
114 ms |
113500 KB |
Output is correct |
94 |
Correct |
4 ms |
2448 KB |
Output is correct |
95 |
Correct |
5 ms |
2640 KB |
Output is correct |
96 |
Correct |
4 ms |
2608 KB |
Output is correct |
97 |
Correct |
2 ms |
2000 KB |
Output is correct |
98 |
Correct |
3 ms |
2000 KB |
Output is correct |
99 |
Correct |
3 ms |
2384 KB |
Output is correct |
100 |
Correct |
4 ms |
2640 KB |
Output is correct |
101 |
Correct |
4 ms |
2640 KB |
Output is correct |
102 |
Correct |
2 ms |
2000 KB |
Output is correct |
103 |
Correct |
2 ms |
2000 KB |
Output is correct |
104 |
Correct |
1111 ms |
125492 KB |
Output is correct |
105 |
Correct |
1433 ms |
142292 KB |
Output is correct |
106 |
Correct |
1361 ms |
142512 KB |
Output is correct |
107 |
Correct |
1449 ms |
156688 KB |
Output is correct |
108 |
Incorrect |
1357 ms |
156644 KB |
19976th lines differ - on the 1st token, expected: '2', found: '1' |
109 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
420 ms |
65608 KB |
Output is correct |
2 |
Correct |
866 ms |
113448 KB |
Output is correct |
3 |
Correct |
878 ms |
113392 KB |
Output is correct |
4 |
Correct |
800 ms |
113496 KB |
Output is correct |
5 |
Correct |
880 ms |
113476 KB |
Output is correct |
6 |
Correct |
807 ms |
113476 KB |
Output is correct |
7 |
Correct |
941 ms |
113392 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
2 ms |
2000 KB |
Output is correct |
10 |
Correct |
2 ms |
2000 KB |
Output is correct |
11 |
Correct |
1 ms |
708 KB |
Output is correct |
12 |
Correct |
4 ms |
2384 KB |
Output is correct |
13 |
Correct |
3 ms |
2384 KB |
Output is correct |
14 |
Correct |
4 ms |
2640 KB |
Output is correct |
15 |
Correct |
5 ms |
2644 KB |
Output is correct |
16 |
Correct |
4 ms |
2640 KB |
Output is correct |
17 |
Correct |
4 ms |
2640 KB |
Output is correct |
18 |
Correct |
2 ms |
2000 KB |
Output is correct |
19 |
Correct |
2 ms |
2000 KB |
Output is correct |
20 |
Correct |
2 ms |
2000 KB |
Output is correct |
21 |
Correct |
2 ms |
2000 KB |
Output is correct |
22 |
Correct |
0 ms |
336 KB |
Output is correct |
23 |
Correct |
2 ms |
2000 KB |
Output is correct |
24 |
Correct |
3 ms |
2000 KB |
Output is correct |
25 |
Correct |
4 ms |
2416 KB |
Output is correct |
26 |
Correct |
3 ms |
2640 KB |
Output is correct |
27 |
Correct |
4 ms |
2640 KB |
Output is correct |
28 |
Correct |
2 ms |
2000 KB |
Output is correct |
29 |
Correct |
2 ms |
2000 KB |
Output is correct |
30 |
Correct |
3 ms |
2384 KB |
Output is correct |
31 |
Correct |
4 ms |
2640 KB |
Output is correct |
32 |
Correct |
4 ms |
2648 KB |
Output is correct |
33 |
Correct |
2 ms |
2000 KB |
Output is correct |
34 |
Correct |
2 ms |
2000 KB |
Output is correct |
35 |
Correct |
2 ms |
1104 KB |
Output is correct |
36 |
Correct |
3 ms |
2384 KB |
Output is correct |
37 |
Correct |
3 ms |
2384 KB |
Output is correct |
38 |
Correct |
4 ms |
2640 KB |
Output is correct |
39 |
Correct |
4 ms |
2640 KB |
Output is correct |
40 |
Correct |
4 ms |
2640 KB |
Output is correct |
41 |
Correct |
4 ms |
2640 KB |
Output is correct |
42 |
Correct |
2 ms |
2000 KB |
Output is correct |
43 |
Correct |
2 ms |
2000 KB |
Output is correct |
44 |
Correct |
2 ms |
2000 KB |
Output is correct |
45 |
Correct |
2 ms |
2052 KB |
Output is correct |
46 |
Correct |
148 ms |
89776 KB |
Output is correct |
47 |
Correct |
328 ms |
142588 KB |
Output is correct |
48 |
Correct |
267 ms |
142416 KB |
Output is correct |
49 |
Correct |
301 ms |
156632 KB |
Output is correct |
50 |
Correct |
331 ms |
156716 KB |
Output is correct |
51 |
Correct |
328 ms |
156628 KB |
Output is correct |
52 |
Correct |
357 ms |
156740 KB |
Output is correct |
53 |
Correct |
102 ms |
113488 KB |
Output is correct |
54 |
Correct |
106 ms |
113480 KB |
Output is correct |
55 |
Correct |
95 ms |
113476 KB |
Output is correct |
56 |
Correct |
115 ms |
113452 KB |
Output is correct |
57 |
Correct |
279 ms |
142396 KB |
Output is correct |
58 |
Correct |
305 ms |
156800 KB |
Output is correct |
59 |
Correct |
367 ms |
156664 KB |
Output is correct |
60 |
Correct |
115 ms |
113480 KB |
Output is correct |
61 |
Correct |
108 ms |
113476 KB |
Output is correct |
62 |
Correct |
262 ms |
142412 KB |
Output is correct |
63 |
Correct |
330 ms |
156736 KB |
Output is correct |
64 |
Correct |
358 ms |
156840 KB |
Output is correct |
65 |
Correct |
98 ms |
113496 KB |
Output is correct |
66 |
Correct |
108 ms |
113480 KB |
Output is correct |
67 |
Correct |
279 ms |
137192 KB |
Output is correct |
68 |
Correct |
265 ms |
142532 KB |
Output is correct |
69 |
Correct |
271 ms |
142596 KB |
Output is correct |
70 |
Correct |
324 ms |
156632 KB |
Output is correct |
71 |
Correct |
361 ms |
156712 KB |
Output is correct |
72 |
Correct |
334 ms |
156904 KB |
Output is correct |
73 |
Correct |
324 ms |
156712 KB |
Output is correct |
74 |
Correct |
99 ms |
113412 KB |
Output is correct |
75 |
Correct |
120 ms |
113392 KB |
Output is correct |
76 |
Correct |
100 ms |
113436 KB |
Output is correct |
77 |
Correct |
98 ms |
113480 KB |
Output is correct |
78 |
Correct |
1207 ms |
141368 KB |
Output is correct |
79 |
Correct |
1454 ms |
142500 KB |
Output is correct |
80 |
Correct |
1443 ms |
142588 KB |
Output is correct |
81 |
Correct |
1517 ms |
156628 KB |
Output is correct |
82 |
Correct |
1461 ms |
156628 KB |
Output is correct |
83 |
Correct |
1629 ms |
156736 KB |
Output is correct |
84 |
Correct |
1452 ms |
156648 KB |
Output is correct |
85 |
Correct |
855 ms |
113484 KB |
Output is correct |
86 |
Correct |
806 ms |
113492 KB |
Output is correct |
87 |
Correct |
791 ms |
113448 KB |
Output is correct |
88 |
Correct |
1000 ms |
113404 KB |
Output is correct |
89 |
Correct |
840 ms |
113444 KB |
Output is correct |
90 |
Correct |
797 ms |
113480 KB |
Output is correct |
91 |
Correct |
0 ms |
336 KB |
Output is correct |
92 |
Correct |
2 ms |
2000 KB |
Output is correct |
93 |
Correct |
2 ms |
2000 KB |
Output is correct |
94 |
Correct |
248 ms |
142404 KB |
Output is correct |
95 |
Correct |
338 ms |
156716 KB |
Output is correct |
96 |
Correct |
328 ms |
156728 KB |
Output is correct |
97 |
Correct |
112 ms |
113480 KB |
Output is correct |
98 |
Correct |
101 ms |
113476 KB |
Output is correct |
99 |
Correct |
274 ms |
142524 KB |
Output is correct |
100 |
Correct |
325 ms |
156712 KB |
Output is correct |
101 |
Correct |
353 ms |
156664 KB |
Output is correct |
102 |
Correct |
100 ms |
113496 KB |
Output is correct |
103 |
Correct |
114 ms |
113500 KB |
Output is correct |
104 |
Correct |
4 ms |
2448 KB |
Output is correct |
105 |
Correct |
5 ms |
2640 KB |
Output is correct |
106 |
Correct |
4 ms |
2608 KB |
Output is correct |
107 |
Correct |
2 ms |
2000 KB |
Output is correct |
108 |
Correct |
3 ms |
2000 KB |
Output is correct |
109 |
Correct |
3 ms |
2384 KB |
Output is correct |
110 |
Correct |
4 ms |
2640 KB |
Output is correct |
111 |
Correct |
4 ms |
2640 KB |
Output is correct |
112 |
Correct |
2 ms |
2000 KB |
Output is correct |
113 |
Correct |
2 ms |
2000 KB |
Output is correct |
114 |
Correct |
250 ms |
31144 KB |
Output is correct |
115 |
Correct |
1100 ms |
142472 KB |
Output is correct |
116 |
Correct |
1188 ms |
142556 KB |
Output is correct |
117 |
Correct |
1201 ms |
156740 KB |
Output is correct |
118 |
Correct |
1294 ms |
156636 KB |
Output is correct |
119 |
Correct |
1200 ms |
156636 KB |
Output is correct |
120 |
Correct |
1216 ms |
156716 KB |
Output is correct |
121 |
Correct |
907 ms |
113400 KB |
Output is correct |
122 |
Correct |
831 ms |
113512 KB |
Output is correct |
123 |
Correct |
874 ms |
113468 KB |
Output is correct |
124 |
Correct |
832 ms |
113440 KB |
Output is correct |
125 |
Correct |
248 ms |
142376 KB |
Output is correct |
126 |
Correct |
310 ms |
156628 KB |
Output is correct |
127 |
Correct |
340 ms |
156680 KB |
Output is correct |
128 |
Correct |
98 ms |
113476 KB |
Output is correct |
129 |
Correct |
97 ms |
113460 KB |
Output is correct |
130 |
Correct |
260 ms |
137124 KB |
Output is correct |
131 |
Correct |
252 ms |
142532 KB |
Output is correct |
132 |
Correct |
242 ms |
142532 KB |
Output is correct |
133 |
Correct |
339 ms |
156648 KB |
Output is correct |
134 |
Correct |
300 ms |
156700 KB |
Output is correct |
135 |
Correct |
313 ms |
156672 KB |
Output is correct |
136 |
Correct |
302 ms |
156708 KB |
Output is correct |
137 |
Correct |
94 ms |
113456 KB |
Output is correct |
138 |
Correct |
97 ms |
113436 KB |
Output is correct |
139 |
Correct |
98 ms |
113460 KB |
Output is correct |
140 |
Correct |
100 ms |
113480 KB |
Output is correct |
141 |
Correct |
3 ms |
2384 KB |
Output is correct |
142 |
Correct |
4 ms |
2640 KB |
Output is correct |
143 |
Correct |
4 ms |
2640 KB |
Output is correct |
144 |
Correct |
2 ms |
2000 KB |
Output is correct |
145 |
Correct |
2 ms |
2000 KB |
Output is correct |
146 |
Correct |
1 ms |
1104 KB |
Output is correct |
147 |
Correct |
5 ms |
2384 KB |
Output is correct |
148 |
Correct |
3 ms |
2384 KB |
Output is correct |
149 |
Correct |
4 ms |
2544 KB |
Output is correct |
150 |
Correct |
4 ms |
2648 KB |
Output is correct |
151 |
Correct |
4 ms |
2600 KB |
Output is correct |
152 |
Correct |
3 ms |
2640 KB |
Output is correct |
153 |
Correct |
2 ms |
2000 KB |
Output is correct |
154 |
Correct |
2 ms |
2000 KB |
Output is correct |
155 |
Correct |
2 ms |
2000 KB |
Output is correct |
156 |
Correct |
2 ms |
2000 KB |
Output is correct |
157 |
Correct |
1111 ms |
125492 KB |
Output is correct |
158 |
Correct |
1433 ms |
142292 KB |
Output is correct |
159 |
Correct |
1361 ms |
142512 KB |
Output is correct |
160 |
Correct |
1449 ms |
156688 KB |
Output is correct |
161 |
Incorrect |
1357 ms |
156644 KB |
19976th lines differ - on the 1st token, expected: '2', found: '1' |
162 |
Halted |
0 ms |
0 KB |
- |