#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) {
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;
}
signed max_towers(signed L, signed R, signed D) {
++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);
if(alltogether == 0) {
int mx = query_max(L, R);
return mx - max(v[L], v[R]) >= D? 2 : 1;
}
int l = L, r;
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;
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);
int mx = query_max(mn + 1, l);
if(mx - max(v[l], v[mn]) >= D) rez++;
}
int limit = alltogether - 1;
r = L;
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);
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++;
}
//cerr << L << ' ' << l << ' ' << r << ' ' << R << '\n';
return rez;
}
#undef int
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
575 ms |
518388 KB |
Output is correct |
2 |
Correct |
976 ms |
524880 KB |
Output is correct |
3 |
Correct |
935 ms |
524860 KB |
Output is correct |
4 |
Correct |
972 ms |
524880 KB |
Output is correct |
5 |
Correct |
1044 ms |
524872 KB |
Output is correct |
6 |
Correct |
927 ms |
524880 KB |
Output is correct |
7 |
Correct |
956 ms |
524880 KB |
Output is correct |
8 |
Correct |
145 ms |
509268 KB |
Output is correct |
9 |
Correct |
146 ms |
509728 KB |
Output is correct |
10 |
Correct |
157 ms |
509516 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
149 ms |
509520 KB |
Output is correct |
2 |
Correct |
152 ms |
509716 KB |
Output is correct |
3 |
Correct |
152 ms |
509860 KB |
Output is correct |
4 |
Correct |
146 ms |
509776 KB |
Output is correct |
5 |
Correct |
153 ms |
509656 KB |
Output is correct |
6 |
Correct |
148 ms |
509776 KB |
Output is correct |
7 |
Correct |
155 ms |
509624 KB |
Output is correct |
8 |
Correct |
146 ms |
509520 KB |
Output is correct |
9 |
Correct |
153 ms |
509520 KB |
Output is correct |
10 |
Correct |
157 ms |
509520 KB |
Output is correct |
11 |
Correct |
153 ms |
509516 KB |
Output is correct |
12 |
Correct |
183 ms |
509516 KB |
Output is correct |
13 |
Correct |
160 ms |
509776 KB |
Output is correct |
14 |
Correct |
153 ms |
509720 KB |
Output is correct |
15 |
Correct |
180 ms |
509708 KB |
Output is correct |
16 |
Correct |
154 ms |
509756 KB |
Output is correct |
17 |
Correct |
159 ms |
509776 KB |
Output is correct |
18 |
Correct |
151 ms |
509520 KB |
Output is correct |
19 |
Correct |
155 ms |
509520 KB |
Output is correct |
20 |
Correct |
164 ms |
509880 KB |
Output is correct |
21 |
Correct |
148 ms |
509752 KB |
Output is correct |
22 |
Correct |
157 ms |
509776 KB |
Output is correct |
23 |
Correct |
152 ms |
509520 KB |
Output is correct |
24 |
Correct |
162 ms |
509520 KB |
Output is correct |
25 |
Correct |
157 ms |
509520 KB |
Output is correct |
26 |
Correct |
155 ms |
509776 KB |
Output is correct |
27 |
Correct |
162 ms |
509580 KB |
Output is correct |
28 |
Correct |
155 ms |
509776 KB |
Output is correct |
29 |
Correct |
156 ms |
509844 KB |
Output is correct |
30 |
Correct |
162 ms |
509776 KB |
Output is correct |
31 |
Correct |
157 ms |
509768 KB |
Output is correct |
32 |
Correct |
152 ms |
509520 KB |
Output is correct |
33 |
Correct |
153 ms |
509520 KB |
Output is correct |
34 |
Correct |
162 ms |
509608 KB |
Output is correct |
35 |
Correct |
151 ms |
509756 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
149 ms |
509520 KB |
Output is correct |
2 |
Correct |
152 ms |
509716 KB |
Output is correct |
3 |
Correct |
152 ms |
509860 KB |
Output is correct |
4 |
Correct |
146 ms |
509776 KB |
Output is correct |
5 |
Correct |
153 ms |
509656 KB |
Output is correct |
6 |
Correct |
148 ms |
509776 KB |
Output is correct |
7 |
Correct |
155 ms |
509624 KB |
Output is correct |
8 |
Correct |
146 ms |
509520 KB |
Output is correct |
9 |
Correct |
153 ms |
509520 KB |
Output is correct |
10 |
Correct |
157 ms |
509520 KB |
Output is correct |
11 |
Correct |
153 ms |
509516 KB |
Output is correct |
12 |
Correct |
183 ms |
509516 KB |
Output is correct |
13 |
Correct |
160 ms |
509776 KB |
Output is correct |
14 |
Correct |
153 ms |
509720 KB |
Output is correct |
15 |
Correct |
180 ms |
509708 KB |
Output is correct |
16 |
Correct |
154 ms |
509756 KB |
Output is correct |
17 |
Correct |
159 ms |
509776 KB |
Output is correct |
18 |
Correct |
151 ms |
509520 KB |
Output is correct |
19 |
Correct |
155 ms |
509520 KB |
Output is correct |
20 |
Correct |
164 ms |
509880 KB |
Output is correct |
21 |
Correct |
148 ms |
509752 KB |
Output is correct |
22 |
Correct |
157 ms |
509776 KB |
Output is correct |
23 |
Correct |
152 ms |
509520 KB |
Output is correct |
24 |
Correct |
162 ms |
509520 KB |
Output is correct |
25 |
Correct |
157 ms |
509520 KB |
Output is correct |
26 |
Correct |
155 ms |
509776 KB |
Output is correct |
27 |
Correct |
162 ms |
509580 KB |
Output is correct |
28 |
Correct |
155 ms |
509776 KB |
Output is correct |
29 |
Correct |
156 ms |
509844 KB |
Output is correct |
30 |
Correct |
162 ms |
509776 KB |
Output is correct |
31 |
Correct |
157 ms |
509768 KB |
Output is correct |
32 |
Correct |
152 ms |
509520 KB |
Output is correct |
33 |
Correct |
153 ms |
509520 KB |
Output is correct |
34 |
Correct |
162 ms |
509608 KB |
Output is correct |
35 |
Correct |
151 ms |
509756 KB |
Output is correct |
36 |
Correct |
264 ms |
521248 KB |
Output is correct |
37 |
Correct |
341 ms |
527552 KB |
Output is correct |
38 |
Correct |
326 ms |
527552 KB |
Output is correct |
39 |
Correct |
378 ms |
529136 KB |
Output is correct |
40 |
Correct |
398 ms |
529028 KB |
Output is correct |
41 |
Correct |
387 ms |
529216 KB |
Output is correct |
42 |
Correct |
363 ms |
529216 KB |
Output is correct |
43 |
Correct |
259 ms |
524880 KB |
Output is correct |
44 |
Correct |
274 ms |
524880 KB |
Output is correct |
45 |
Correct |
277 ms |
524876 KB |
Output is correct |
46 |
Correct |
265 ms |
524880 KB |
Output is correct |
47 |
Correct |
333 ms |
527556 KB |
Output is correct |
48 |
Correct |
374 ms |
529212 KB |
Output is correct |
49 |
Correct |
381 ms |
529032 KB |
Output is correct |
50 |
Correct |
283 ms |
524880 KB |
Output is correct |
51 |
Correct |
278 ms |
524872 KB |
Output is correct |
52 |
Correct |
340 ms |
527548 KB |
Output is correct |
53 |
Correct |
372 ms |
529108 KB |
Output is correct |
54 |
Correct |
369 ms |
529100 KB |
Output is correct |
55 |
Correct |
324 ms |
524696 KB |
Output is correct |
56 |
Correct |
264 ms |
524804 KB |
Output is correct |
57 |
Correct |
334 ms |
527056 KB |
Output is correct |
58 |
Correct |
342 ms |
527792 KB |
Output is correct |
59 |
Correct |
332 ms |
527552 KB |
Output is correct |
60 |
Correct |
375 ms |
529128 KB |
Output is correct |
61 |
Correct |
360 ms |
529064 KB |
Output is correct |
62 |
Correct |
387 ms |
529108 KB |
Output is correct |
63 |
Correct |
360 ms |
529024 KB |
Output is correct |
64 |
Correct |
268 ms |
524880 KB |
Output is correct |
65 |
Correct |
264 ms |
524880 KB |
Output is correct |
66 |
Correct |
263 ms |
524876 KB |
Output is correct |
67 |
Correct |
261 ms |
524880 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1116 ms |
527612 KB |
Output is correct |
2 |
Correct |
1308 ms |
527552 KB |
Output is correct |
3 |
Correct |
1340 ms |
527872 KB |
Output is correct |
4 |
Correct |
1294 ms |
529016 KB |
Output is correct |
5 |
Correct |
1319 ms |
529024 KB |
Output is correct |
6 |
Correct |
1355 ms |
529144 KB |
Output is correct |
7 |
Correct |
1298 ms |
529212 KB |
Output is correct |
8 |
Correct |
940 ms |
524804 KB |
Output is correct |
9 |
Correct |
949 ms |
524880 KB |
Output is correct |
10 |
Correct |
1221 ms |
524876 KB |
Output is correct |
11 |
Correct |
1206 ms |
524900 KB |
Output is correct |
12 |
Correct |
985 ms |
524692 KB |
Output is correct |
13 |
Correct |
1033 ms |
524880 KB |
Output is correct |
14 |
Correct |
147 ms |
509264 KB |
Output is correct |
15 |
Correct |
149 ms |
509600 KB |
Output is correct |
16 |
Correct |
146 ms |
509520 KB |
Output is correct |
17 |
Correct |
320 ms |
527808 KB |
Output is correct |
18 |
Correct |
368 ms |
529036 KB |
Output is correct |
19 |
Correct |
380 ms |
529212 KB |
Output is correct |
20 |
Correct |
262 ms |
524892 KB |
Output is correct |
21 |
Correct |
259 ms |
524916 KB |
Output is correct |
22 |
Correct |
331 ms |
527588 KB |
Output is correct |
23 |
Correct |
369 ms |
529212 KB |
Output is correct |
24 |
Correct |
363 ms |
529216 KB |
Output is correct |
25 |
Correct |
259 ms |
524880 KB |
Output is correct |
26 |
Correct |
260 ms |
524880 KB |
Output is correct |
27 |
Correct |
149 ms |
509576 KB |
Output is correct |
28 |
Correct |
151 ms |
509640 KB |
Output is correct |
29 |
Correct |
182 ms |
509640 KB |
Output is correct |
30 |
Correct |
148 ms |
509528 KB |
Output is correct |
31 |
Correct |
146 ms |
509536 KB |
Output is correct |
32 |
Correct |
153 ms |
509648 KB |
Output is correct |
33 |
Correct |
148 ms |
509776 KB |
Output is correct |
34 |
Correct |
147 ms |
509776 KB |
Output is correct |
35 |
Correct |
196 ms |
509500 KB |
Output is correct |
36 |
Correct |
154 ms |
509612 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
402 ms |
513616 KB |
Output is correct |
2 |
Correct |
1052 ms |
527568 KB |
Output is correct |
3 |
Correct |
1089 ms |
527740 KB |
Output is correct |
4 |
Correct |
1151 ms |
529180 KB |
Output is correct |
5 |
Correct |
1202 ms |
529024 KB |
Output is correct |
6 |
Correct |
1181 ms |
529188 KB |
Output is correct |
7 |
Correct |
1149 ms |
529120 KB |
Output is correct |
8 |
Correct |
992 ms |
524936 KB |
Output is correct |
9 |
Correct |
1000 ms |
524880 KB |
Output is correct |
10 |
Correct |
1000 ms |
524768 KB |
Output is correct |
11 |
Correct |
1008 ms |
524692 KB |
Output is correct |
12 |
Correct |
327 ms |
527740 KB |
Output is correct |
13 |
Correct |
365 ms |
529068 KB |
Output is correct |
14 |
Correct |
411 ms |
528976 KB |
Output is correct |
15 |
Correct |
304 ms |
524884 KB |
Output is correct |
16 |
Correct |
274 ms |
525056 KB |
Output is correct |
17 |
Correct |
330 ms |
527056 KB |
Output is correct |
18 |
Correct |
350 ms |
527728 KB |
Output is correct |
19 |
Correct |
339 ms |
527552 KB |
Output is correct |
20 |
Correct |
379 ms |
529024 KB |
Output is correct |
21 |
Correct |
380 ms |
529216 KB |
Output is correct |
22 |
Correct |
384 ms |
529164 KB |
Output is correct |
23 |
Correct |
371 ms |
529212 KB |
Output is correct |
24 |
Correct |
259 ms |
524908 KB |
Output is correct |
25 |
Correct |
259 ms |
524876 KB |
Output is correct |
26 |
Correct |
293 ms |
524884 KB |
Output is correct |
27 |
Correct |
273 ms |
524880 KB |
Output is correct |
28 |
Correct |
158 ms |
509720 KB |
Output is correct |
29 |
Correct |
155 ms |
509776 KB |
Output is correct |
30 |
Correct |
152 ms |
509776 KB |
Output is correct |
31 |
Correct |
190 ms |
509520 KB |
Output is correct |
32 |
Correct |
152 ms |
509552 KB |
Output is correct |
33 |
Correct |
156 ms |
509520 KB |
Output is correct |
34 |
Correct |
155 ms |
509704 KB |
Output is correct |
35 |
Correct |
158 ms |
509804 KB |
Output is correct |
36 |
Correct |
156 ms |
509780 KB |
Output is correct |
37 |
Correct |
157 ms |
509776 KB |
Output is correct |
38 |
Correct |
157 ms |
509776 KB |
Output is correct |
39 |
Correct |
164 ms |
509776 KB |
Output is correct |
40 |
Correct |
149 ms |
509684 KB |
Output is correct |
41 |
Correct |
156 ms |
509520 KB |
Output is correct |
42 |
Correct |
153 ms |
509520 KB |
Output is correct |
43 |
Correct |
150 ms |
509696 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
149 ms |
509520 KB |
Output is correct |
2 |
Correct |
152 ms |
509716 KB |
Output is correct |
3 |
Correct |
152 ms |
509860 KB |
Output is correct |
4 |
Correct |
146 ms |
509776 KB |
Output is correct |
5 |
Correct |
153 ms |
509656 KB |
Output is correct |
6 |
Correct |
148 ms |
509776 KB |
Output is correct |
7 |
Correct |
155 ms |
509624 KB |
Output is correct |
8 |
Correct |
146 ms |
509520 KB |
Output is correct |
9 |
Correct |
153 ms |
509520 KB |
Output is correct |
10 |
Correct |
157 ms |
509520 KB |
Output is correct |
11 |
Correct |
153 ms |
509516 KB |
Output is correct |
12 |
Correct |
183 ms |
509516 KB |
Output is correct |
13 |
Correct |
160 ms |
509776 KB |
Output is correct |
14 |
Correct |
153 ms |
509720 KB |
Output is correct |
15 |
Correct |
180 ms |
509708 KB |
Output is correct |
16 |
Correct |
154 ms |
509756 KB |
Output is correct |
17 |
Correct |
159 ms |
509776 KB |
Output is correct |
18 |
Correct |
151 ms |
509520 KB |
Output is correct |
19 |
Correct |
155 ms |
509520 KB |
Output is correct |
20 |
Correct |
164 ms |
509880 KB |
Output is correct |
21 |
Correct |
148 ms |
509752 KB |
Output is correct |
22 |
Correct |
157 ms |
509776 KB |
Output is correct |
23 |
Correct |
152 ms |
509520 KB |
Output is correct |
24 |
Correct |
162 ms |
509520 KB |
Output is correct |
25 |
Correct |
157 ms |
509520 KB |
Output is correct |
26 |
Correct |
155 ms |
509776 KB |
Output is correct |
27 |
Correct |
162 ms |
509580 KB |
Output is correct |
28 |
Correct |
155 ms |
509776 KB |
Output is correct |
29 |
Correct |
156 ms |
509844 KB |
Output is correct |
30 |
Correct |
162 ms |
509776 KB |
Output is correct |
31 |
Correct |
157 ms |
509768 KB |
Output is correct |
32 |
Correct |
152 ms |
509520 KB |
Output is correct |
33 |
Correct |
153 ms |
509520 KB |
Output is correct |
34 |
Correct |
162 ms |
509608 KB |
Output is correct |
35 |
Correct |
151 ms |
509756 KB |
Output is correct |
36 |
Correct |
264 ms |
521248 KB |
Output is correct |
37 |
Correct |
341 ms |
527552 KB |
Output is correct |
38 |
Correct |
326 ms |
527552 KB |
Output is correct |
39 |
Correct |
378 ms |
529136 KB |
Output is correct |
40 |
Correct |
398 ms |
529028 KB |
Output is correct |
41 |
Correct |
387 ms |
529216 KB |
Output is correct |
42 |
Correct |
363 ms |
529216 KB |
Output is correct |
43 |
Correct |
259 ms |
524880 KB |
Output is correct |
44 |
Correct |
274 ms |
524880 KB |
Output is correct |
45 |
Correct |
277 ms |
524876 KB |
Output is correct |
46 |
Correct |
265 ms |
524880 KB |
Output is correct |
47 |
Correct |
333 ms |
527556 KB |
Output is correct |
48 |
Correct |
374 ms |
529212 KB |
Output is correct |
49 |
Correct |
381 ms |
529032 KB |
Output is correct |
50 |
Correct |
283 ms |
524880 KB |
Output is correct |
51 |
Correct |
278 ms |
524872 KB |
Output is correct |
52 |
Correct |
340 ms |
527548 KB |
Output is correct |
53 |
Correct |
372 ms |
529108 KB |
Output is correct |
54 |
Correct |
369 ms |
529100 KB |
Output is correct |
55 |
Correct |
324 ms |
524696 KB |
Output is correct |
56 |
Correct |
264 ms |
524804 KB |
Output is correct |
57 |
Correct |
334 ms |
527056 KB |
Output is correct |
58 |
Correct |
342 ms |
527792 KB |
Output is correct |
59 |
Correct |
332 ms |
527552 KB |
Output is correct |
60 |
Correct |
375 ms |
529128 KB |
Output is correct |
61 |
Correct |
360 ms |
529064 KB |
Output is correct |
62 |
Correct |
387 ms |
529108 KB |
Output is correct |
63 |
Correct |
360 ms |
529024 KB |
Output is correct |
64 |
Correct |
268 ms |
524880 KB |
Output is correct |
65 |
Correct |
264 ms |
524880 KB |
Output is correct |
66 |
Correct |
263 ms |
524876 KB |
Output is correct |
67 |
Correct |
261 ms |
524880 KB |
Output is correct |
68 |
Correct |
1116 ms |
527612 KB |
Output is correct |
69 |
Correct |
1308 ms |
527552 KB |
Output is correct |
70 |
Correct |
1340 ms |
527872 KB |
Output is correct |
71 |
Correct |
1294 ms |
529016 KB |
Output is correct |
72 |
Correct |
1319 ms |
529024 KB |
Output is correct |
73 |
Correct |
1355 ms |
529144 KB |
Output is correct |
74 |
Correct |
1298 ms |
529212 KB |
Output is correct |
75 |
Correct |
940 ms |
524804 KB |
Output is correct |
76 |
Correct |
949 ms |
524880 KB |
Output is correct |
77 |
Correct |
1221 ms |
524876 KB |
Output is correct |
78 |
Correct |
1206 ms |
524900 KB |
Output is correct |
79 |
Correct |
985 ms |
524692 KB |
Output is correct |
80 |
Correct |
1033 ms |
524880 KB |
Output is correct |
81 |
Correct |
147 ms |
509264 KB |
Output is correct |
82 |
Correct |
149 ms |
509600 KB |
Output is correct |
83 |
Correct |
146 ms |
509520 KB |
Output is correct |
84 |
Correct |
320 ms |
527808 KB |
Output is correct |
85 |
Correct |
368 ms |
529036 KB |
Output is correct |
86 |
Correct |
380 ms |
529212 KB |
Output is correct |
87 |
Correct |
262 ms |
524892 KB |
Output is correct |
88 |
Correct |
259 ms |
524916 KB |
Output is correct |
89 |
Correct |
331 ms |
527588 KB |
Output is correct |
90 |
Correct |
369 ms |
529212 KB |
Output is correct |
91 |
Correct |
363 ms |
529216 KB |
Output is correct |
92 |
Correct |
259 ms |
524880 KB |
Output is correct |
93 |
Correct |
260 ms |
524880 KB |
Output is correct |
94 |
Correct |
149 ms |
509576 KB |
Output is correct |
95 |
Correct |
151 ms |
509640 KB |
Output is correct |
96 |
Correct |
182 ms |
509640 KB |
Output is correct |
97 |
Correct |
148 ms |
509528 KB |
Output is correct |
98 |
Correct |
146 ms |
509536 KB |
Output is correct |
99 |
Correct |
153 ms |
509648 KB |
Output is correct |
100 |
Correct |
148 ms |
509776 KB |
Output is correct |
101 |
Correct |
147 ms |
509776 KB |
Output is correct |
102 |
Correct |
196 ms |
509500 KB |
Output is correct |
103 |
Correct |
154 ms |
509612 KB |
Output is correct |
104 |
Correct |
1129 ms |
525676 KB |
Output is correct |
105 |
Correct |
1229 ms |
527736 KB |
Output is correct |
106 |
Correct |
1256 ms |
527580 KB |
Output is correct |
107 |
Correct |
1378 ms |
528988 KB |
Output is correct |
108 |
Incorrect |
1501 ms |
529012 KB |
19976th lines differ - on the 1st token, expected: '2', found: '1' |
109 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
575 ms |
518388 KB |
Output is correct |
2 |
Correct |
976 ms |
524880 KB |
Output is correct |
3 |
Correct |
935 ms |
524860 KB |
Output is correct |
4 |
Correct |
972 ms |
524880 KB |
Output is correct |
5 |
Correct |
1044 ms |
524872 KB |
Output is correct |
6 |
Correct |
927 ms |
524880 KB |
Output is correct |
7 |
Correct |
956 ms |
524880 KB |
Output is correct |
8 |
Correct |
145 ms |
509268 KB |
Output is correct |
9 |
Correct |
146 ms |
509728 KB |
Output is correct |
10 |
Correct |
157 ms |
509516 KB |
Output is correct |
11 |
Correct |
149 ms |
509520 KB |
Output is correct |
12 |
Correct |
152 ms |
509716 KB |
Output is correct |
13 |
Correct |
152 ms |
509860 KB |
Output is correct |
14 |
Correct |
146 ms |
509776 KB |
Output is correct |
15 |
Correct |
153 ms |
509656 KB |
Output is correct |
16 |
Correct |
148 ms |
509776 KB |
Output is correct |
17 |
Correct |
155 ms |
509624 KB |
Output is correct |
18 |
Correct |
146 ms |
509520 KB |
Output is correct |
19 |
Correct |
153 ms |
509520 KB |
Output is correct |
20 |
Correct |
157 ms |
509520 KB |
Output is correct |
21 |
Correct |
153 ms |
509516 KB |
Output is correct |
22 |
Correct |
183 ms |
509516 KB |
Output is correct |
23 |
Correct |
160 ms |
509776 KB |
Output is correct |
24 |
Correct |
153 ms |
509720 KB |
Output is correct |
25 |
Correct |
180 ms |
509708 KB |
Output is correct |
26 |
Correct |
154 ms |
509756 KB |
Output is correct |
27 |
Correct |
159 ms |
509776 KB |
Output is correct |
28 |
Correct |
151 ms |
509520 KB |
Output is correct |
29 |
Correct |
155 ms |
509520 KB |
Output is correct |
30 |
Correct |
164 ms |
509880 KB |
Output is correct |
31 |
Correct |
148 ms |
509752 KB |
Output is correct |
32 |
Correct |
157 ms |
509776 KB |
Output is correct |
33 |
Correct |
152 ms |
509520 KB |
Output is correct |
34 |
Correct |
162 ms |
509520 KB |
Output is correct |
35 |
Correct |
157 ms |
509520 KB |
Output is correct |
36 |
Correct |
155 ms |
509776 KB |
Output is correct |
37 |
Correct |
162 ms |
509580 KB |
Output is correct |
38 |
Correct |
155 ms |
509776 KB |
Output is correct |
39 |
Correct |
156 ms |
509844 KB |
Output is correct |
40 |
Correct |
162 ms |
509776 KB |
Output is correct |
41 |
Correct |
157 ms |
509768 KB |
Output is correct |
42 |
Correct |
152 ms |
509520 KB |
Output is correct |
43 |
Correct |
153 ms |
509520 KB |
Output is correct |
44 |
Correct |
162 ms |
509608 KB |
Output is correct |
45 |
Correct |
151 ms |
509756 KB |
Output is correct |
46 |
Correct |
264 ms |
521248 KB |
Output is correct |
47 |
Correct |
341 ms |
527552 KB |
Output is correct |
48 |
Correct |
326 ms |
527552 KB |
Output is correct |
49 |
Correct |
378 ms |
529136 KB |
Output is correct |
50 |
Correct |
398 ms |
529028 KB |
Output is correct |
51 |
Correct |
387 ms |
529216 KB |
Output is correct |
52 |
Correct |
363 ms |
529216 KB |
Output is correct |
53 |
Correct |
259 ms |
524880 KB |
Output is correct |
54 |
Correct |
274 ms |
524880 KB |
Output is correct |
55 |
Correct |
277 ms |
524876 KB |
Output is correct |
56 |
Correct |
265 ms |
524880 KB |
Output is correct |
57 |
Correct |
333 ms |
527556 KB |
Output is correct |
58 |
Correct |
374 ms |
529212 KB |
Output is correct |
59 |
Correct |
381 ms |
529032 KB |
Output is correct |
60 |
Correct |
283 ms |
524880 KB |
Output is correct |
61 |
Correct |
278 ms |
524872 KB |
Output is correct |
62 |
Correct |
340 ms |
527548 KB |
Output is correct |
63 |
Correct |
372 ms |
529108 KB |
Output is correct |
64 |
Correct |
369 ms |
529100 KB |
Output is correct |
65 |
Correct |
324 ms |
524696 KB |
Output is correct |
66 |
Correct |
264 ms |
524804 KB |
Output is correct |
67 |
Correct |
334 ms |
527056 KB |
Output is correct |
68 |
Correct |
342 ms |
527792 KB |
Output is correct |
69 |
Correct |
332 ms |
527552 KB |
Output is correct |
70 |
Correct |
375 ms |
529128 KB |
Output is correct |
71 |
Correct |
360 ms |
529064 KB |
Output is correct |
72 |
Correct |
387 ms |
529108 KB |
Output is correct |
73 |
Correct |
360 ms |
529024 KB |
Output is correct |
74 |
Correct |
268 ms |
524880 KB |
Output is correct |
75 |
Correct |
264 ms |
524880 KB |
Output is correct |
76 |
Correct |
263 ms |
524876 KB |
Output is correct |
77 |
Correct |
261 ms |
524880 KB |
Output is correct |
78 |
Correct |
1116 ms |
527612 KB |
Output is correct |
79 |
Correct |
1308 ms |
527552 KB |
Output is correct |
80 |
Correct |
1340 ms |
527872 KB |
Output is correct |
81 |
Correct |
1294 ms |
529016 KB |
Output is correct |
82 |
Correct |
1319 ms |
529024 KB |
Output is correct |
83 |
Correct |
1355 ms |
529144 KB |
Output is correct |
84 |
Correct |
1298 ms |
529212 KB |
Output is correct |
85 |
Correct |
940 ms |
524804 KB |
Output is correct |
86 |
Correct |
949 ms |
524880 KB |
Output is correct |
87 |
Correct |
1221 ms |
524876 KB |
Output is correct |
88 |
Correct |
1206 ms |
524900 KB |
Output is correct |
89 |
Correct |
985 ms |
524692 KB |
Output is correct |
90 |
Correct |
1033 ms |
524880 KB |
Output is correct |
91 |
Correct |
147 ms |
509264 KB |
Output is correct |
92 |
Correct |
149 ms |
509600 KB |
Output is correct |
93 |
Correct |
146 ms |
509520 KB |
Output is correct |
94 |
Correct |
320 ms |
527808 KB |
Output is correct |
95 |
Correct |
368 ms |
529036 KB |
Output is correct |
96 |
Correct |
380 ms |
529212 KB |
Output is correct |
97 |
Correct |
262 ms |
524892 KB |
Output is correct |
98 |
Correct |
259 ms |
524916 KB |
Output is correct |
99 |
Correct |
331 ms |
527588 KB |
Output is correct |
100 |
Correct |
369 ms |
529212 KB |
Output is correct |
101 |
Correct |
363 ms |
529216 KB |
Output is correct |
102 |
Correct |
259 ms |
524880 KB |
Output is correct |
103 |
Correct |
260 ms |
524880 KB |
Output is correct |
104 |
Correct |
149 ms |
509576 KB |
Output is correct |
105 |
Correct |
151 ms |
509640 KB |
Output is correct |
106 |
Correct |
182 ms |
509640 KB |
Output is correct |
107 |
Correct |
148 ms |
509528 KB |
Output is correct |
108 |
Correct |
146 ms |
509536 KB |
Output is correct |
109 |
Correct |
153 ms |
509648 KB |
Output is correct |
110 |
Correct |
148 ms |
509776 KB |
Output is correct |
111 |
Correct |
147 ms |
509776 KB |
Output is correct |
112 |
Correct |
196 ms |
509500 KB |
Output is correct |
113 |
Correct |
154 ms |
509612 KB |
Output is correct |
114 |
Correct |
402 ms |
513616 KB |
Output is correct |
115 |
Correct |
1052 ms |
527568 KB |
Output is correct |
116 |
Correct |
1089 ms |
527740 KB |
Output is correct |
117 |
Correct |
1151 ms |
529180 KB |
Output is correct |
118 |
Correct |
1202 ms |
529024 KB |
Output is correct |
119 |
Correct |
1181 ms |
529188 KB |
Output is correct |
120 |
Correct |
1149 ms |
529120 KB |
Output is correct |
121 |
Correct |
992 ms |
524936 KB |
Output is correct |
122 |
Correct |
1000 ms |
524880 KB |
Output is correct |
123 |
Correct |
1000 ms |
524768 KB |
Output is correct |
124 |
Correct |
1008 ms |
524692 KB |
Output is correct |
125 |
Correct |
327 ms |
527740 KB |
Output is correct |
126 |
Correct |
365 ms |
529068 KB |
Output is correct |
127 |
Correct |
411 ms |
528976 KB |
Output is correct |
128 |
Correct |
304 ms |
524884 KB |
Output is correct |
129 |
Correct |
274 ms |
525056 KB |
Output is correct |
130 |
Correct |
330 ms |
527056 KB |
Output is correct |
131 |
Correct |
350 ms |
527728 KB |
Output is correct |
132 |
Correct |
339 ms |
527552 KB |
Output is correct |
133 |
Correct |
379 ms |
529024 KB |
Output is correct |
134 |
Correct |
380 ms |
529216 KB |
Output is correct |
135 |
Correct |
384 ms |
529164 KB |
Output is correct |
136 |
Correct |
371 ms |
529212 KB |
Output is correct |
137 |
Correct |
259 ms |
524908 KB |
Output is correct |
138 |
Correct |
259 ms |
524876 KB |
Output is correct |
139 |
Correct |
293 ms |
524884 KB |
Output is correct |
140 |
Correct |
273 ms |
524880 KB |
Output is correct |
141 |
Correct |
158 ms |
509720 KB |
Output is correct |
142 |
Correct |
155 ms |
509776 KB |
Output is correct |
143 |
Correct |
152 ms |
509776 KB |
Output is correct |
144 |
Correct |
190 ms |
509520 KB |
Output is correct |
145 |
Correct |
152 ms |
509552 KB |
Output is correct |
146 |
Correct |
156 ms |
509520 KB |
Output is correct |
147 |
Correct |
155 ms |
509704 KB |
Output is correct |
148 |
Correct |
158 ms |
509804 KB |
Output is correct |
149 |
Correct |
156 ms |
509780 KB |
Output is correct |
150 |
Correct |
157 ms |
509776 KB |
Output is correct |
151 |
Correct |
157 ms |
509776 KB |
Output is correct |
152 |
Correct |
164 ms |
509776 KB |
Output is correct |
153 |
Correct |
149 ms |
509684 KB |
Output is correct |
154 |
Correct |
156 ms |
509520 KB |
Output is correct |
155 |
Correct |
153 ms |
509520 KB |
Output is correct |
156 |
Correct |
150 ms |
509696 KB |
Output is correct |
157 |
Correct |
1129 ms |
525676 KB |
Output is correct |
158 |
Correct |
1229 ms |
527736 KB |
Output is correct |
159 |
Correct |
1256 ms |
527580 KB |
Output is correct |
160 |
Correct |
1378 ms |
528988 KB |
Output is correct |
161 |
Incorrect |
1501 ms |
529012 KB |
19976th lines differ - on the 1st token, expected: '2', found: '1' |
162 |
Halted |
0 ms |
0 KB |
- |