#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) {
if (r - l + 1 <= 2) return 1;
// 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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
454 ms |
65608 KB |
Output is correct |
2 |
Correct |
950 ms |
113468 KB |
Output is correct |
3 |
Correct |
875 ms |
113528 KB |
Output is correct |
4 |
Correct |
899 ms |
113492 KB |
Output is correct |
5 |
Correct |
943 ms |
113428 KB |
Output is correct |
6 |
Correct |
921 ms |
113480 KB |
Output is correct |
7 |
Correct |
859 ms |
113492 KB |
Output is correct |
8 |
Correct |
0 ms |
208 KB |
Output is correct |
9 |
Correct |
2 ms |
2056 KB |
Output is correct |
10 |
Correct |
2 ms |
2000 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
720 KB |
Output is correct |
2 |
Correct |
3 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 |
4 ms |
2640 KB |
Output is correct |
6 |
Correct |
3 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 |
2004 KB |
Output is correct |
11 |
Correct |
2 ms |
2000 KB |
Output is correct |
12 |
Correct |
0 ms |
384 KB |
Output is correct |
13 |
Correct |
2 ms |
2000 KB |
Output is correct |
14 |
Correct |
2 ms |
2000 KB |
Output is correct |
15 |
Correct |
3 ms |
2384 KB |
Output is correct |
16 |
Correct |
3 ms |
2640 KB |
Output is correct |
17 |
Correct |
3 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 |
3 ms |
2640 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 |
2432 KB |
Output is correct |
27 |
Correct |
3 ms |
2384 KB |
Output is correct |
28 |
Correct |
3 ms |
2640 KB |
Output is correct |
29 |
Correct |
4 ms |
2640 KB |
Output is correct |
30 |
Correct |
3 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 |
2000 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
720 KB |
Output is correct |
2 |
Correct |
3 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 |
4 ms |
2640 KB |
Output is correct |
6 |
Correct |
3 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 |
2004 KB |
Output is correct |
11 |
Correct |
2 ms |
2000 KB |
Output is correct |
12 |
Correct |
0 ms |
384 KB |
Output is correct |
13 |
Correct |
2 ms |
2000 KB |
Output is correct |
14 |
Correct |
2 ms |
2000 KB |
Output is correct |
15 |
Correct |
3 ms |
2384 KB |
Output is correct |
16 |
Correct |
3 ms |
2640 KB |
Output is correct |
17 |
Correct |
3 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 |
3 ms |
2640 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 |
2432 KB |
Output is correct |
27 |
Correct |
3 ms |
2384 KB |
Output is correct |
28 |
Correct |
3 ms |
2640 KB |
Output is correct |
29 |
Correct |
4 ms |
2640 KB |
Output is correct |
30 |
Correct |
3 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 |
2000 KB |
Output is correct |
36 |
Correct |
151 ms |
89880 KB |
Output is correct |
37 |
Correct |
250 ms |
142500 KB |
Output is correct |
38 |
Correct |
256 ms |
142368 KB |
Output is correct |
39 |
Correct |
311 ms |
156800 KB |
Output is correct |
40 |
Correct |
304 ms |
156724 KB |
Output is correct |
41 |
Correct |
323 ms |
156768 KB |
Output is correct |
42 |
Correct |
306 ms |
156708 KB |
Output is correct |
43 |
Correct |
95 ms |
113412 KB |
Output is correct |
44 |
Correct |
98 ms |
113480 KB |
Output is correct |
45 |
Correct |
100 ms |
113544 KB |
Output is correct |
46 |
Correct |
124 ms |
113416 KB |
Output is correct |
47 |
Correct |
245 ms |
142400 KB |
Output is correct |
48 |
Correct |
328 ms |
156736 KB |
Output is correct |
49 |
Correct |
311 ms |
156664 KB |
Output is correct |
50 |
Correct |
102 ms |
113404 KB |
Output is correct |
51 |
Correct |
95 ms |
113448 KB |
Output is correct |
52 |
Correct |
246 ms |
142364 KB |
Output is correct |
53 |
Correct |
320 ms |
156652 KB |
Output is correct |
54 |
Correct |
308 ms |
156668 KB |
Output is correct |
55 |
Correct |
99 ms |
113468 KB |
Output is correct |
56 |
Correct |
96 ms |
113448 KB |
Output is correct |
57 |
Correct |
248 ms |
137140 KB |
Output is correct |
58 |
Correct |
248 ms |
142464 KB |
Output is correct |
59 |
Correct |
254 ms |
142492 KB |
Output is correct |
60 |
Correct |
346 ms |
156680 KB |
Output is correct |
61 |
Correct |
305 ms |
156664 KB |
Output is correct |
62 |
Correct |
307 ms |
156708 KB |
Output is correct |
63 |
Correct |
316 ms |
156820 KB |
Output is correct |
64 |
Correct |
101 ms |
113408 KB |
Output is correct |
65 |
Correct |
105 ms |
113472 KB |
Output is correct |
66 |
Correct |
99 ms |
113508 KB |
Output is correct |
67 |
Correct |
99 ms |
113464 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1186 ms |
141388 KB |
Output is correct |
2 |
Correct |
1371 ms |
142404 KB |
Output is correct |
3 |
Correct |
1523 ms |
142704 KB |
Output is correct |
4 |
Correct |
1475 ms |
156740 KB |
Output is correct |
5 |
Correct |
1527 ms |
156692 KB |
Output is correct |
6 |
Correct |
1518 ms |
156640 KB |
Output is correct |
7 |
Correct |
1650 ms |
156736 KB |
Output is correct |
8 |
Correct |
1050 ms |
113440 KB |
Output is correct |
9 |
Correct |
773 ms |
113516 KB |
Output is correct |
10 |
Correct |
1061 ms |
113452 KB |
Output is correct |
11 |
Correct |
981 ms |
113452 KB |
Output is correct |
12 |
Correct |
904 ms |
113476 KB |
Output is correct |
13 |
Correct |
1012 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 |
246 ms |
142456 KB |
Output is correct |
18 |
Correct |
330 ms |
156624 KB |
Output is correct |
19 |
Correct |
313 ms |
156664 KB |
Output is correct |
20 |
Correct |
99 ms |
113488 KB |
Output is correct |
21 |
Correct |
98 ms |
113516 KB |
Output is correct |
22 |
Correct |
244 ms |
142368 KB |
Output is correct |
23 |
Correct |
308 ms |
156740 KB |
Output is correct |
24 |
Correct |
301 ms |
156656 KB |
Output is correct |
25 |
Correct |
113 ms |
113488 KB |
Output is correct |
26 |
Correct |
97 ms |
113508 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 |
2528 KB |
Output is correct |
30 |
Correct |
2 ms |
2000 KB |
Output is correct |
31 |
Correct |
2 ms |
2000 KB |
Output is correct |
32 |
Correct |
3 ms |
2384 KB |
Output is correct |
33 |
Correct |
3 ms |
2640 KB |
Output is correct |
34 |
Correct |
3 ms |
2640 KB |
Output is correct |
35 |
Correct |
2 ms |
2000 KB |
Output is correct |
36 |
Correct |
2 ms |
2000 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
323 ms |
31076 KB |
Output is correct |
2 |
Correct |
1156 ms |
142520 KB |
Output is correct |
3 |
Correct |
1106 ms |
142448 KB |
Output is correct |
4 |
Correct |
1302 ms |
156652 KB |
Output is correct |
5 |
Correct |
1168 ms |
156720 KB |
Output is correct |
6 |
Correct |
1207 ms |
156740 KB |
Output is correct |
7 |
Correct |
1270 ms |
156756 KB |
Output is correct |
8 |
Correct |
914 ms |
113436 KB |
Output is correct |
9 |
Correct |
872 ms |
113540 KB |
Output is correct |
10 |
Correct |
856 ms |
113488 KB |
Output is correct |
11 |
Correct |
967 ms |
113448 KB |
Output is correct |
12 |
Correct |
301 ms |
142516 KB |
Output is correct |
13 |
Correct |
314 ms |
156668 KB |
Output is correct |
14 |
Correct |
351 ms |
156652 KB |
Output is correct |
15 |
Correct |
98 ms |
113492 KB |
Output is correct |
16 |
Correct |
95 ms |
113512 KB |
Output is correct |
17 |
Correct |
260 ms |
137136 KB |
Output is correct |
18 |
Correct |
275 ms |
142520 KB |
Output is correct |
19 |
Correct |
250 ms |
142584 KB |
Output is correct |
20 |
Correct |
330 ms |
156660 KB |
Output is correct |
21 |
Correct |
310 ms |
156668 KB |
Output is correct |
22 |
Correct |
321 ms |
156716 KB |
Output is correct |
23 |
Correct |
353 ms |
156688 KB |
Output is correct |
24 |
Correct |
98 ms |
113464 KB |
Output is correct |
25 |
Correct |
99 ms |
113480 KB |
Output is correct |
26 |
Correct |
95 ms |
113476 KB |
Output is correct |
27 |
Correct |
98 ms |
113492 KB |
Output is correct |
28 |
Correct |
3 ms |
2432 KB |
Output is correct |
29 |
Correct |
4 ms |
2640 KB |
Output is correct |
30 |
Correct |
5 ms |
2640 KB |
Output is correct |
31 |
Correct |
3 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 |
3 ms |
2384 KB |
Output is correct |
35 |
Correct |
3 ms |
2384 KB |
Output is correct |
36 |
Correct |
3 ms |
2640 KB |
Output is correct |
37 |
Correct |
3 ms |
2640 KB |
Output is correct |
38 |
Correct |
4 ms |
2640 KB |
Output is correct |
39 |
Correct |
4 ms |
2528 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 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
720 KB |
Output is correct |
2 |
Correct |
3 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 |
4 ms |
2640 KB |
Output is correct |
6 |
Correct |
3 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 |
2004 KB |
Output is correct |
11 |
Correct |
2 ms |
2000 KB |
Output is correct |
12 |
Correct |
0 ms |
384 KB |
Output is correct |
13 |
Correct |
2 ms |
2000 KB |
Output is correct |
14 |
Correct |
2 ms |
2000 KB |
Output is correct |
15 |
Correct |
3 ms |
2384 KB |
Output is correct |
16 |
Correct |
3 ms |
2640 KB |
Output is correct |
17 |
Correct |
3 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 |
3 ms |
2640 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 |
2432 KB |
Output is correct |
27 |
Correct |
3 ms |
2384 KB |
Output is correct |
28 |
Correct |
3 ms |
2640 KB |
Output is correct |
29 |
Correct |
4 ms |
2640 KB |
Output is correct |
30 |
Correct |
3 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 |
2000 KB |
Output is correct |
36 |
Correct |
151 ms |
89880 KB |
Output is correct |
37 |
Correct |
250 ms |
142500 KB |
Output is correct |
38 |
Correct |
256 ms |
142368 KB |
Output is correct |
39 |
Correct |
311 ms |
156800 KB |
Output is correct |
40 |
Correct |
304 ms |
156724 KB |
Output is correct |
41 |
Correct |
323 ms |
156768 KB |
Output is correct |
42 |
Correct |
306 ms |
156708 KB |
Output is correct |
43 |
Correct |
95 ms |
113412 KB |
Output is correct |
44 |
Correct |
98 ms |
113480 KB |
Output is correct |
45 |
Correct |
100 ms |
113544 KB |
Output is correct |
46 |
Correct |
124 ms |
113416 KB |
Output is correct |
47 |
Correct |
245 ms |
142400 KB |
Output is correct |
48 |
Correct |
328 ms |
156736 KB |
Output is correct |
49 |
Correct |
311 ms |
156664 KB |
Output is correct |
50 |
Correct |
102 ms |
113404 KB |
Output is correct |
51 |
Correct |
95 ms |
113448 KB |
Output is correct |
52 |
Correct |
246 ms |
142364 KB |
Output is correct |
53 |
Correct |
320 ms |
156652 KB |
Output is correct |
54 |
Correct |
308 ms |
156668 KB |
Output is correct |
55 |
Correct |
99 ms |
113468 KB |
Output is correct |
56 |
Correct |
96 ms |
113448 KB |
Output is correct |
57 |
Correct |
248 ms |
137140 KB |
Output is correct |
58 |
Correct |
248 ms |
142464 KB |
Output is correct |
59 |
Correct |
254 ms |
142492 KB |
Output is correct |
60 |
Correct |
346 ms |
156680 KB |
Output is correct |
61 |
Correct |
305 ms |
156664 KB |
Output is correct |
62 |
Correct |
307 ms |
156708 KB |
Output is correct |
63 |
Correct |
316 ms |
156820 KB |
Output is correct |
64 |
Correct |
101 ms |
113408 KB |
Output is correct |
65 |
Correct |
105 ms |
113472 KB |
Output is correct |
66 |
Correct |
99 ms |
113508 KB |
Output is correct |
67 |
Correct |
99 ms |
113464 KB |
Output is correct |
68 |
Correct |
1186 ms |
141388 KB |
Output is correct |
69 |
Correct |
1371 ms |
142404 KB |
Output is correct |
70 |
Correct |
1523 ms |
142704 KB |
Output is correct |
71 |
Correct |
1475 ms |
156740 KB |
Output is correct |
72 |
Correct |
1527 ms |
156692 KB |
Output is correct |
73 |
Correct |
1518 ms |
156640 KB |
Output is correct |
74 |
Correct |
1650 ms |
156736 KB |
Output is correct |
75 |
Correct |
1050 ms |
113440 KB |
Output is correct |
76 |
Correct |
773 ms |
113516 KB |
Output is correct |
77 |
Correct |
1061 ms |
113452 KB |
Output is correct |
78 |
Correct |
981 ms |
113452 KB |
Output is correct |
79 |
Correct |
904 ms |
113476 KB |
Output is correct |
80 |
Correct |
1012 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 |
246 ms |
142456 KB |
Output is correct |
85 |
Correct |
330 ms |
156624 KB |
Output is correct |
86 |
Correct |
313 ms |
156664 KB |
Output is correct |
87 |
Correct |
99 ms |
113488 KB |
Output is correct |
88 |
Correct |
98 ms |
113516 KB |
Output is correct |
89 |
Correct |
244 ms |
142368 KB |
Output is correct |
90 |
Correct |
308 ms |
156740 KB |
Output is correct |
91 |
Correct |
301 ms |
156656 KB |
Output is correct |
92 |
Correct |
113 ms |
113488 KB |
Output is correct |
93 |
Correct |
97 ms |
113508 KB |
Output is correct |
94 |
Correct |
3 ms |
2384 KB |
Output is correct |
95 |
Correct |
4 ms |
2640 KB |
Output is correct |
96 |
Correct |
4 ms |
2528 KB |
Output is correct |
97 |
Correct |
2 ms |
2000 KB |
Output is correct |
98 |
Correct |
2 ms |
2000 KB |
Output is correct |
99 |
Correct |
3 ms |
2384 KB |
Output is correct |
100 |
Correct |
3 ms |
2640 KB |
Output is correct |
101 |
Correct |
3 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 |
1175 ms |
125400 KB |
Output is correct |
105 |
Correct |
1439 ms |
142376 KB |
Output is correct |
106 |
Correct |
1513 ms |
142540 KB |
Output is correct |
107 |
Correct |
1397 ms |
156712 KB |
Output is correct |
108 |
Incorrect |
1345 ms |
156628 KB |
19976th lines differ - on the 1st token, expected: '2', found: '1' |
109 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
454 ms |
65608 KB |
Output is correct |
2 |
Correct |
950 ms |
113468 KB |
Output is correct |
3 |
Correct |
875 ms |
113528 KB |
Output is correct |
4 |
Correct |
899 ms |
113492 KB |
Output is correct |
5 |
Correct |
943 ms |
113428 KB |
Output is correct |
6 |
Correct |
921 ms |
113480 KB |
Output is correct |
7 |
Correct |
859 ms |
113492 KB |
Output is correct |
8 |
Correct |
0 ms |
208 KB |
Output is correct |
9 |
Correct |
2 ms |
2056 KB |
Output is correct |
10 |
Correct |
2 ms |
2000 KB |
Output is correct |
11 |
Correct |
1 ms |
720 KB |
Output is correct |
12 |
Correct |
3 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 |
4 ms |
2640 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 |
2 ms |
2004 KB |
Output is correct |
21 |
Correct |
2 ms |
2000 KB |
Output is correct |
22 |
Correct |
0 ms |
384 KB |
Output is correct |
23 |
Correct |
2 ms |
2000 KB |
Output is correct |
24 |
Correct |
2 ms |
2000 KB |
Output is correct |
25 |
Correct |
3 ms |
2384 KB |
Output is correct |
26 |
Correct |
3 ms |
2640 KB |
Output is correct |
27 |
Correct |
3 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 |
3 ms |
2640 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 |
2432 KB |
Output is correct |
37 |
Correct |
3 ms |
2384 KB |
Output is correct |
38 |
Correct |
3 ms |
2640 KB |
Output is correct |
39 |
Correct |
4 ms |
2640 KB |
Output is correct |
40 |
Correct |
3 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 |
2000 KB |
Output is correct |
46 |
Correct |
151 ms |
89880 KB |
Output is correct |
47 |
Correct |
250 ms |
142500 KB |
Output is correct |
48 |
Correct |
256 ms |
142368 KB |
Output is correct |
49 |
Correct |
311 ms |
156800 KB |
Output is correct |
50 |
Correct |
304 ms |
156724 KB |
Output is correct |
51 |
Correct |
323 ms |
156768 KB |
Output is correct |
52 |
Correct |
306 ms |
156708 KB |
Output is correct |
53 |
Correct |
95 ms |
113412 KB |
Output is correct |
54 |
Correct |
98 ms |
113480 KB |
Output is correct |
55 |
Correct |
100 ms |
113544 KB |
Output is correct |
56 |
Correct |
124 ms |
113416 KB |
Output is correct |
57 |
Correct |
245 ms |
142400 KB |
Output is correct |
58 |
Correct |
328 ms |
156736 KB |
Output is correct |
59 |
Correct |
311 ms |
156664 KB |
Output is correct |
60 |
Correct |
102 ms |
113404 KB |
Output is correct |
61 |
Correct |
95 ms |
113448 KB |
Output is correct |
62 |
Correct |
246 ms |
142364 KB |
Output is correct |
63 |
Correct |
320 ms |
156652 KB |
Output is correct |
64 |
Correct |
308 ms |
156668 KB |
Output is correct |
65 |
Correct |
99 ms |
113468 KB |
Output is correct |
66 |
Correct |
96 ms |
113448 KB |
Output is correct |
67 |
Correct |
248 ms |
137140 KB |
Output is correct |
68 |
Correct |
248 ms |
142464 KB |
Output is correct |
69 |
Correct |
254 ms |
142492 KB |
Output is correct |
70 |
Correct |
346 ms |
156680 KB |
Output is correct |
71 |
Correct |
305 ms |
156664 KB |
Output is correct |
72 |
Correct |
307 ms |
156708 KB |
Output is correct |
73 |
Correct |
316 ms |
156820 KB |
Output is correct |
74 |
Correct |
101 ms |
113408 KB |
Output is correct |
75 |
Correct |
105 ms |
113472 KB |
Output is correct |
76 |
Correct |
99 ms |
113508 KB |
Output is correct |
77 |
Correct |
99 ms |
113464 KB |
Output is correct |
78 |
Correct |
1186 ms |
141388 KB |
Output is correct |
79 |
Correct |
1371 ms |
142404 KB |
Output is correct |
80 |
Correct |
1523 ms |
142704 KB |
Output is correct |
81 |
Correct |
1475 ms |
156740 KB |
Output is correct |
82 |
Correct |
1527 ms |
156692 KB |
Output is correct |
83 |
Correct |
1518 ms |
156640 KB |
Output is correct |
84 |
Correct |
1650 ms |
156736 KB |
Output is correct |
85 |
Correct |
1050 ms |
113440 KB |
Output is correct |
86 |
Correct |
773 ms |
113516 KB |
Output is correct |
87 |
Correct |
1061 ms |
113452 KB |
Output is correct |
88 |
Correct |
981 ms |
113452 KB |
Output is correct |
89 |
Correct |
904 ms |
113476 KB |
Output is correct |
90 |
Correct |
1012 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 |
246 ms |
142456 KB |
Output is correct |
95 |
Correct |
330 ms |
156624 KB |
Output is correct |
96 |
Correct |
313 ms |
156664 KB |
Output is correct |
97 |
Correct |
99 ms |
113488 KB |
Output is correct |
98 |
Correct |
98 ms |
113516 KB |
Output is correct |
99 |
Correct |
244 ms |
142368 KB |
Output is correct |
100 |
Correct |
308 ms |
156740 KB |
Output is correct |
101 |
Correct |
301 ms |
156656 KB |
Output is correct |
102 |
Correct |
113 ms |
113488 KB |
Output is correct |
103 |
Correct |
97 ms |
113508 KB |
Output is correct |
104 |
Correct |
3 ms |
2384 KB |
Output is correct |
105 |
Correct |
4 ms |
2640 KB |
Output is correct |
106 |
Correct |
4 ms |
2528 KB |
Output is correct |
107 |
Correct |
2 ms |
2000 KB |
Output is correct |
108 |
Correct |
2 ms |
2000 KB |
Output is correct |
109 |
Correct |
3 ms |
2384 KB |
Output is correct |
110 |
Correct |
3 ms |
2640 KB |
Output is correct |
111 |
Correct |
3 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 |
323 ms |
31076 KB |
Output is correct |
115 |
Correct |
1156 ms |
142520 KB |
Output is correct |
116 |
Correct |
1106 ms |
142448 KB |
Output is correct |
117 |
Correct |
1302 ms |
156652 KB |
Output is correct |
118 |
Correct |
1168 ms |
156720 KB |
Output is correct |
119 |
Correct |
1207 ms |
156740 KB |
Output is correct |
120 |
Correct |
1270 ms |
156756 KB |
Output is correct |
121 |
Correct |
914 ms |
113436 KB |
Output is correct |
122 |
Correct |
872 ms |
113540 KB |
Output is correct |
123 |
Correct |
856 ms |
113488 KB |
Output is correct |
124 |
Correct |
967 ms |
113448 KB |
Output is correct |
125 |
Correct |
301 ms |
142516 KB |
Output is correct |
126 |
Correct |
314 ms |
156668 KB |
Output is correct |
127 |
Correct |
351 ms |
156652 KB |
Output is correct |
128 |
Correct |
98 ms |
113492 KB |
Output is correct |
129 |
Correct |
95 ms |
113512 KB |
Output is correct |
130 |
Correct |
260 ms |
137136 KB |
Output is correct |
131 |
Correct |
275 ms |
142520 KB |
Output is correct |
132 |
Correct |
250 ms |
142584 KB |
Output is correct |
133 |
Correct |
330 ms |
156660 KB |
Output is correct |
134 |
Correct |
310 ms |
156668 KB |
Output is correct |
135 |
Correct |
321 ms |
156716 KB |
Output is correct |
136 |
Correct |
353 ms |
156688 KB |
Output is correct |
137 |
Correct |
98 ms |
113464 KB |
Output is correct |
138 |
Correct |
99 ms |
113480 KB |
Output is correct |
139 |
Correct |
95 ms |
113476 KB |
Output is correct |
140 |
Correct |
98 ms |
113492 KB |
Output is correct |
141 |
Correct |
3 ms |
2432 KB |
Output is correct |
142 |
Correct |
4 ms |
2640 KB |
Output is correct |
143 |
Correct |
5 ms |
2640 KB |
Output is correct |
144 |
Correct |
3 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 |
3 ms |
2384 KB |
Output is correct |
148 |
Correct |
3 ms |
2384 KB |
Output is correct |
149 |
Correct |
3 ms |
2640 KB |
Output is correct |
150 |
Correct |
3 ms |
2640 KB |
Output is correct |
151 |
Correct |
4 ms |
2640 KB |
Output is correct |
152 |
Correct |
4 ms |
2528 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 |
1175 ms |
125400 KB |
Output is correct |
158 |
Correct |
1439 ms |
142376 KB |
Output is correct |
159 |
Correct |
1513 ms |
142540 KB |
Output is correct |
160 |
Correct |
1397 ms |
156712 KB |
Output is correct |
161 |
Incorrect |
1345 ms |
156628 KB |
19976th lines differ - on the 1st token, expected: '2', found: '1' |
162 |
Halted |
0 ms |
0 KB |
- |