#include "towers.h"
#include <vector>
#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using ld = long double;
#define int ll
#define sz(x) ((int)(x).size())
using pii = pair<int,int>;
using tii = tuple<int,int,int>;
const int nmax = 2e5 + 5;
int v[nmax];
namespace DSU {
int dsu[nmax], nxt[nmax];
int mxR[nmax];
void init(int l, int r) {
for(int i = l; i <= r; i++) dsu[i] = i, nxt[i] = i + 1;
return;
}
int f(int x) { return x == dsu[x]? x : dsu[x] = f(dsu[x]); }
void unite(int x, int y) {
x = f(x);
y = f(y);
if(x == y) return;
if(x > y) swap(x, y);
dsu[y] = x;
mxR[x] = max(mxR[x], mxR[y]);
nxt[x] = nxt[y];
return;
}
int coef(int i, const vector<int>& p) {
i = f(i);
return mxR[i] - max(v[p[i]], v[p[nxt[i]]]);
}
}
int timeout[nmax];
int dir[nmax];
void initglobals(signed L, signed R) {
++L;
++R;
vector<int> p;
for(int i = L; i <= R; i++) {
if((i == L || v[i] < v[i - 1]) && (i == R || v[i] < v[i + 1])) p.emplace_back(i), timeout[i] = 1e9 + 5;
else timeout[i] = 0;
}
DSU::init(0, sz(p));
set<pii> heap;
set<int> indemnizatii;
for(int i = 0; i < sz(p) - 1; i++) {
indemnizatii.emplace(i);
indemnizatii.emplace(i + 1);
int mx = v[p[i] + 1];
for(int j = p[i] + 2; j < p[i + 1]; j++)
mx = max(mx, v[j]);
DSU::mxR[i] = mx;
heap.emplace(mx - max(v[p[i]], v[p[i + 1]]), i);
}
auto get = [&](int p_) { return pii{DSU::coef(p_, p), p_}; };
while(!heap.empty()) {
auto [C, i] = *heap.begin();
heap.erase(heap.begin());
i = DSU::f(i);
int urm = DSU::nxt[i];
if(i != *indemnizatii.begin()) {
int ant = DSU::f(i - 1);
heap.erase(heap.find(get(ant)));
}
if(urm != *indemnizatii.rbegin())
heap.erase(heap.find(get(urm)));
if(v[p[i]] < v[p[urm]]) {
timeout[p[urm]] = C;
dir[p[urm]] = p[i];
DSU::unite(i, urm);
indemnizatii.erase(urm);
if(i != *indemnizatii.begin()) {
int ant = DSU::f(i - 1);
heap.insert(get(ant));
}
if(i != *indemnizatii.rbegin())
heap.insert(get(i));
}
else {
timeout[p[i]] = C;
dir[p[i]] = p[urm];
if(i != *indemnizatii.begin()) {
int ant = DSU::f(i - 1);
DSU::unite(ant, i);
heap.insert(get(ant));
}
if(urm != *indemnizatii.rbegin())
heap.insert(get(urm));
indemnizatii.erase(i);
}
}
}
template<typename T>
struct AINT {
struct Node {
Node *l, *r;
T inner;
};
Node mem[nmax * 36];
int cnt = 0;
using ns = Node*;
int n;
ns root, nil;
int filled = 0;
void init(int n_) {
n = n_;
nil = newnode(0, 0, T());
nil -> l = nil;
nil -> r = nil;
root = nil;
root = walk([&](T& inner, int cl, int cr) {
if(cl != cr) return 1;
inner = T();
return 0;
});
}
ns newnode(ns L, ns R, T val) {
mem[cnt++] = (Node{L, R, val});
return mem + cnt - 1;
}
ns newnode() {
return newnode(nil, nil, T());
}
template<class CB> ns walk(CB&& cb) { filled ++; return root = walk(cb, 1, n); }
template<class CB> ns walk(CB&& cb, int l, int r) { return root = walk(cb, l, r, root, 1, n); }
template<class CB> ns walk(CB&& cb, int l, int r, ns node, int cl, int cr) {
if(r < cl || cr < l) return node;
auto a = node -> inner;
if(l <= cl && cr <= r && !cb(node -> inner, cl, cr)) { auto rv = newnode(node -> l, node -> r, node -> inner); node -> inner = a; return rv; }
int mid = (cl + cr) >> 1;
auto herenow = newnode();
herenow -> l = walk(cb, l, r, node -> l, cl, mid);
herenow -> r = walk(cb, l, r, node -> r, mid + 1, cr);
//cerr << cl << ' ' << cr << "\t" << herenow -> inner.val << '\t' << herenow -> l -> inner.val << '\t' << herenow -> r -> inner.val << '\n';
herenow -> inner.pull(herenow -> l -> inner, herenow -> r -> inner);
return herenow;
}
template<class CB> void const_walk(CB&& cb, ns start) const { return const_walk(cb, start, 1, n); }
template<class CB> void const_walk(CB&& cb, ns start, int l, int r) const { return const_walk(cb, l, r, start, 1, n); }
template<class CB> void const_walk(CB&& cb, int l, int r, ns node, int cl, int cr) const {
if(r < cl || cr < l) return;
if(l <= cl && cr <= r && !cb(node -> inner, cl, cr)) return;
int mid = (cl + cr) >> 1;
const_walk(cb, l, r, node -> l, cl, mid);
const_walk(cb, l, r, node -> r, mid + 1, cr);
return;
}
};
struct Sum {
int val;
Sum(int a = 0): val(a) {;}
void pull(const Sum& L, const Sum& R) { val = L.val + R.val; }
};
struct mnidx {
int val;
mnidx(int a = 0): val(a) {;}
void pull(const mnidx& L, const mnidx& R) { val = v[L.val] < v[R.val]? L.val : R.val; }
};
struct mxval {
int val;
mxval(int a = 0): val(a) {;}
void pull(const mxval& L, const mxval& R) { val = max(L.val, R.val); }
};
map<int, AINT<Sum>::ns> sumroot;
map<int, AINT<mnidx>::ns> raiseroot, fallroot;
AINT<Sum> sum_aint;
AINT<mnidx> dir_aint;
AINT<mxval> max_aint;
void init(signed N, std::vector<signed> H) {
//cerr << N << ' ' << sz(H) << '\n';
v[0] = 1e9 + 2;
for(int i = 0; i < N; i++) v[i + 1] = H[i];
initglobals(0, N - 1);
max_aint.init(N);
max_aint.walk([&](auto &a, int cl, int cr) { if(cl != cr) return 1; a.val = v[cl]; return 0; });
vector<int> idx(N); iota(all(idx), 1);
sum_aint.init(N);
sort(all(idx), [&](int a, int b) { return timeout[a] > timeout[b]; });
for(auto x : idx)
sumroot[timeout[x]] = sum_aint.walk([&](auto& a, int cl, int cr) { a.val = 1; return 0;}, x, x);
//cerr << timeout[x] << '\t' << sum_aint.root -> inner.val << '\n';
dir_aint.init(N);
sort(all(idx), [&](int a, int b) { return dir[a] < dir[b]; });
raiseroot[0] = dir_aint.root;
for(auto x : idx)
raiseroot[dir[x]] = dir_aint.walk([&](auto& a, int cl, int cr) { a.val = cl * (timeout[cl] != 0); return 0; }, x, x);
for(int i = 1; i <= N; i++) if(raiseroot.count(i) == 0) raiseroot[i] = raiseroot[i - 1];
dir_aint.init(N);
sort(all(idx), [&](int a, int b) { return dir[a] > dir[b]; });
fallroot[N + 1] = dir_aint.root;
for(auto x : idx)
fallroot[dir[x]] = dir_aint.walk([&](auto& a, int cl, int cr) { a.val = cl * (timeout[cl] != 0); return 0; }, x, x);
for(int i = N; i > 0; i--) if(fallroot.count(i) == 0) fallroot[i] = fallroot[i + 1];
return;
}
int query_max(int l, int r) {
//cerr << l << ' ' << r << '\n';
int mx = 0;
max_aint.const_walk([&](auto& a, int cl, int cr) { mx = max(mx, a.val); return 0;}, max_aint.root, l, r);
return mx;
}
int pula_pizda(signed L, signed R, signed D) {
++L, ++R;
if([&]() {
for(int i = L; i <= R; i++)
if(timeout[i] != 0) return 0;
return 1;
}()) {
int mx = 0;
for(int i = L; i <= R; i++) mx = max(mx, v[i]);
return mx - max(v[L], v[R]) >= D? 2 : 1;
}
int l = L, r = R;
while (l <= r && timeout[l] < D) l++;
if(l > r) return 1;
cerr << L << ' ' << l << '\t';
int rez = 0;
if(L < l) {
int mn = L;
for(int i = L + 1; i < l; i++) if(dir[i] < L && timeout[i] != 0 && v[mn] > v[i]) mn = i;
cerr << mn << '\n';
int mx = 0;
for(int i = mn + 1; i < l; i++) mx = max(v[i], mx);
if(mx - max(v[l], v[mn]) >= D) rez++;
}
cerr << '\n';
while(timeout[r] < D) r--;
cerr <<r << ' ' << R << '\n';
if(r < R) {
int mn = R;
for(int i = r + 1; i < R; i++) if(dir[i] > R && timeout[i] != 0 && v[mn] > v[i]) mn = i;
cerr << mn << '\n';
int mx = 0;
for(int i = r + 1; i < mn; i++) mx = max(v[i], mx);
if(mx - max(v[r], v[mn]) >= D) rez++;
}
for(int i = l; i <= r; i++)
if(timeout[i] >= D) rez++;
return rez;
}
signed max_towers(signed L, signed R, signed D) {
//pula_pizda(L, R, D);
//cerr << "vreodata\n";
++L, ++R;
if(sumroot.lower_bound(D) == sumroot.end()) return 1;
auto forsum = sumroot.lower_bound(D) -> second;
int alltogether = 0;
sum_aint.const_walk([&](auto a, int cl, int cr) { alltogether += a.val; return 0; }, forsum, L, R);
//cerr << alltogether << '\n';
if(alltogether == 0) {
int mx = query_max(L, R);
return mx - max(v[L], v[R]) >= D? 2 : 1;
}
int l = L, r = L;
sum_aint.const_walk([&](auto &a, int cl, int cr) {
if(l < cl) return 0;
if(a.val == 0) { l = cr + 1; return 0; }
if(cl == cr) { l = cl; return 0; }
return 1; }, forsum, L, R);
int rez = alltogether;
//cerr << L << ' ' << l << '\t';
if(L < l) {
int mn = L;
dir_aint.const_walk([&](mnidx& a, int cl, int cr) { if(v[mn] > v[a.val]) mn = a.val; return 0;}, raiseroot[L - 1], L + 1, l - 1);
//cerr << mn;
for(int i = L + 1; i < l; i++) if(dir[i] < L && timeout[i] != 0 && v[mn] > v[i]) mn = i;
int mx = query_max(mn + 1, l);
if(mx - max(v[l], v[mn]) >= D) rez++;
}
//cerr << '\n';
int limit = alltogether - 1;
sum_aint.const_walk([&](auto &a, int cl, int cr) {
if(r < cl) return 0;
if(a.val <= limit) { limit -= a.val; r = cr + 1; return 0; }
if(cl == cr) { r = cl; return 0; }
return 1; }, forsum, L, R);
//cerr << r << ' ' << R << '\n';
if(r < R) {
int mn = R;
dir_aint.const_walk([&](mnidx& a, int cl, int cr) { if(v[mn] > v[a.val]) mn = a.val; return 0;}, fallroot[R + 1], r + 1, R - 1);
int mx = query_max(r + 1, mn - 1);
if(mx - max(v[r], v[mn]) >= D) rez++;
}
return rez;
}
#undef int
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
525 ms |
518476 KB |
Output is correct |
2 |
Correct |
952 ms |
524880 KB |
Output is correct |
3 |
Correct |
957 ms |
524920 KB |
Output is correct |
4 |
Correct |
990 ms |
524740 KB |
Output is correct |
5 |
Correct |
988 ms |
524688 KB |
Output is correct |
6 |
Correct |
981 ms |
524880 KB |
Output is correct |
7 |
Correct |
970 ms |
524880 KB |
Output is correct |
8 |
Correct |
142 ms |
509264 KB |
Output is correct |
9 |
Correct |
142 ms |
509604 KB |
Output is correct |
10 |
Correct |
143 ms |
509876 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
135 ms |
509524 KB |
Output is correct |
2 |
Correct |
146 ms |
509776 KB |
Output is correct |
3 |
Correct |
145 ms |
509776 KB |
Output is correct |
4 |
Correct |
145 ms |
509648 KB |
Output is correct |
5 |
Correct |
151 ms |
509656 KB |
Output is correct |
6 |
Correct |
149 ms |
509664 KB |
Output is correct |
7 |
Correct |
161 ms |
509776 KB |
Output is correct |
8 |
Correct |
137 ms |
509544 KB |
Output is correct |
9 |
Correct |
143 ms |
509516 KB |
Output is correct |
10 |
Correct |
148 ms |
509520 KB |
Output is correct |
11 |
Correct |
151 ms |
509756 KB |
Output is correct |
12 |
Correct |
144 ms |
509264 KB |
Output is correct |
13 |
Correct |
138 ms |
509520 KB |
Output is correct |
14 |
Correct |
139 ms |
509520 KB |
Output is correct |
15 |
Correct |
147 ms |
509716 KB |
Output is correct |
16 |
Correct |
145 ms |
509708 KB |
Output is correct |
17 |
Correct |
144 ms |
509788 KB |
Output is correct |
18 |
Correct |
141 ms |
509592 KB |
Output is correct |
19 |
Correct |
138 ms |
509524 KB |
Output is correct |
20 |
Correct |
152 ms |
509776 KB |
Output is correct |
21 |
Correct |
142 ms |
509796 KB |
Output is correct |
22 |
Correct |
137 ms |
509776 KB |
Output is correct |
23 |
Correct |
137 ms |
509520 KB |
Output is correct |
24 |
Correct |
136 ms |
509548 KB |
Output is correct |
25 |
Correct |
143 ms |
509784 KB |
Output is correct |
26 |
Correct |
136 ms |
509776 KB |
Output is correct |
27 |
Correct |
136 ms |
509796 KB |
Output is correct |
28 |
Correct |
138 ms |
509776 KB |
Output is correct |
29 |
Correct |
138 ms |
509776 KB |
Output is correct |
30 |
Correct |
141 ms |
509776 KB |
Output is correct |
31 |
Correct |
138 ms |
509652 KB |
Output is correct |
32 |
Correct |
138 ms |
509620 KB |
Output is correct |
33 |
Correct |
138 ms |
509528 KB |
Output is correct |
34 |
Correct |
140 ms |
509612 KB |
Output is correct |
35 |
Correct |
138 ms |
509520 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
135 ms |
509524 KB |
Output is correct |
2 |
Correct |
146 ms |
509776 KB |
Output is correct |
3 |
Correct |
145 ms |
509776 KB |
Output is correct |
4 |
Correct |
145 ms |
509648 KB |
Output is correct |
5 |
Correct |
151 ms |
509656 KB |
Output is correct |
6 |
Correct |
149 ms |
509664 KB |
Output is correct |
7 |
Correct |
161 ms |
509776 KB |
Output is correct |
8 |
Correct |
137 ms |
509544 KB |
Output is correct |
9 |
Correct |
143 ms |
509516 KB |
Output is correct |
10 |
Correct |
148 ms |
509520 KB |
Output is correct |
11 |
Correct |
151 ms |
509756 KB |
Output is correct |
12 |
Correct |
144 ms |
509264 KB |
Output is correct |
13 |
Correct |
138 ms |
509520 KB |
Output is correct |
14 |
Correct |
139 ms |
509520 KB |
Output is correct |
15 |
Correct |
147 ms |
509716 KB |
Output is correct |
16 |
Correct |
145 ms |
509708 KB |
Output is correct |
17 |
Correct |
144 ms |
509788 KB |
Output is correct |
18 |
Correct |
141 ms |
509592 KB |
Output is correct |
19 |
Correct |
138 ms |
509524 KB |
Output is correct |
20 |
Correct |
152 ms |
509776 KB |
Output is correct |
21 |
Correct |
142 ms |
509796 KB |
Output is correct |
22 |
Correct |
137 ms |
509776 KB |
Output is correct |
23 |
Correct |
137 ms |
509520 KB |
Output is correct |
24 |
Correct |
136 ms |
509548 KB |
Output is correct |
25 |
Correct |
143 ms |
509784 KB |
Output is correct |
26 |
Correct |
136 ms |
509776 KB |
Output is correct |
27 |
Correct |
136 ms |
509796 KB |
Output is correct |
28 |
Correct |
138 ms |
509776 KB |
Output is correct |
29 |
Correct |
138 ms |
509776 KB |
Output is correct |
30 |
Correct |
141 ms |
509776 KB |
Output is correct |
31 |
Correct |
138 ms |
509652 KB |
Output is correct |
32 |
Correct |
138 ms |
509620 KB |
Output is correct |
33 |
Correct |
138 ms |
509528 KB |
Output is correct |
34 |
Correct |
140 ms |
509612 KB |
Output is correct |
35 |
Correct |
138 ms |
509520 KB |
Output is correct |
36 |
Correct |
255 ms |
521248 KB |
Output is correct |
37 |
Correct |
319 ms |
527784 KB |
Output is correct |
38 |
Correct |
344 ms |
527628 KB |
Output is correct |
39 |
Correct |
365 ms |
529216 KB |
Output is correct |
40 |
Correct |
385 ms |
529048 KB |
Output is correct |
41 |
Correct |
365 ms |
529040 KB |
Output is correct |
42 |
Correct |
367 ms |
529288 KB |
Output is correct |
43 |
Correct |
245 ms |
524884 KB |
Output is correct |
44 |
Correct |
263 ms |
524808 KB |
Output is correct |
45 |
Correct |
264 ms |
524692 KB |
Output is correct |
46 |
Correct |
265 ms |
524880 KB |
Output is correct |
47 |
Correct |
332 ms |
527544 KB |
Output is correct |
48 |
Correct |
355 ms |
529088 KB |
Output is correct |
49 |
Correct |
358 ms |
529216 KB |
Output is correct |
50 |
Correct |
257 ms |
524816 KB |
Output is correct |
51 |
Correct |
255 ms |
524884 KB |
Output is correct |
52 |
Correct |
318 ms |
527548 KB |
Output is correct |
53 |
Correct |
371 ms |
529264 KB |
Output is correct |
54 |
Correct |
349 ms |
529020 KB |
Output is correct |
55 |
Correct |
259 ms |
524880 KB |
Output is correct |
56 |
Correct |
257 ms |
524880 KB |
Output is correct |
57 |
Correct |
305 ms |
527056 KB |
Output is correct |
58 |
Correct |
320 ms |
527912 KB |
Output is correct |
59 |
Correct |
317 ms |
527548 KB |
Output is correct |
60 |
Correct |
358 ms |
529220 KB |
Output is correct |
61 |
Correct |
354 ms |
528996 KB |
Output is correct |
62 |
Correct |
373 ms |
529028 KB |
Output is correct |
63 |
Correct |
343 ms |
529212 KB |
Output is correct |
64 |
Correct |
255 ms |
524732 KB |
Output is correct |
65 |
Correct |
261 ms |
524880 KB |
Output is correct |
66 |
Correct |
255 ms |
524880 KB |
Output is correct |
67 |
Correct |
272 ms |
524812 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1097 ms |
527552 KB |
Output is correct |
2 |
Correct |
1314 ms |
527552 KB |
Output is correct |
3 |
Correct |
1256 ms |
527552 KB |
Output is correct |
4 |
Correct |
1324 ms |
529216 KB |
Output is correct |
5 |
Correct |
1235 ms |
529216 KB |
Output is correct |
6 |
Correct |
1317 ms |
529216 KB |
Output is correct |
7 |
Correct |
1338 ms |
529216 KB |
Output is correct |
8 |
Correct |
1074 ms |
524884 KB |
Output is correct |
9 |
Correct |
974 ms |
524880 KB |
Output is correct |
10 |
Correct |
1775 ms |
524880 KB |
Output is correct |
11 |
Correct |
2069 ms |
524848 KB |
Output is correct |
12 |
Correct |
983 ms |
524880 KB |
Output is correct |
13 |
Correct |
942 ms |
524880 KB |
Output is correct |
14 |
Correct |
138 ms |
509264 KB |
Output is correct |
15 |
Correct |
157 ms |
509528 KB |
Output is correct |
16 |
Correct |
141 ms |
509524 KB |
Output is correct |
17 |
Correct |
312 ms |
527600 KB |
Output is correct |
18 |
Correct |
366 ms |
529100 KB |
Output is correct |
19 |
Correct |
361 ms |
529324 KB |
Output is correct |
20 |
Correct |
256 ms |
524880 KB |
Output is correct |
21 |
Correct |
263 ms |
524788 KB |
Output is correct |
22 |
Correct |
327 ms |
527552 KB |
Output is correct |
23 |
Correct |
408 ms |
529028 KB |
Output is correct |
24 |
Correct |
352 ms |
529196 KB |
Output is correct |
25 |
Correct |
260 ms |
524740 KB |
Output is correct |
26 |
Correct |
255 ms |
524916 KB |
Output is correct |
27 |
Correct |
148 ms |
509776 KB |
Output is correct |
28 |
Correct |
147 ms |
509604 KB |
Output is correct |
29 |
Correct |
142 ms |
509776 KB |
Output is correct |
30 |
Correct |
145 ms |
509636 KB |
Output is correct |
31 |
Correct |
138 ms |
509520 KB |
Output is correct |
32 |
Correct |
143 ms |
509668 KB |
Output is correct |
33 |
Correct |
145 ms |
509776 KB |
Output is correct |
34 |
Correct |
140 ms |
509776 KB |
Output is correct |
35 |
Correct |
146 ms |
509632 KB |
Output is correct |
36 |
Correct |
149 ms |
509520 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
398 ms |
513616 KB |
Output is correct |
2 |
Correct |
1136 ms |
527548 KB |
Output is correct |
3 |
Correct |
1186 ms |
527808 KB |
Output is correct |
4 |
Correct |
1148 ms |
529224 KB |
Output is correct |
5 |
Correct |
1188 ms |
529220 KB |
Output is correct |
6 |
Correct |
1310 ms |
529240 KB |
Output is correct |
7 |
Correct |
1104 ms |
529032 KB |
Output is correct |
8 |
Correct |
921 ms |
524880 KB |
Output is correct |
9 |
Execution timed out |
4088 ms |
524880 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
135 ms |
509524 KB |
Output is correct |
2 |
Correct |
146 ms |
509776 KB |
Output is correct |
3 |
Correct |
145 ms |
509776 KB |
Output is correct |
4 |
Correct |
145 ms |
509648 KB |
Output is correct |
5 |
Correct |
151 ms |
509656 KB |
Output is correct |
6 |
Correct |
149 ms |
509664 KB |
Output is correct |
7 |
Correct |
161 ms |
509776 KB |
Output is correct |
8 |
Correct |
137 ms |
509544 KB |
Output is correct |
9 |
Correct |
143 ms |
509516 KB |
Output is correct |
10 |
Correct |
148 ms |
509520 KB |
Output is correct |
11 |
Correct |
151 ms |
509756 KB |
Output is correct |
12 |
Correct |
144 ms |
509264 KB |
Output is correct |
13 |
Correct |
138 ms |
509520 KB |
Output is correct |
14 |
Correct |
139 ms |
509520 KB |
Output is correct |
15 |
Correct |
147 ms |
509716 KB |
Output is correct |
16 |
Correct |
145 ms |
509708 KB |
Output is correct |
17 |
Correct |
144 ms |
509788 KB |
Output is correct |
18 |
Correct |
141 ms |
509592 KB |
Output is correct |
19 |
Correct |
138 ms |
509524 KB |
Output is correct |
20 |
Correct |
152 ms |
509776 KB |
Output is correct |
21 |
Correct |
142 ms |
509796 KB |
Output is correct |
22 |
Correct |
137 ms |
509776 KB |
Output is correct |
23 |
Correct |
137 ms |
509520 KB |
Output is correct |
24 |
Correct |
136 ms |
509548 KB |
Output is correct |
25 |
Correct |
143 ms |
509784 KB |
Output is correct |
26 |
Correct |
136 ms |
509776 KB |
Output is correct |
27 |
Correct |
136 ms |
509796 KB |
Output is correct |
28 |
Correct |
138 ms |
509776 KB |
Output is correct |
29 |
Correct |
138 ms |
509776 KB |
Output is correct |
30 |
Correct |
141 ms |
509776 KB |
Output is correct |
31 |
Correct |
138 ms |
509652 KB |
Output is correct |
32 |
Correct |
138 ms |
509620 KB |
Output is correct |
33 |
Correct |
138 ms |
509528 KB |
Output is correct |
34 |
Correct |
140 ms |
509612 KB |
Output is correct |
35 |
Correct |
138 ms |
509520 KB |
Output is correct |
36 |
Correct |
255 ms |
521248 KB |
Output is correct |
37 |
Correct |
319 ms |
527784 KB |
Output is correct |
38 |
Correct |
344 ms |
527628 KB |
Output is correct |
39 |
Correct |
365 ms |
529216 KB |
Output is correct |
40 |
Correct |
385 ms |
529048 KB |
Output is correct |
41 |
Correct |
365 ms |
529040 KB |
Output is correct |
42 |
Correct |
367 ms |
529288 KB |
Output is correct |
43 |
Correct |
245 ms |
524884 KB |
Output is correct |
44 |
Correct |
263 ms |
524808 KB |
Output is correct |
45 |
Correct |
264 ms |
524692 KB |
Output is correct |
46 |
Correct |
265 ms |
524880 KB |
Output is correct |
47 |
Correct |
332 ms |
527544 KB |
Output is correct |
48 |
Correct |
355 ms |
529088 KB |
Output is correct |
49 |
Correct |
358 ms |
529216 KB |
Output is correct |
50 |
Correct |
257 ms |
524816 KB |
Output is correct |
51 |
Correct |
255 ms |
524884 KB |
Output is correct |
52 |
Correct |
318 ms |
527548 KB |
Output is correct |
53 |
Correct |
371 ms |
529264 KB |
Output is correct |
54 |
Correct |
349 ms |
529020 KB |
Output is correct |
55 |
Correct |
259 ms |
524880 KB |
Output is correct |
56 |
Correct |
257 ms |
524880 KB |
Output is correct |
57 |
Correct |
305 ms |
527056 KB |
Output is correct |
58 |
Correct |
320 ms |
527912 KB |
Output is correct |
59 |
Correct |
317 ms |
527548 KB |
Output is correct |
60 |
Correct |
358 ms |
529220 KB |
Output is correct |
61 |
Correct |
354 ms |
528996 KB |
Output is correct |
62 |
Correct |
373 ms |
529028 KB |
Output is correct |
63 |
Correct |
343 ms |
529212 KB |
Output is correct |
64 |
Correct |
255 ms |
524732 KB |
Output is correct |
65 |
Correct |
261 ms |
524880 KB |
Output is correct |
66 |
Correct |
255 ms |
524880 KB |
Output is correct |
67 |
Correct |
272 ms |
524812 KB |
Output is correct |
68 |
Correct |
1097 ms |
527552 KB |
Output is correct |
69 |
Correct |
1314 ms |
527552 KB |
Output is correct |
70 |
Correct |
1256 ms |
527552 KB |
Output is correct |
71 |
Correct |
1324 ms |
529216 KB |
Output is correct |
72 |
Correct |
1235 ms |
529216 KB |
Output is correct |
73 |
Correct |
1317 ms |
529216 KB |
Output is correct |
74 |
Correct |
1338 ms |
529216 KB |
Output is correct |
75 |
Correct |
1074 ms |
524884 KB |
Output is correct |
76 |
Correct |
974 ms |
524880 KB |
Output is correct |
77 |
Correct |
1775 ms |
524880 KB |
Output is correct |
78 |
Correct |
2069 ms |
524848 KB |
Output is correct |
79 |
Correct |
983 ms |
524880 KB |
Output is correct |
80 |
Correct |
942 ms |
524880 KB |
Output is correct |
81 |
Correct |
138 ms |
509264 KB |
Output is correct |
82 |
Correct |
157 ms |
509528 KB |
Output is correct |
83 |
Correct |
141 ms |
509524 KB |
Output is correct |
84 |
Correct |
312 ms |
527600 KB |
Output is correct |
85 |
Correct |
366 ms |
529100 KB |
Output is correct |
86 |
Correct |
361 ms |
529324 KB |
Output is correct |
87 |
Correct |
256 ms |
524880 KB |
Output is correct |
88 |
Correct |
263 ms |
524788 KB |
Output is correct |
89 |
Correct |
327 ms |
527552 KB |
Output is correct |
90 |
Correct |
408 ms |
529028 KB |
Output is correct |
91 |
Correct |
352 ms |
529196 KB |
Output is correct |
92 |
Correct |
260 ms |
524740 KB |
Output is correct |
93 |
Correct |
255 ms |
524916 KB |
Output is correct |
94 |
Correct |
148 ms |
509776 KB |
Output is correct |
95 |
Correct |
147 ms |
509604 KB |
Output is correct |
96 |
Correct |
142 ms |
509776 KB |
Output is correct |
97 |
Correct |
145 ms |
509636 KB |
Output is correct |
98 |
Correct |
138 ms |
509520 KB |
Output is correct |
99 |
Correct |
143 ms |
509668 KB |
Output is correct |
100 |
Correct |
145 ms |
509776 KB |
Output is correct |
101 |
Correct |
140 ms |
509776 KB |
Output is correct |
102 |
Correct |
146 ms |
509632 KB |
Output is correct |
103 |
Correct |
149 ms |
509520 KB |
Output is correct |
104 |
Correct |
1157 ms |
525796 KB |
Output is correct |
105 |
Correct |
1346 ms |
527716 KB |
Output is correct |
106 |
Correct |
1413 ms |
527732 KB |
Output is correct |
107 |
Correct |
1351 ms |
529120 KB |
Output is correct |
108 |
Incorrect |
1452 ms |
529124 KB |
19976th lines differ - on the 1st token, expected: '2', found: '1' |
109 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
525 ms |
518476 KB |
Output is correct |
2 |
Correct |
952 ms |
524880 KB |
Output is correct |
3 |
Correct |
957 ms |
524920 KB |
Output is correct |
4 |
Correct |
990 ms |
524740 KB |
Output is correct |
5 |
Correct |
988 ms |
524688 KB |
Output is correct |
6 |
Correct |
981 ms |
524880 KB |
Output is correct |
7 |
Correct |
970 ms |
524880 KB |
Output is correct |
8 |
Correct |
142 ms |
509264 KB |
Output is correct |
9 |
Correct |
142 ms |
509604 KB |
Output is correct |
10 |
Correct |
143 ms |
509876 KB |
Output is correct |
11 |
Correct |
135 ms |
509524 KB |
Output is correct |
12 |
Correct |
146 ms |
509776 KB |
Output is correct |
13 |
Correct |
145 ms |
509776 KB |
Output is correct |
14 |
Correct |
145 ms |
509648 KB |
Output is correct |
15 |
Correct |
151 ms |
509656 KB |
Output is correct |
16 |
Correct |
149 ms |
509664 KB |
Output is correct |
17 |
Correct |
161 ms |
509776 KB |
Output is correct |
18 |
Correct |
137 ms |
509544 KB |
Output is correct |
19 |
Correct |
143 ms |
509516 KB |
Output is correct |
20 |
Correct |
148 ms |
509520 KB |
Output is correct |
21 |
Correct |
151 ms |
509756 KB |
Output is correct |
22 |
Correct |
144 ms |
509264 KB |
Output is correct |
23 |
Correct |
138 ms |
509520 KB |
Output is correct |
24 |
Correct |
139 ms |
509520 KB |
Output is correct |
25 |
Correct |
147 ms |
509716 KB |
Output is correct |
26 |
Correct |
145 ms |
509708 KB |
Output is correct |
27 |
Correct |
144 ms |
509788 KB |
Output is correct |
28 |
Correct |
141 ms |
509592 KB |
Output is correct |
29 |
Correct |
138 ms |
509524 KB |
Output is correct |
30 |
Correct |
152 ms |
509776 KB |
Output is correct |
31 |
Correct |
142 ms |
509796 KB |
Output is correct |
32 |
Correct |
137 ms |
509776 KB |
Output is correct |
33 |
Correct |
137 ms |
509520 KB |
Output is correct |
34 |
Correct |
136 ms |
509548 KB |
Output is correct |
35 |
Correct |
143 ms |
509784 KB |
Output is correct |
36 |
Correct |
136 ms |
509776 KB |
Output is correct |
37 |
Correct |
136 ms |
509796 KB |
Output is correct |
38 |
Correct |
138 ms |
509776 KB |
Output is correct |
39 |
Correct |
138 ms |
509776 KB |
Output is correct |
40 |
Correct |
141 ms |
509776 KB |
Output is correct |
41 |
Correct |
138 ms |
509652 KB |
Output is correct |
42 |
Correct |
138 ms |
509620 KB |
Output is correct |
43 |
Correct |
138 ms |
509528 KB |
Output is correct |
44 |
Correct |
140 ms |
509612 KB |
Output is correct |
45 |
Correct |
138 ms |
509520 KB |
Output is correct |
46 |
Correct |
255 ms |
521248 KB |
Output is correct |
47 |
Correct |
319 ms |
527784 KB |
Output is correct |
48 |
Correct |
344 ms |
527628 KB |
Output is correct |
49 |
Correct |
365 ms |
529216 KB |
Output is correct |
50 |
Correct |
385 ms |
529048 KB |
Output is correct |
51 |
Correct |
365 ms |
529040 KB |
Output is correct |
52 |
Correct |
367 ms |
529288 KB |
Output is correct |
53 |
Correct |
245 ms |
524884 KB |
Output is correct |
54 |
Correct |
263 ms |
524808 KB |
Output is correct |
55 |
Correct |
264 ms |
524692 KB |
Output is correct |
56 |
Correct |
265 ms |
524880 KB |
Output is correct |
57 |
Correct |
332 ms |
527544 KB |
Output is correct |
58 |
Correct |
355 ms |
529088 KB |
Output is correct |
59 |
Correct |
358 ms |
529216 KB |
Output is correct |
60 |
Correct |
257 ms |
524816 KB |
Output is correct |
61 |
Correct |
255 ms |
524884 KB |
Output is correct |
62 |
Correct |
318 ms |
527548 KB |
Output is correct |
63 |
Correct |
371 ms |
529264 KB |
Output is correct |
64 |
Correct |
349 ms |
529020 KB |
Output is correct |
65 |
Correct |
259 ms |
524880 KB |
Output is correct |
66 |
Correct |
257 ms |
524880 KB |
Output is correct |
67 |
Correct |
305 ms |
527056 KB |
Output is correct |
68 |
Correct |
320 ms |
527912 KB |
Output is correct |
69 |
Correct |
317 ms |
527548 KB |
Output is correct |
70 |
Correct |
358 ms |
529220 KB |
Output is correct |
71 |
Correct |
354 ms |
528996 KB |
Output is correct |
72 |
Correct |
373 ms |
529028 KB |
Output is correct |
73 |
Correct |
343 ms |
529212 KB |
Output is correct |
74 |
Correct |
255 ms |
524732 KB |
Output is correct |
75 |
Correct |
261 ms |
524880 KB |
Output is correct |
76 |
Correct |
255 ms |
524880 KB |
Output is correct |
77 |
Correct |
272 ms |
524812 KB |
Output is correct |
78 |
Correct |
1097 ms |
527552 KB |
Output is correct |
79 |
Correct |
1314 ms |
527552 KB |
Output is correct |
80 |
Correct |
1256 ms |
527552 KB |
Output is correct |
81 |
Correct |
1324 ms |
529216 KB |
Output is correct |
82 |
Correct |
1235 ms |
529216 KB |
Output is correct |
83 |
Correct |
1317 ms |
529216 KB |
Output is correct |
84 |
Correct |
1338 ms |
529216 KB |
Output is correct |
85 |
Correct |
1074 ms |
524884 KB |
Output is correct |
86 |
Correct |
974 ms |
524880 KB |
Output is correct |
87 |
Correct |
1775 ms |
524880 KB |
Output is correct |
88 |
Correct |
2069 ms |
524848 KB |
Output is correct |
89 |
Correct |
983 ms |
524880 KB |
Output is correct |
90 |
Correct |
942 ms |
524880 KB |
Output is correct |
91 |
Correct |
138 ms |
509264 KB |
Output is correct |
92 |
Correct |
157 ms |
509528 KB |
Output is correct |
93 |
Correct |
141 ms |
509524 KB |
Output is correct |
94 |
Correct |
312 ms |
527600 KB |
Output is correct |
95 |
Correct |
366 ms |
529100 KB |
Output is correct |
96 |
Correct |
361 ms |
529324 KB |
Output is correct |
97 |
Correct |
256 ms |
524880 KB |
Output is correct |
98 |
Correct |
263 ms |
524788 KB |
Output is correct |
99 |
Correct |
327 ms |
527552 KB |
Output is correct |
100 |
Correct |
408 ms |
529028 KB |
Output is correct |
101 |
Correct |
352 ms |
529196 KB |
Output is correct |
102 |
Correct |
260 ms |
524740 KB |
Output is correct |
103 |
Correct |
255 ms |
524916 KB |
Output is correct |
104 |
Correct |
148 ms |
509776 KB |
Output is correct |
105 |
Correct |
147 ms |
509604 KB |
Output is correct |
106 |
Correct |
142 ms |
509776 KB |
Output is correct |
107 |
Correct |
145 ms |
509636 KB |
Output is correct |
108 |
Correct |
138 ms |
509520 KB |
Output is correct |
109 |
Correct |
143 ms |
509668 KB |
Output is correct |
110 |
Correct |
145 ms |
509776 KB |
Output is correct |
111 |
Correct |
140 ms |
509776 KB |
Output is correct |
112 |
Correct |
146 ms |
509632 KB |
Output is correct |
113 |
Correct |
149 ms |
509520 KB |
Output is correct |
114 |
Correct |
398 ms |
513616 KB |
Output is correct |
115 |
Correct |
1136 ms |
527548 KB |
Output is correct |
116 |
Correct |
1186 ms |
527808 KB |
Output is correct |
117 |
Correct |
1148 ms |
529224 KB |
Output is correct |
118 |
Correct |
1188 ms |
529220 KB |
Output is correct |
119 |
Correct |
1310 ms |
529240 KB |
Output is correct |
120 |
Correct |
1104 ms |
529032 KB |
Output is correct |
121 |
Correct |
921 ms |
524880 KB |
Output is correct |
122 |
Execution timed out |
4088 ms |
524880 KB |
Time limit exceeded |
123 |
Halted |
0 ms |
0 KB |
- |