#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mx 100005
struct tree {
struct node {
node() :node(0, 0) {};
node(int l, int r) : l(l), r(r) {}
int l = 0; int r = 0; int v = 0;
node* lc = nullptr;
node* rc = nullptr;
}mem[mx * 20 * 4]; int sz = 0;
vector<node*> rt;
vector<int> nums;
tree() {
nums.push_back(numeric_limits<int>::min());
rt.push_back(build(0, mx));
}
void upd(int idx, int val, int v) {
//cout << "index: " << idx << "," << "value: " << val << "," << "time: " << v << endl;
nums.push_back(v); // v = time
rt.push_back(upd2(rt.back(), idx, val));
}
node* build(int l, int r) {
node* rt = &mem[sz++]; rt->l = l; rt->r = r;
if (l == r) return rt;
int m = (l + r) / 2;
rt->lc = build(l, m);
rt->rc = build(m + 1, r);
return rt;
}
node* upd2(node* rt, int idx, int v) {
//return the root
if (rt->l > idx || rt->r < idx) return rt;
node* tr = &mem[sz++]; *tr = *rt; //copy?
if (tr->l == tr->r) {
tr->v = v;
return tr;
}
tr->lc = upd2(tr->lc, idx, v);
tr->rc = upd2(tr->rc, idx, v);
tr->v = tr->lc->v + tr->rc->v;
return tr;
}
array<int, 3> query(int l, int r, int t) {
node* vv = rt.at((upper_bound(nums.begin(), nums.end(), t) - nums.begin())-1);
return { queryL(vv, l), queryR(vv, r), queryS(vv, l, r)};
}
int queryS(node* rt, int l, int r) {
if (rt->l > r || rt->r < l)return 0;
if (rt->l >= l && rt->r <= r) return rt->v;
return queryS(rt->lc, l, r) + queryS(rt->rc, l, r);
}
int queryL(node* rt, int l) { //query left most with index >= l and value >= v
if (rt->r < l) return -1;
if (!rt->v) return -1;
if (rt->l == rt->r) return rt->l;
int res = queryL(rt->lc, l);
return res == -1 ? queryL(rt->rc, l) : res;
}
int queryR(node* rt, int r) { //query right most with index <= r
if (rt->l > r) return -1;
if (!rt->v) return -1;
if (rt->l == rt->r) return rt->l;
int res = queryR(rt->rc, r);
return res == -1 ? queryR(rt->lc, r) : res;
}
} open, close;
vector<int> h;
//struct mintree { //ehh should be sparse tablebut wtv
// struct node {
// node(int l, int r) : l(l), r(r) {};
// int v = numeric_limits<int>::max();
// int l, r;
// node *lc = 0, *rc = 0;
// };
// node* rt;
// mintree() {
// rt = build(0, mx);
// }
// node* build(int l, int r) {
// node* rt = new node(l, r);
// if (l == r) return rt;
// int m = (l + r) / 2;
// rt->lc = build(l, m);
// rt->rc = build(m + 1, r);
// return rt;
// }
// void upd(int i, int v) {
// upd2(rt, i, v);
// }
// void upd2(node* rt, int i, int v) {
// if (i < rt->l || i > rt->r) return;
// if (rt->l == rt->r) {
// rt->v = v;
// return;
// }
// upd2(rt->lc, i, v); upd2(rt->rc, i, v);
// rt->v = min(rt->lc->v, rt->rc->v);
// }
// int query(int l, int r) {
// return query2(rt, l, r);
// }
// int query2(node* rt, int l, int r) {
// if (l > rt->r || r < rt->l) return numeric_limits<int>::max();
// if (rt->l >= l && rt->r <= r) return rt->v;
// return min(query2(rt->lc, l, r), query2(rt->rc, l, r));
// }
//} ac2;
#define ll int
struct difftree { //what the fk am i doing
struct node {
node(int l, int r) : l(l), r(r) {};
ll mn = std::numeric_limits<int>::max()/2;
node() :node(0, 0) {};
ll ma = std::numeric_limits<int>::min()/2;
ll incdif = 0, decdif = 0;
int l, r;
node* lc = 0, * rc = 0;
} mem[mx * 4]; int sz = 0;
node* rt = 0;
difftree() {
rt = build(0, mx);
//cout << rt->l << "," << rt->r << endl;
}
node* build(int l, int r) {
node* rt = &mem[sz++]; rt->l = l, rt->r = r;
if (l == r) return rt;
int m = (l + r) / 2;
rt->lc = build(l, m);
rt->rc = build(m + 1, r);
return rt;
}
void upd(int i, int v) {
upd2(rt, i, v);
}
void upd2(node* rt, int i, int v) {
if (i < rt->l || i > rt->r) return;
if (rt->l == rt->r) {
rt->mn = rt->ma = v;
return;
}
upd2(rt->lc, i, v); upd2(rt->rc, i, v);
rt->mn = min(rt->lc->mn, rt->rc->mn);
rt->ma = max(rt->lc->ma, rt->rc->ma);
rt->incdif = max(max(rt->lc->incdif, rt->rc->incdif), rt->rc->ma - rt->lc->mn);
rt->decdif = max(max(rt->lc->decdif, rt->rc->decdif), rt->lc->ma - rt->rc->mn);
}
int incdif(int l, int r) {
node amogus = query2(rt, l, r);
int tmp = amogus.incdif;
return tmp;
}
int decdif(int l, int r) {
node amogus = query2(rt, l, r);
int tmp = amogus.decdif;
return tmp;
}
node query2(node* rt, int l, int r) {
//cout << "gonna kms" << endl;
//cout << l << "," << rt->l << "," << r << "," << rt->r << endl;
if (l > rt->r || r < rt->l) return node(-1,-1);
if (rt->l >= l && rt->r <= r) return *rt;
node owo(-1, -1);
node lc = query2(rt->lc, l, r);
node rc = query2(rt->rc, l, r);
owo.mn = min(lc.mn, rc.mn);
owo.ma = max(lc.ma, rc.ma);
owo.incdif = max(max(lc.incdif, rc.incdif), rc.ma - lc.mn);
owo.decdif = max(max(lc.decdif, rc.decdif), lc.ma - rc.mn);
return owo;
}
int walk(int l, int D) {
node tmp = walking(rt, node(-1, -1), l, D);
return tmp.r;
}
inline node merge(const node& lc, const node& rc) {
node owo(-1, -1);
owo.mn = min(lc.mn, rc.mn);
owo.ma = max(lc.ma, rc.ma);
owo.incdif = max(max(lc.incdif, rc.incdif), rc.ma - lc.mn);
owo.r = rc.r;
return owo;
}
node walking(node* rt, const node& left, int l, int D) {
if (l > rt->r) return node(-1, -1);
if (rt->l >= l) {
node tmp = merge(left, *rt);
if (tmp.incdif < D) return tmp;
}
if (rt->l == rt->r) {
return merge(left, *rt);
}
node lc = walking(rt->lc, left, l, D);
if (lc.incdif >= D) return lc;
return walking(rt->rc, lc, l, D);
}
} diff;
//
//struct dsu {
// vector<int> p, r;
// dsu() {
// p.resize(mx, -1);
// r.resize(mx, 0);
// }
// int par(int x) {
// return p.at(x) == -1 ? x : p.at(x) = par(p.at(x));
// }
// void merge(int a, int b) {
// a = par(a), b = par(b);
// if (a == b) return;
// //attaching b to a, so r.at(a) must be bigger
// if (r.at(a) < r.at(b)) swap(a, b);
// if (r.at(a) == r.at(b)) r.at(a)++;
// p.at(b) = a;
// }
//};
void init(int N, vector<int> H) {
h = H;
h.insert(h.begin(), numeric_limits<int>::max()); N++;
set<int> ranges;
for (int i = 0; i < N; i++)
ranges.insert(i);
vector<int> mn = h;
vector<bool> exists(N, 1);
set<pair<int, int>> q;
for (int i = 0; i < N; i++) {
//ac2.upd(i, h.at(i));
diff.upd(i, h.at(i));
open.upd(i, 1, numeric_limits<int>::min());
close.upd(i+1, 1, numeric_limits<int>::min());
int v = numeric_limits<int>::max();
if (i) v = min(v, h.at(i) - mn.at(i));
if (i < N - 1)v = min(v, h.at(i + 1) - mn.at(i));
q.insert({ v, i });
}
int time = numeric_limits<int>::min();
while (q.size()) {
auto [a, b] = *q.begin();
time = max(time, a);
q.erase(q.begin());
if (!exists.at(b)) continue;
auto x = ranges.find(b);
if (b && h.at(b) - mn.at(b) <= a) {
//deletus
auto x2 = x; x2--;
if (exists.at(*x2)) {
exists.at(*x) = 0;
open.upd(*x, 0, time);
auto x3 = x; x3++;
if (x3 == ranges.end()) close.upd(N, 0, time);
else close.upd(*x3, 0, time);
continue;
}
int tmp = mn.at(b);
exists.at(*x) = 0;
exists.at(*x2) = 1;
open.upd(*x, 0, time);
open.upd(*x2, 1, time);
ranges.erase(x--);
mn.at(*x) = min(mn.at(*x), tmp);
}
else {
auto x2 = x; x2++;
//assert(x2 != ranges.end()); //troll
if (x2 == ranges.end()) {
continue;
}
if (exists.at(*x2)) {
open.upd(*x, 0, time);
close.upd(*x2, 0, time);
exists.at(*x) = 0;
continue;
}
if (x2 != ranges.end() && h.at(*x2) - mn.at(*x) <= a) {
mn.at(*x) = min(mn.at(*x), mn.at(*x2));
exists.at(*x2) = 0;
close.upd(*x2, 0, time);
auto x3 = x2; x3++;
if(x3 != ranges.end())close.upd(*x3, 1, time);
else close.upd(N, 1, time);
ranges.erase(x2);
}
else {
break;
}
}
//x is result
b = *x; int v = numeric_limits<int>::max();
if (b) v = min(v, h.at(b) - mn.at(b));
x++;
if (x != ranges.end()) v = min(v, h.at(*x) - mn.at(b));
q.insert({ v, b });
//yeahhhhhhh......
}
h = H;
}
int max_towers(int L, int R, int D) {
L++, R++; D--;
//this is so sus
auto [a, b, c] = open.query(L, R, D);
auto [e, f, g] = close.query(L, R, D);
//auto .at(x, y, z) = open.query(0, 7, numeric_limits<int>::min());
//cout << x << "," << y << "," << z << endl;
//cout << c << "," << g << endl;
if (c && g && e <= a) {
g--;
}
if (c && g && b >= f) {
c--;
}
int bruh = 1;
int vvvv = diff.walk(L, D + 1);
if (vvvv < R && diff.decdif(vvvv, R) >= D + 1) {
bruh = 2;
}
if (c == 0 || g == 0) {
return bruh;
}
//if (c == 0 || g == 0) {
// //AMONGUS
// int l = L, r = R, m = 0;
// int inc = 0, dec = 0;
// while (l < r) {
// m = (l + r) / 2;
// inc = diff.incdif(L, m);
// dec = diff.decdif(m, R);
// //cout <<L<<","<<R<<","<<m << "," << inc << "," << dec << endl;
// if (min(inc, dec) >= D+1) break;
// if (max(inc, dec) < D + 1)break;
// if (inc < dec)
// l = m + 1;
// else
// r = m - 1;
// }
// //cout << "." << endl;
// if (min(inc, dec) >= D+1) {
// return 2;
// }
// else {
// return 1;
// }
//}
//cout << a << "," << b << "," << c << endl;
//cout << e << "," << f << "," << g << endl;
//assert(a != -1);
//assert(b != -1);
//assert(e != -1);
//assert(f != -1);
//assert(c == g);
//cout << diff.incdif(L, a) << "," << L << "," << a << endl;
if (diff.incdif(L, a) >= D+1) c++;
if (diff.decdif(f, R) >= D+1) c++;
return max(c, bruh);
}
////
//int main() {
// int N, Q;
// assert(2 == scanf("%d %d", &N, &Q));
// std::vector<int> H(N);
// for (int i = 0; i < N; ++i) {
// assert(1 == scanf("%d", &H.at(i)));
// }
// init(N, H);
//
// for (int i = 0; i < Q; ++i) {
// int L, R, D;
// assert(3 == scanf("%d %d %d", &L, &R, &D));
// printf("%d\n", max_towers(L, R, D));
// }
// return 0;
//}
Compilation message
towers.cpp:124: warning: "ll" redefined
124 | #define ll int
|
towers.cpp:4: note: this is the location of the previous definition
4 | #define ll long long
|
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1052 ms |
528200 KB |
Output is correct |
2 |
Correct |
1857 ms |
534568 KB |
Output is correct |
3 |
Correct |
1866 ms |
534432 KB |
Output is correct |
4 |
Correct |
1759 ms |
534772 KB |
Output is correct |
5 |
Correct |
2086 ms |
535668 KB |
Output is correct |
6 |
Correct |
2105 ms |
534768 KB |
Output is correct |
7 |
Correct |
2113 ms |
535660 KB |
Output is correct |
8 |
Correct |
225 ms |
516944 KB |
Output is correct |
9 |
Correct |
225 ms |
517488 KB |
Output is correct |
10 |
Correct |
232 ms |
517460 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
233 ms |
516972 KB |
Output is correct |
2 |
Correct |
223 ms |
517448 KB |
Output is correct |
3 |
Correct |
216 ms |
517332 KB |
Output is correct |
4 |
Correct |
226 ms |
517428 KB |
Output is correct |
5 |
Correct |
235 ms |
517388 KB |
Output is correct |
6 |
Correct |
227 ms |
517380 KB |
Output is correct |
7 |
Correct |
216 ms |
517404 KB |
Output is correct |
8 |
Correct |
217 ms |
517332 KB |
Output is correct |
9 |
Correct |
214 ms |
517316 KB |
Output is correct |
10 |
Correct |
216 ms |
517296 KB |
Output is correct |
11 |
Correct |
232 ms |
517320 KB |
Output is correct |
12 |
Correct |
214 ms |
516920 KB |
Output is correct |
13 |
Correct |
230 ms |
517432 KB |
Output is correct |
14 |
Correct |
221 ms |
517320 KB |
Output is correct |
15 |
Correct |
210 ms |
517556 KB |
Output is correct |
16 |
Correct |
224 ms |
517636 KB |
Output is correct |
17 |
Correct |
226 ms |
517408 KB |
Output is correct |
18 |
Correct |
214 ms |
517312 KB |
Output is correct |
19 |
Correct |
209 ms |
517324 KB |
Output is correct |
20 |
Correct |
235 ms |
517412 KB |
Output is correct |
21 |
Correct |
260 ms |
517312 KB |
Output is correct |
22 |
Correct |
232 ms |
517456 KB |
Output is correct |
23 |
Correct |
211 ms |
517280 KB |
Output is correct |
24 |
Correct |
229 ms |
517364 KB |
Output is correct |
25 |
Correct |
212 ms |
517084 KB |
Output is correct |
26 |
Correct |
218 ms |
517300 KB |
Output is correct |
27 |
Correct |
231 ms |
517424 KB |
Output is correct |
28 |
Correct |
216 ms |
517444 KB |
Output is correct |
29 |
Correct |
249 ms |
517396 KB |
Output is correct |
30 |
Correct |
213 ms |
517320 KB |
Output is correct |
31 |
Correct |
219 ms |
517356 KB |
Output is correct |
32 |
Correct |
235 ms |
517392 KB |
Output is correct |
33 |
Correct |
211 ms |
517276 KB |
Output is correct |
34 |
Correct |
231 ms |
517284 KB |
Output is correct |
35 |
Correct |
214 ms |
517360 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
233 ms |
516972 KB |
Output is correct |
2 |
Correct |
223 ms |
517448 KB |
Output is correct |
3 |
Correct |
216 ms |
517332 KB |
Output is correct |
4 |
Correct |
226 ms |
517428 KB |
Output is correct |
5 |
Correct |
235 ms |
517388 KB |
Output is correct |
6 |
Correct |
227 ms |
517380 KB |
Output is correct |
7 |
Correct |
216 ms |
517404 KB |
Output is correct |
8 |
Correct |
217 ms |
517332 KB |
Output is correct |
9 |
Correct |
214 ms |
517316 KB |
Output is correct |
10 |
Correct |
216 ms |
517296 KB |
Output is correct |
11 |
Correct |
232 ms |
517320 KB |
Output is correct |
12 |
Correct |
214 ms |
516920 KB |
Output is correct |
13 |
Correct |
230 ms |
517432 KB |
Output is correct |
14 |
Correct |
221 ms |
517320 KB |
Output is correct |
15 |
Correct |
210 ms |
517556 KB |
Output is correct |
16 |
Correct |
224 ms |
517636 KB |
Output is correct |
17 |
Correct |
226 ms |
517408 KB |
Output is correct |
18 |
Correct |
214 ms |
517312 KB |
Output is correct |
19 |
Correct |
209 ms |
517324 KB |
Output is correct |
20 |
Correct |
235 ms |
517412 KB |
Output is correct |
21 |
Correct |
260 ms |
517312 KB |
Output is correct |
22 |
Correct |
232 ms |
517456 KB |
Output is correct |
23 |
Correct |
211 ms |
517280 KB |
Output is correct |
24 |
Correct |
229 ms |
517364 KB |
Output is correct |
25 |
Correct |
212 ms |
517084 KB |
Output is correct |
26 |
Correct |
218 ms |
517300 KB |
Output is correct |
27 |
Correct |
231 ms |
517424 KB |
Output is correct |
28 |
Correct |
216 ms |
517444 KB |
Output is correct |
29 |
Correct |
249 ms |
517396 KB |
Output is correct |
30 |
Correct |
213 ms |
517320 KB |
Output is correct |
31 |
Correct |
219 ms |
517356 KB |
Output is correct |
32 |
Correct |
235 ms |
517392 KB |
Output is correct |
33 |
Correct |
211 ms |
517276 KB |
Output is correct |
34 |
Correct |
231 ms |
517284 KB |
Output is correct |
35 |
Correct |
214 ms |
517360 KB |
Output is correct |
36 |
Correct |
654 ms |
529400 KB |
Output is correct |
37 |
Correct |
810 ms |
537256 KB |
Output is correct |
38 |
Correct |
815 ms |
537268 KB |
Output is correct |
39 |
Correct |
796 ms |
535500 KB |
Output is correct |
40 |
Correct |
853 ms |
535600 KB |
Output is correct |
41 |
Correct |
787 ms |
535492 KB |
Output is correct |
42 |
Correct |
835 ms |
535512 KB |
Output is correct |
43 |
Correct |
466 ms |
534700 KB |
Output is correct |
44 |
Correct |
756 ms |
535628 KB |
Output is correct |
45 |
Correct |
471 ms |
535508 KB |
Output is correct |
46 |
Correct |
753 ms |
535556 KB |
Output is correct |
47 |
Correct |
827 ms |
537224 KB |
Output is correct |
48 |
Correct |
835 ms |
535448 KB |
Output is correct |
49 |
Correct |
800 ms |
535588 KB |
Output is correct |
50 |
Correct |
729 ms |
535656 KB |
Output is correct |
51 |
Correct |
470 ms |
534856 KB |
Output is correct |
52 |
Correct |
844 ms |
537264 KB |
Output is correct |
53 |
Correct |
888 ms |
535476 KB |
Output is correct |
54 |
Correct |
930 ms |
535484 KB |
Output is correct |
55 |
Correct |
794 ms |
535592 KB |
Output is correct |
56 |
Correct |
469 ms |
535460 KB |
Output is correct |
57 |
Correct |
792 ms |
536996 KB |
Output is correct |
58 |
Correct |
834 ms |
537296 KB |
Output is correct |
59 |
Correct |
834 ms |
537264 KB |
Output is correct |
60 |
Correct |
971 ms |
535452 KB |
Output is correct |
61 |
Correct |
807 ms |
535476 KB |
Output is correct |
62 |
Correct |
790 ms |
535516 KB |
Output is correct |
63 |
Correct |
888 ms |
535416 KB |
Output is correct |
64 |
Correct |
459 ms |
534788 KB |
Output is correct |
65 |
Correct |
732 ms |
535656 KB |
Output is correct |
66 |
Correct |
457 ms |
534688 KB |
Output is correct |
67 |
Correct |
700 ms |
535848 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1972 ms |
537128 KB |
Output is correct |
2 |
Correct |
2333 ms |
537296 KB |
Output is correct |
3 |
Correct |
2192 ms |
537244 KB |
Output is correct |
4 |
Correct |
2254 ms |
535428 KB |
Output is correct |
5 |
Correct |
2289 ms |
535472 KB |
Output is correct |
6 |
Correct |
2298 ms |
535604 KB |
Output is correct |
7 |
Correct |
2522 ms |
535448 KB |
Output is correct |
8 |
Correct |
1951 ms |
534764 KB |
Output is correct |
9 |
Correct |
1899 ms |
535736 KB |
Output is correct |
10 |
Correct |
1928 ms |
534688 KB |
Output is correct |
11 |
Correct |
1988 ms |
535652 KB |
Output is correct |
12 |
Correct |
1824 ms |
534856 KB |
Output is correct |
13 |
Correct |
2003 ms |
535660 KB |
Output is correct |
14 |
Correct |
210 ms |
516980 KB |
Output is correct |
15 |
Correct |
216 ms |
517320 KB |
Output is correct |
16 |
Correct |
212 ms |
517348 KB |
Output is correct |
17 |
Correct |
798 ms |
537244 KB |
Output is correct |
18 |
Correct |
815 ms |
535540 KB |
Output is correct |
19 |
Correct |
838 ms |
535576 KB |
Output is correct |
20 |
Correct |
749 ms |
535592 KB |
Output is correct |
21 |
Correct |
459 ms |
534856 KB |
Output is correct |
22 |
Correct |
815 ms |
537288 KB |
Output is correct |
23 |
Correct |
820 ms |
535460 KB |
Output is correct |
24 |
Correct |
782 ms |
535636 KB |
Output is correct |
25 |
Correct |
717 ms |
535840 KB |
Output is correct |
26 |
Correct |
450 ms |
535452 KB |
Output is correct |
27 |
Correct |
212 ms |
517424 KB |
Output is correct |
28 |
Correct |
213 ms |
517356 KB |
Output is correct |
29 |
Correct |
219 ms |
517420 KB |
Output is correct |
30 |
Correct |
229 ms |
517304 KB |
Output is correct |
31 |
Correct |
220 ms |
517300 KB |
Output is correct |
32 |
Correct |
213 ms |
517320 KB |
Output is correct |
33 |
Correct |
212 ms |
517376 KB |
Output is correct |
34 |
Correct |
207 ms |
517340 KB |
Output is correct |
35 |
Correct |
211 ms |
517284 KB |
Output is correct |
36 |
Correct |
212 ms |
517364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
729 ms |
521880 KB |
Output is correct |
2 |
Correct |
2052 ms |
537424 KB |
Output is correct |
3 |
Correct |
2084 ms |
537336 KB |
Output is correct |
4 |
Correct |
2057 ms |
535616 KB |
Output is correct |
5 |
Correct |
1963 ms |
535496 KB |
Output is correct |
6 |
Correct |
2128 ms |
535476 KB |
Output is correct |
7 |
Correct |
2540 ms |
535652 KB |
Output is correct |
8 |
Correct |
1414 ms |
534692 KB |
Output is correct |
9 |
Correct |
1645 ms |
535812 KB |
Output is correct |
10 |
Correct |
1453 ms |
534864 KB |
Output is correct |
11 |
Correct |
1767 ms |
535748 KB |
Output is correct |
12 |
Correct |
789 ms |
537312 KB |
Output is correct |
13 |
Correct |
808 ms |
535752 KB |
Output is correct |
14 |
Correct |
813 ms |
535712 KB |
Output is correct |
15 |
Correct |
719 ms |
535604 KB |
Output is correct |
16 |
Correct |
436 ms |
535456 KB |
Output is correct |
17 |
Correct |
763 ms |
536944 KB |
Output is correct |
18 |
Correct |
792 ms |
537168 KB |
Output is correct |
19 |
Correct |
765 ms |
537320 KB |
Output is correct |
20 |
Correct |
787 ms |
535476 KB |
Output is correct |
21 |
Correct |
791 ms |
535652 KB |
Output is correct |
22 |
Correct |
806 ms |
535588 KB |
Output is correct |
23 |
Correct |
816 ms |
535588 KB |
Output is correct |
24 |
Correct |
441 ms |
534800 KB |
Output is correct |
25 |
Correct |
737 ms |
535596 KB |
Output is correct |
26 |
Correct |
444 ms |
534740 KB |
Output is correct |
27 |
Correct |
763 ms |
535760 KB |
Output is correct |
28 |
Correct |
233 ms |
517520 KB |
Output is correct |
29 |
Correct |
214 ms |
517356 KB |
Output is correct |
30 |
Correct |
213 ms |
517432 KB |
Output is correct |
31 |
Correct |
211 ms |
517388 KB |
Output is correct |
32 |
Correct |
216 ms |
517336 KB |
Output is correct |
33 |
Correct |
213 ms |
517152 KB |
Output is correct |
34 |
Correct |
218 ms |
517428 KB |
Output is correct |
35 |
Correct |
226 ms |
517428 KB |
Output is correct |
36 |
Correct |
246 ms |
517432 KB |
Output is correct |
37 |
Correct |
223 ms |
517424 KB |
Output is correct |
38 |
Correct |
230 ms |
517344 KB |
Output is correct |
39 |
Correct |
230 ms |
517316 KB |
Output is correct |
40 |
Correct |
231 ms |
517368 KB |
Output is correct |
41 |
Correct |
225 ms |
517392 KB |
Output is correct |
42 |
Correct |
217 ms |
517320 KB |
Output is correct |
43 |
Correct |
222 ms |
517416 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
233 ms |
516972 KB |
Output is correct |
2 |
Correct |
223 ms |
517448 KB |
Output is correct |
3 |
Correct |
216 ms |
517332 KB |
Output is correct |
4 |
Correct |
226 ms |
517428 KB |
Output is correct |
5 |
Correct |
235 ms |
517388 KB |
Output is correct |
6 |
Correct |
227 ms |
517380 KB |
Output is correct |
7 |
Correct |
216 ms |
517404 KB |
Output is correct |
8 |
Correct |
217 ms |
517332 KB |
Output is correct |
9 |
Correct |
214 ms |
517316 KB |
Output is correct |
10 |
Correct |
216 ms |
517296 KB |
Output is correct |
11 |
Correct |
232 ms |
517320 KB |
Output is correct |
12 |
Correct |
214 ms |
516920 KB |
Output is correct |
13 |
Correct |
230 ms |
517432 KB |
Output is correct |
14 |
Correct |
221 ms |
517320 KB |
Output is correct |
15 |
Correct |
210 ms |
517556 KB |
Output is correct |
16 |
Correct |
224 ms |
517636 KB |
Output is correct |
17 |
Correct |
226 ms |
517408 KB |
Output is correct |
18 |
Correct |
214 ms |
517312 KB |
Output is correct |
19 |
Correct |
209 ms |
517324 KB |
Output is correct |
20 |
Correct |
235 ms |
517412 KB |
Output is correct |
21 |
Correct |
260 ms |
517312 KB |
Output is correct |
22 |
Correct |
232 ms |
517456 KB |
Output is correct |
23 |
Correct |
211 ms |
517280 KB |
Output is correct |
24 |
Correct |
229 ms |
517364 KB |
Output is correct |
25 |
Correct |
212 ms |
517084 KB |
Output is correct |
26 |
Correct |
218 ms |
517300 KB |
Output is correct |
27 |
Correct |
231 ms |
517424 KB |
Output is correct |
28 |
Correct |
216 ms |
517444 KB |
Output is correct |
29 |
Correct |
249 ms |
517396 KB |
Output is correct |
30 |
Correct |
213 ms |
517320 KB |
Output is correct |
31 |
Correct |
219 ms |
517356 KB |
Output is correct |
32 |
Correct |
235 ms |
517392 KB |
Output is correct |
33 |
Correct |
211 ms |
517276 KB |
Output is correct |
34 |
Correct |
231 ms |
517284 KB |
Output is correct |
35 |
Correct |
214 ms |
517360 KB |
Output is correct |
36 |
Correct |
654 ms |
529400 KB |
Output is correct |
37 |
Correct |
810 ms |
537256 KB |
Output is correct |
38 |
Correct |
815 ms |
537268 KB |
Output is correct |
39 |
Correct |
796 ms |
535500 KB |
Output is correct |
40 |
Correct |
853 ms |
535600 KB |
Output is correct |
41 |
Correct |
787 ms |
535492 KB |
Output is correct |
42 |
Correct |
835 ms |
535512 KB |
Output is correct |
43 |
Correct |
466 ms |
534700 KB |
Output is correct |
44 |
Correct |
756 ms |
535628 KB |
Output is correct |
45 |
Correct |
471 ms |
535508 KB |
Output is correct |
46 |
Correct |
753 ms |
535556 KB |
Output is correct |
47 |
Correct |
827 ms |
537224 KB |
Output is correct |
48 |
Correct |
835 ms |
535448 KB |
Output is correct |
49 |
Correct |
800 ms |
535588 KB |
Output is correct |
50 |
Correct |
729 ms |
535656 KB |
Output is correct |
51 |
Correct |
470 ms |
534856 KB |
Output is correct |
52 |
Correct |
844 ms |
537264 KB |
Output is correct |
53 |
Correct |
888 ms |
535476 KB |
Output is correct |
54 |
Correct |
930 ms |
535484 KB |
Output is correct |
55 |
Correct |
794 ms |
535592 KB |
Output is correct |
56 |
Correct |
469 ms |
535460 KB |
Output is correct |
57 |
Correct |
792 ms |
536996 KB |
Output is correct |
58 |
Correct |
834 ms |
537296 KB |
Output is correct |
59 |
Correct |
834 ms |
537264 KB |
Output is correct |
60 |
Correct |
971 ms |
535452 KB |
Output is correct |
61 |
Correct |
807 ms |
535476 KB |
Output is correct |
62 |
Correct |
790 ms |
535516 KB |
Output is correct |
63 |
Correct |
888 ms |
535416 KB |
Output is correct |
64 |
Correct |
459 ms |
534788 KB |
Output is correct |
65 |
Correct |
732 ms |
535656 KB |
Output is correct |
66 |
Correct |
457 ms |
534688 KB |
Output is correct |
67 |
Correct |
700 ms |
535848 KB |
Output is correct |
68 |
Correct |
1972 ms |
537128 KB |
Output is correct |
69 |
Correct |
2333 ms |
537296 KB |
Output is correct |
70 |
Correct |
2192 ms |
537244 KB |
Output is correct |
71 |
Correct |
2254 ms |
535428 KB |
Output is correct |
72 |
Correct |
2289 ms |
535472 KB |
Output is correct |
73 |
Correct |
2298 ms |
535604 KB |
Output is correct |
74 |
Correct |
2522 ms |
535448 KB |
Output is correct |
75 |
Correct |
1951 ms |
534764 KB |
Output is correct |
76 |
Correct |
1899 ms |
535736 KB |
Output is correct |
77 |
Correct |
1928 ms |
534688 KB |
Output is correct |
78 |
Correct |
1988 ms |
535652 KB |
Output is correct |
79 |
Correct |
1824 ms |
534856 KB |
Output is correct |
80 |
Correct |
2003 ms |
535660 KB |
Output is correct |
81 |
Correct |
210 ms |
516980 KB |
Output is correct |
82 |
Correct |
216 ms |
517320 KB |
Output is correct |
83 |
Correct |
212 ms |
517348 KB |
Output is correct |
84 |
Correct |
798 ms |
537244 KB |
Output is correct |
85 |
Correct |
815 ms |
535540 KB |
Output is correct |
86 |
Correct |
838 ms |
535576 KB |
Output is correct |
87 |
Correct |
749 ms |
535592 KB |
Output is correct |
88 |
Correct |
459 ms |
534856 KB |
Output is correct |
89 |
Correct |
815 ms |
537288 KB |
Output is correct |
90 |
Correct |
820 ms |
535460 KB |
Output is correct |
91 |
Correct |
782 ms |
535636 KB |
Output is correct |
92 |
Correct |
717 ms |
535840 KB |
Output is correct |
93 |
Correct |
450 ms |
535452 KB |
Output is correct |
94 |
Correct |
212 ms |
517424 KB |
Output is correct |
95 |
Correct |
213 ms |
517356 KB |
Output is correct |
96 |
Correct |
219 ms |
517420 KB |
Output is correct |
97 |
Correct |
229 ms |
517304 KB |
Output is correct |
98 |
Correct |
220 ms |
517300 KB |
Output is correct |
99 |
Correct |
213 ms |
517320 KB |
Output is correct |
100 |
Correct |
212 ms |
517376 KB |
Output is correct |
101 |
Correct |
207 ms |
517340 KB |
Output is correct |
102 |
Correct |
211 ms |
517284 KB |
Output is correct |
103 |
Correct |
212 ms |
517364 KB |
Output is correct |
104 |
Correct |
2055 ms |
535912 KB |
Output is correct |
105 |
Correct |
2271 ms |
537380 KB |
Output is correct |
106 |
Correct |
2319 ms |
537256 KB |
Output is correct |
107 |
Correct |
2317 ms |
535464 KB |
Output is correct |
108 |
Correct |
2405 ms |
535672 KB |
Output is correct |
109 |
Correct |
2682 ms |
535712 KB |
Output is correct |
110 |
Correct |
2313 ms |
535672 KB |
Output is correct |
111 |
Correct |
1795 ms |
534696 KB |
Output is correct |
112 |
Correct |
1993 ms |
535668 KB |
Output is correct |
113 |
Correct |
1751 ms |
535488 KB |
Output is correct |
114 |
Correct |
2017 ms |
535712 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1052 ms |
528200 KB |
Output is correct |
2 |
Correct |
1857 ms |
534568 KB |
Output is correct |
3 |
Correct |
1866 ms |
534432 KB |
Output is correct |
4 |
Correct |
1759 ms |
534772 KB |
Output is correct |
5 |
Correct |
2086 ms |
535668 KB |
Output is correct |
6 |
Correct |
2105 ms |
534768 KB |
Output is correct |
7 |
Correct |
2113 ms |
535660 KB |
Output is correct |
8 |
Correct |
225 ms |
516944 KB |
Output is correct |
9 |
Correct |
225 ms |
517488 KB |
Output is correct |
10 |
Correct |
232 ms |
517460 KB |
Output is correct |
11 |
Correct |
233 ms |
516972 KB |
Output is correct |
12 |
Correct |
223 ms |
517448 KB |
Output is correct |
13 |
Correct |
216 ms |
517332 KB |
Output is correct |
14 |
Correct |
226 ms |
517428 KB |
Output is correct |
15 |
Correct |
235 ms |
517388 KB |
Output is correct |
16 |
Correct |
227 ms |
517380 KB |
Output is correct |
17 |
Correct |
216 ms |
517404 KB |
Output is correct |
18 |
Correct |
217 ms |
517332 KB |
Output is correct |
19 |
Correct |
214 ms |
517316 KB |
Output is correct |
20 |
Correct |
216 ms |
517296 KB |
Output is correct |
21 |
Correct |
232 ms |
517320 KB |
Output is correct |
22 |
Correct |
214 ms |
516920 KB |
Output is correct |
23 |
Correct |
230 ms |
517432 KB |
Output is correct |
24 |
Correct |
221 ms |
517320 KB |
Output is correct |
25 |
Correct |
210 ms |
517556 KB |
Output is correct |
26 |
Correct |
224 ms |
517636 KB |
Output is correct |
27 |
Correct |
226 ms |
517408 KB |
Output is correct |
28 |
Correct |
214 ms |
517312 KB |
Output is correct |
29 |
Correct |
209 ms |
517324 KB |
Output is correct |
30 |
Correct |
235 ms |
517412 KB |
Output is correct |
31 |
Correct |
260 ms |
517312 KB |
Output is correct |
32 |
Correct |
232 ms |
517456 KB |
Output is correct |
33 |
Correct |
211 ms |
517280 KB |
Output is correct |
34 |
Correct |
229 ms |
517364 KB |
Output is correct |
35 |
Correct |
212 ms |
517084 KB |
Output is correct |
36 |
Correct |
218 ms |
517300 KB |
Output is correct |
37 |
Correct |
231 ms |
517424 KB |
Output is correct |
38 |
Correct |
216 ms |
517444 KB |
Output is correct |
39 |
Correct |
249 ms |
517396 KB |
Output is correct |
40 |
Correct |
213 ms |
517320 KB |
Output is correct |
41 |
Correct |
219 ms |
517356 KB |
Output is correct |
42 |
Correct |
235 ms |
517392 KB |
Output is correct |
43 |
Correct |
211 ms |
517276 KB |
Output is correct |
44 |
Correct |
231 ms |
517284 KB |
Output is correct |
45 |
Correct |
214 ms |
517360 KB |
Output is correct |
46 |
Correct |
654 ms |
529400 KB |
Output is correct |
47 |
Correct |
810 ms |
537256 KB |
Output is correct |
48 |
Correct |
815 ms |
537268 KB |
Output is correct |
49 |
Correct |
796 ms |
535500 KB |
Output is correct |
50 |
Correct |
853 ms |
535600 KB |
Output is correct |
51 |
Correct |
787 ms |
535492 KB |
Output is correct |
52 |
Correct |
835 ms |
535512 KB |
Output is correct |
53 |
Correct |
466 ms |
534700 KB |
Output is correct |
54 |
Correct |
756 ms |
535628 KB |
Output is correct |
55 |
Correct |
471 ms |
535508 KB |
Output is correct |
56 |
Correct |
753 ms |
535556 KB |
Output is correct |
57 |
Correct |
827 ms |
537224 KB |
Output is correct |
58 |
Correct |
835 ms |
535448 KB |
Output is correct |
59 |
Correct |
800 ms |
535588 KB |
Output is correct |
60 |
Correct |
729 ms |
535656 KB |
Output is correct |
61 |
Correct |
470 ms |
534856 KB |
Output is correct |
62 |
Correct |
844 ms |
537264 KB |
Output is correct |
63 |
Correct |
888 ms |
535476 KB |
Output is correct |
64 |
Correct |
930 ms |
535484 KB |
Output is correct |
65 |
Correct |
794 ms |
535592 KB |
Output is correct |
66 |
Correct |
469 ms |
535460 KB |
Output is correct |
67 |
Correct |
792 ms |
536996 KB |
Output is correct |
68 |
Correct |
834 ms |
537296 KB |
Output is correct |
69 |
Correct |
834 ms |
537264 KB |
Output is correct |
70 |
Correct |
971 ms |
535452 KB |
Output is correct |
71 |
Correct |
807 ms |
535476 KB |
Output is correct |
72 |
Correct |
790 ms |
535516 KB |
Output is correct |
73 |
Correct |
888 ms |
535416 KB |
Output is correct |
74 |
Correct |
459 ms |
534788 KB |
Output is correct |
75 |
Correct |
732 ms |
535656 KB |
Output is correct |
76 |
Correct |
457 ms |
534688 KB |
Output is correct |
77 |
Correct |
700 ms |
535848 KB |
Output is correct |
78 |
Correct |
1972 ms |
537128 KB |
Output is correct |
79 |
Correct |
2333 ms |
537296 KB |
Output is correct |
80 |
Correct |
2192 ms |
537244 KB |
Output is correct |
81 |
Correct |
2254 ms |
535428 KB |
Output is correct |
82 |
Correct |
2289 ms |
535472 KB |
Output is correct |
83 |
Correct |
2298 ms |
535604 KB |
Output is correct |
84 |
Correct |
2522 ms |
535448 KB |
Output is correct |
85 |
Correct |
1951 ms |
534764 KB |
Output is correct |
86 |
Correct |
1899 ms |
535736 KB |
Output is correct |
87 |
Correct |
1928 ms |
534688 KB |
Output is correct |
88 |
Correct |
1988 ms |
535652 KB |
Output is correct |
89 |
Correct |
1824 ms |
534856 KB |
Output is correct |
90 |
Correct |
2003 ms |
535660 KB |
Output is correct |
91 |
Correct |
210 ms |
516980 KB |
Output is correct |
92 |
Correct |
216 ms |
517320 KB |
Output is correct |
93 |
Correct |
212 ms |
517348 KB |
Output is correct |
94 |
Correct |
798 ms |
537244 KB |
Output is correct |
95 |
Correct |
815 ms |
535540 KB |
Output is correct |
96 |
Correct |
838 ms |
535576 KB |
Output is correct |
97 |
Correct |
749 ms |
535592 KB |
Output is correct |
98 |
Correct |
459 ms |
534856 KB |
Output is correct |
99 |
Correct |
815 ms |
537288 KB |
Output is correct |
100 |
Correct |
820 ms |
535460 KB |
Output is correct |
101 |
Correct |
782 ms |
535636 KB |
Output is correct |
102 |
Correct |
717 ms |
535840 KB |
Output is correct |
103 |
Correct |
450 ms |
535452 KB |
Output is correct |
104 |
Correct |
212 ms |
517424 KB |
Output is correct |
105 |
Correct |
213 ms |
517356 KB |
Output is correct |
106 |
Correct |
219 ms |
517420 KB |
Output is correct |
107 |
Correct |
229 ms |
517304 KB |
Output is correct |
108 |
Correct |
220 ms |
517300 KB |
Output is correct |
109 |
Correct |
213 ms |
517320 KB |
Output is correct |
110 |
Correct |
212 ms |
517376 KB |
Output is correct |
111 |
Correct |
207 ms |
517340 KB |
Output is correct |
112 |
Correct |
211 ms |
517284 KB |
Output is correct |
113 |
Correct |
212 ms |
517364 KB |
Output is correct |
114 |
Correct |
729 ms |
521880 KB |
Output is correct |
115 |
Correct |
2052 ms |
537424 KB |
Output is correct |
116 |
Correct |
2084 ms |
537336 KB |
Output is correct |
117 |
Correct |
2057 ms |
535616 KB |
Output is correct |
118 |
Correct |
1963 ms |
535496 KB |
Output is correct |
119 |
Correct |
2128 ms |
535476 KB |
Output is correct |
120 |
Correct |
2540 ms |
535652 KB |
Output is correct |
121 |
Correct |
1414 ms |
534692 KB |
Output is correct |
122 |
Correct |
1645 ms |
535812 KB |
Output is correct |
123 |
Correct |
1453 ms |
534864 KB |
Output is correct |
124 |
Correct |
1767 ms |
535748 KB |
Output is correct |
125 |
Correct |
789 ms |
537312 KB |
Output is correct |
126 |
Correct |
808 ms |
535752 KB |
Output is correct |
127 |
Correct |
813 ms |
535712 KB |
Output is correct |
128 |
Correct |
719 ms |
535604 KB |
Output is correct |
129 |
Correct |
436 ms |
535456 KB |
Output is correct |
130 |
Correct |
763 ms |
536944 KB |
Output is correct |
131 |
Correct |
792 ms |
537168 KB |
Output is correct |
132 |
Correct |
765 ms |
537320 KB |
Output is correct |
133 |
Correct |
787 ms |
535476 KB |
Output is correct |
134 |
Correct |
791 ms |
535652 KB |
Output is correct |
135 |
Correct |
806 ms |
535588 KB |
Output is correct |
136 |
Correct |
816 ms |
535588 KB |
Output is correct |
137 |
Correct |
441 ms |
534800 KB |
Output is correct |
138 |
Correct |
737 ms |
535596 KB |
Output is correct |
139 |
Correct |
444 ms |
534740 KB |
Output is correct |
140 |
Correct |
763 ms |
535760 KB |
Output is correct |
141 |
Correct |
233 ms |
517520 KB |
Output is correct |
142 |
Correct |
214 ms |
517356 KB |
Output is correct |
143 |
Correct |
213 ms |
517432 KB |
Output is correct |
144 |
Correct |
211 ms |
517388 KB |
Output is correct |
145 |
Correct |
216 ms |
517336 KB |
Output is correct |
146 |
Correct |
213 ms |
517152 KB |
Output is correct |
147 |
Correct |
218 ms |
517428 KB |
Output is correct |
148 |
Correct |
226 ms |
517428 KB |
Output is correct |
149 |
Correct |
246 ms |
517432 KB |
Output is correct |
150 |
Correct |
223 ms |
517424 KB |
Output is correct |
151 |
Correct |
230 ms |
517344 KB |
Output is correct |
152 |
Correct |
230 ms |
517316 KB |
Output is correct |
153 |
Correct |
231 ms |
517368 KB |
Output is correct |
154 |
Correct |
225 ms |
517392 KB |
Output is correct |
155 |
Correct |
217 ms |
517320 KB |
Output is correct |
156 |
Correct |
222 ms |
517416 KB |
Output is correct |
157 |
Correct |
2055 ms |
535912 KB |
Output is correct |
158 |
Correct |
2271 ms |
537380 KB |
Output is correct |
159 |
Correct |
2319 ms |
537256 KB |
Output is correct |
160 |
Correct |
2317 ms |
535464 KB |
Output is correct |
161 |
Correct |
2405 ms |
535672 KB |
Output is correct |
162 |
Correct |
2682 ms |
535712 KB |
Output is correct |
163 |
Correct |
2313 ms |
535672 KB |
Output is correct |
164 |
Correct |
1795 ms |
534696 KB |
Output is correct |
165 |
Correct |
1993 ms |
535668 KB |
Output is correct |
166 |
Correct |
1751 ms |
535488 KB |
Output is correct |
167 |
Correct |
2017 ms |
535712 KB |
Output is correct |
168 |
Correct |
205 ms |
516856 KB |
Output is correct |
169 |
Correct |
1605 ms |
523524 KB |
Output is correct |
170 |
Correct |
2719 ms |
537292 KB |
Output is correct |
171 |
Correct |
2679 ms |
537384 KB |
Output is correct |
172 |
Correct |
2624 ms |
535492 KB |
Output is correct |
173 |
Correct |
2660 ms |
535624 KB |
Output is correct |
174 |
Correct |
2611 ms |
535564 KB |
Output is correct |
175 |
Correct |
2737 ms |
535596 KB |
Output is correct |
176 |
Correct |
1730 ms |
534724 KB |
Output is correct |
177 |
Correct |
1945 ms |
535668 KB |
Output is correct |
178 |
Correct |
1935 ms |
534808 KB |
Output is correct |
179 |
Correct |
2016 ms |
535684 KB |
Output is correct |