#include <algorithm>
#include <iostream>
#include <numeric>
#include <cassert>
#include <vector>
#include <stack>
typedef long long llong;
const int MAXLOG = 20 + 5;
const int MAXN = 100000 + 10;
const int INF = 1e9;
int n;
struct MST
{
std::vector <int> tree[4*MAXN];
void build(int l, int r, int node, int vals[])
{
if (l == r)
{
tree[node].push_back(vals[l]);
return;
}
int mid = (l + r) / 2;
build(l, mid, 2*node, vals);
build(mid + 1, r, 2*node + 1, vals);
tree[node].reserve(r - l + 1);
int lPtr = 0, rPtr = 0;
for (int i = l ; i <= r ; ++i)
{
if (lPtr == tree[2*node].size())
{
tree[node].push_back(tree[2*node + 1][rPtr++]);
continue;
}
if (rPtr == tree[2*node + 1].size())
{
tree[node].push_back(tree[2*node][lPtr++]);
continue;
}
if (tree[2*node][lPtr] < tree[2*node + 1][rPtr])
{
tree[node].push_back(tree[2*node][lPtr++]);
} else
{
tree[node].push_back(tree[2*node + 1][rPtr++]);
}
}
}
int binary(int node, int val)
{
int l = -1, r = tree[node].size(), mid;
while (l < r - 1)
{
mid = (l + r) / 2;
if (tree[node][mid] < val) l = mid;
else r = mid;
}
return r;
}
int query(int l, int r, int node, int queryL, int queryR, int queryVal)
{
if (queryL <= l && r <= queryR)
{
return binary(node, queryVal);
}
int res = 0;
int mid = (l + r) / 2;
if (queryL <= mid) res += query(l, mid, 2*node, queryL, queryR, queryVal);
if (mid + 1 <= queryR) res += query(mid + 1, r, 2*node + 1, queryL, queryR, queryVal);
return res;
}
void build(int vals[])
{
build(1, n, 1, vals);
}
int query(int l, int r, int val)
{
return query(1, n, 1, l, r, val);
}
};
MST left, right;
struct Sparse
{
int sparse[MAXLOG][MAXN];
int vals[MAXN];
int lg[MAXN];
int cmp(int x, int y)
{
if (vals[x] > vals[y]) return x;
return y;
}
void build(int _vals[])
{
for (int i = 1 ; i <= n ; ++i)
{
sparse[0][i] = i;
vals[i] = _vals[i];
}
for (int log = 1 ; (1 << log) <= n ; ++log)
{
for (int i = 1 ; i + (1 << log) - 1 <= n ; ++i)
{
sparse[log][i] = cmp(sparse[log - 1][i], sparse[log - 1][i + (1 << log - 1)]);
}
}
for (int i = 1 ; i <= n ; ++i)
{
lg[i] = lg[i - 1];
if ((1 << lg[i] + 1) < i)
{
lg[i]++;
}
}
}
int findMAX(int l, int r)
{
int log = lg[r - l + 1];
return vals[cmp(sparse[log][l], sparse[log][r - (1 << log) + 1])];
}
int findIDX(int l, int r)
{
int log = lg[r - l + 1];
return cmp(sparse[log][l], sparse[log][r - (1 << log) + 1]);
}
};
int a[MAXN];
int b[MAXN];
int c[MAXN];
int d[MAXN];
int h[MAXN];
Sparse sparse;
std::stack <int> st;
std::vector <int> v;
int isClimb = -1;
void init(int N, std::vector <int> H)
{
n = N;
for (int i = 1 ; i <= n ; ++i)
{
h[i] = H[i - 1];
}
sparse.build(h);
st.push(0);
for (int i = 1 ; i <= n ; ++i)
{
while (h[st.top()] > h[i])
{
st.pop();
}
a[i] = st.top();
st.push(i);
}
for (int i = 1 ; i <= n ; ++i)
{
if ((i == 1 || h[i - 1] < h[i]) && (i == n || h[i] > h[i + 1]))
{
isClimb = i;
break;
}
}
for (int i = 1 ; i < isClimb ; ++i)
{
if (h[i] > h[i + 1])
{
isClimb = -1;
break;
}
}
if (isClimb != -1)
{
for (int i = isClimb ; i < n ; ++i)
{
if (h[i] < h[i + 1])
{
isClimb = -1;
break;
}
}
}
while (!st.empty())
{
st.pop();
}
st.push(n + 1);
for (int i = n ; i >= 1 ; --i)
{
while (h[st.top()] > h[i])
{
st.pop();
}
c[i] = st.top();
st.push(i);
}
for (int i = 1 ; i <= n ; ++i)
{
if (a[i] == i - 1)
{
b[i] = 0;
} else
{
b[i] = sparse.findMAX(a[i] + 1, i - 1) - h[i];
}
if (c[i] == i + 1)
{
d[i] = 0;
} else
{
d[i] = sparse.findMAX(i + 1, c[i] - 1) - h[i];
}
}
for (int i = 1 ; i <= n ; ++i)
{
int curr = INF;
if (a[i] > 0) curr = std::min(curr, b[i]);
if (c[i] < n + 1) curr = std::min(curr, d[i]);
v.push_back(curr);
}
std::sort(v.begin(), v.end());
}
bool entered;
int vals[MAXN];
int prefix[MAXN];
int max_towers(int L, int R, int D)
{
L++; R++;
if (isClimb != -1)
{
if (isClimb < L || R < isClimb)
{
return 1;
}
if (h[L] + D <= h[isClimb] && h[R] + D <= h[isClimb])
{
return 2;
}
return 1;
}
if (L == R)
{
return 1;
}
if (L == 1 && R == n)
{
int l = -1, r = n, mid;
while (l < r - 1)
{
mid = (l + r) / 2;
if (v[mid] < D) l = mid;
else r = mid;
}
return n - r;
}
if (!entered)
{
entered = true;
for (int i = 1 ; i <= n ; ++i)
{
if ((a[i] > 0 && b[i] < D) && (c[i] == n + 1 || d[i] >= D))
{
vals[i] = a[i];
} else
{
vals[i] = INF;
}
}
left.build(vals);
for (int i = 1 ; i <= n ; ++i)
{
if ((c[i] <= n && d[i] < D) && (a[i] == 0 || b[i] >= D))
{
vals[i] = c[i];
} else
{
vals[i] = 0;
}
}
right.build(vals);
for (int i = 1 ; i <= n ; ++i)
{
prefix[i] = prefix[i - 1];
if ((a[i] == 0 || b[i] >= D) && (c[i] == n + 1 || d[i] >= D))
{
prefix[i]++;
}
}
}
int add = 0;
int idx = sparse.findIDX(L, R);
if (a[idx] < L && c[idx] > R) add++;
if (prefix[R] - prefix[L - 1] + left.query(L, R, L) + (R - L + 1 - right.query(L, R, R + 1)) + add == 0) return 1;
return prefix[R] - prefix[L - 1] + left.query(L, R, L) + (R - L + 1 - right.query(L, R, R + 1)) + add;
}
Compilation message
towers.cpp: In member function 'void MST::build(int, int, int, int*)':
towers.cpp:33:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
33 | if (lPtr == tree[2*node].size())
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~
towers.cpp:39:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
39 | if (rPtr == tree[2*node + 1].size())
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
towers.cpp: In member function 'void Sparse::build(int*)':
towers.cpp:118:88: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
118 | sparse[log][i] = cmp(sparse[log - 1][i], sparse[log - 1][i + (1 << log - 1)]);
| ~~~~^~~
towers.cpp:125:29: warning: suggest parentheses around '+' inside '<<' [-Wparentheses]
125 | if ((1 << lg[i] + 1) < i)
| ~~~~~~^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
526 ms |
25292 KB |
Output is correct |
2 |
Correct |
783 ms |
29580 KB |
Output is correct |
3 |
Correct |
864 ms |
29548 KB |
Output is correct |
4 |
Correct |
879 ms |
29712 KB |
Output is correct |
5 |
Correct |
676 ms |
29820 KB |
Output is correct |
6 |
Correct |
768 ms |
29740 KB |
Output is correct |
7 |
Correct |
871 ms |
29912 KB |
Output is correct |
8 |
Correct |
13 ms |
19132 KB |
Output is correct |
9 |
Correct |
12 ms |
19280 KB |
Output is correct |
10 |
Correct |
11 ms |
19340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
19152 KB |
Output is correct |
2 |
Correct |
12 ms |
19664 KB |
Output is correct |
3 |
Correct |
13 ms |
19664 KB |
Output is correct |
4 |
Correct |
12 ms |
19664 KB |
Output is correct |
5 |
Correct |
13 ms |
19664 KB |
Output is correct |
6 |
Correct |
12 ms |
19592 KB |
Output is correct |
7 |
Correct |
11 ms |
19700 KB |
Output is correct |
8 |
Correct |
12 ms |
19252 KB |
Output is correct |
9 |
Correct |
13 ms |
19280 KB |
Output is correct |
10 |
Correct |
12 ms |
19664 KB |
Output is correct |
11 |
Correct |
12 ms |
19664 KB |
Output is correct |
12 |
Correct |
11 ms |
19124 KB |
Output is correct |
13 |
Correct |
11 ms |
19232 KB |
Output is correct |
14 |
Correct |
11 ms |
19260 KB |
Output is correct |
15 |
Correct |
12 ms |
19684 KB |
Output is correct |
16 |
Correct |
15 ms |
19672 KB |
Output is correct |
17 |
Correct |
12 ms |
19628 KB |
Output is correct |
18 |
Correct |
11 ms |
19244 KB |
Output is correct |
19 |
Correct |
12 ms |
19664 KB |
Output is correct |
20 |
Correct |
11 ms |
19312 KB |
Output is correct |
21 |
Correct |
13 ms |
19244 KB |
Output is correct |
22 |
Correct |
11 ms |
19280 KB |
Output is correct |
23 |
Correct |
13 ms |
19232 KB |
Output is correct |
24 |
Correct |
13 ms |
19336 KB |
Output is correct |
25 |
Correct |
12 ms |
19160 KB |
Output is correct |
26 |
Correct |
12 ms |
19280 KB |
Output is correct |
27 |
Correct |
12 ms |
19336 KB |
Output is correct |
28 |
Correct |
12 ms |
19248 KB |
Output is correct |
29 |
Correct |
12 ms |
19336 KB |
Output is correct |
30 |
Correct |
11 ms |
19280 KB |
Output is correct |
31 |
Correct |
14 ms |
19284 KB |
Output is correct |
32 |
Correct |
12 ms |
19280 KB |
Output is correct |
33 |
Correct |
14 ms |
19360 KB |
Output is correct |
34 |
Correct |
13 ms |
19292 KB |
Output is correct |
35 |
Correct |
11 ms |
19292 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
19152 KB |
Output is correct |
2 |
Correct |
12 ms |
19664 KB |
Output is correct |
3 |
Correct |
13 ms |
19664 KB |
Output is correct |
4 |
Correct |
12 ms |
19664 KB |
Output is correct |
5 |
Correct |
13 ms |
19664 KB |
Output is correct |
6 |
Correct |
12 ms |
19592 KB |
Output is correct |
7 |
Correct |
11 ms |
19700 KB |
Output is correct |
8 |
Correct |
12 ms |
19252 KB |
Output is correct |
9 |
Correct |
13 ms |
19280 KB |
Output is correct |
10 |
Correct |
12 ms |
19664 KB |
Output is correct |
11 |
Correct |
12 ms |
19664 KB |
Output is correct |
12 |
Correct |
11 ms |
19124 KB |
Output is correct |
13 |
Correct |
11 ms |
19232 KB |
Output is correct |
14 |
Correct |
11 ms |
19260 KB |
Output is correct |
15 |
Correct |
12 ms |
19684 KB |
Output is correct |
16 |
Correct |
15 ms |
19672 KB |
Output is correct |
17 |
Correct |
12 ms |
19628 KB |
Output is correct |
18 |
Correct |
11 ms |
19244 KB |
Output is correct |
19 |
Correct |
12 ms |
19664 KB |
Output is correct |
20 |
Correct |
11 ms |
19312 KB |
Output is correct |
21 |
Correct |
13 ms |
19244 KB |
Output is correct |
22 |
Correct |
11 ms |
19280 KB |
Output is correct |
23 |
Correct |
13 ms |
19232 KB |
Output is correct |
24 |
Correct |
13 ms |
19336 KB |
Output is correct |
25 |
Correct |
12 ms |
19160 KB |
Output is correct |
26 |
Correct |
12 ms |
19280 KB |
Output is correct |
27 |
Correct |
12 ms |
19336 KB |
Output is correct |
28 |
Correct |
12 ms |
19248 KB |
Output is correct |
29 |
Correct |
12 ms |
19336 KB |
Output is correct |
30 |
Correct |
11 ms |
19280 KB |
Output is correct |
31 |
Correct |
14 ms |
19284 KB |
Output is correct |
32 |
Correct |
12 ms |
19280 KB |
Output is correct |
33 |
Correct |
14 ms |
19360 KB |
Output is correct |
34 |
Correct |
13 ms |
19292 KB |
Output is correct |
35 |
Correct |
11 ms |
19292 KB |
Output is correct |
36 |
Correct |
57 ms |
40532 KB |
Output is correct |
37 |
Correct |
89 ms |
52480 KB |
Output is correct |
38 |
Correct |
93 ms |
52540 KB |
Output is correct |
39 |
Correct |
93 ms |
52496 KB |
Output is correct |
40 |
Correct |
93 ms |
52468 KB |
Output is correct |
41 |
Correct |
93 ms |
52500 KB |
Output is correct |
42 |
Correct |
101 ms |
52468 KB |
Output is correct |
43 |
Correct |
41 ms |
29644 KB |
Output is correct |
44 |
Correct |
42 ms |
29844 KB |
Output is correct |
45 |
Correct |
87 ms |
52492 KB |
Output is correct |
46 |
Correct |
99 ms |
52756 KB |
Output is correct |
47 |
Correct |
91 ms |
52536 KB |
Output is correct |
48 |
Correct |
90 ms |
52488 KB |
Output is correct |
49 |
Correct |
110 ms |
52632 KB |
Output is correct |
50 |
Correct |
42 ms |
29860 KB |
Output is correct |
51 |
Correct |
85 ms |
52496 KB |
Output is correct |
52 |
Correct |
49 ms |
29416 KB |
Output is correct |
53 |
Correct |
47 ms |
29336 KB |
Output is correct |
54 |
Correct |
37 ms |
29364 KB |
Output is correct |
55 |
Correct |
32 ms |
29724 KB |
Output is correct |
56 |
Correct |
31 ms |
29584 KB |
Output is correct |
57 |
Correct |
35 ms |
29064 KB |
Output is correct |
58 |
Correct |
49 ms |
29348 KB |
Output is correct |
59 |
Correct |
42 ms |
29348 KB |
Output is correct |
60 |
Correct |
39 ms |
29312 KB |
Output is correct |
61 |
Correct |
39 ms |
29336 KB |
Output is correct |
62 |
Correct |
31 ms |
29324 KB |
Output is correct |
63 |
Correct |
43 ms |
29344 KB |
Output is correct |
64 |
Correct |
37 ms |
29604 KB |
Output is correct |
65 |
Correct |
28 ms |
29764 KB |
Output is correct |
66 |
Correct |
38 ms |
29528 KB |
Output is correct |
67 |
Correct |
28 ms |
29708 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1201 ms |
52280 KB |
Output is correct |
2 |
Correct |
1382 ms |
52456 KB |
Output is correct |
3 |
Correct |
1109 ms |
52480 KB |
Output is correct |
4 |
Correct |
1314 ms |
52616 KB |
Output is correct |
5 |
Correct |
1465 ms |
52472 KB |
Output is correct |
6 |
Correct |
1500 ms |
52464 KB |
Output is correct |
7 |
Correct |
1553 ms |
52436 KB |
Output is correct |
8 |
Correct |
791 ms |
29708 KB |
Output is correct |
9 |
Correct |
957 ms |
29748 KB |
Output is correct |
10 |
Correct |
1478 ms |
52556 KB |
Output is correct |
11 |
Correct |
1399 ms |
52708 KB |
Output is correct |
12 |
Correct |
866 ms |
29764 KB |
Output is correct |
13 |
Correct |
815 ms |
29784 KB |
Output is correct |
14 |
Correct |
11 ms |
19024 KB |
Output is correct |
15 |
Correct |
11 ms |
19244 KB |
Output is correct |
16 |
Correct |
11 ms |
19280 KB |
Output is correct |
17 |
Correct |
119 ms |
52460 KB |
Output is correct |
18 |
Correct |
109 ms |
52468 KB |
Output is correct |
19 |
Correct |
91 ms |
52492 KB |
Output is correct |
20 |
Correct |
30 ms |
29724 KB |
Output is correct |
21 |
Correct |
80 ms |
52452 KB |
Output is correct |
22 |
Correct |
39 ms |
29408 KB |
Output is correct |
23 |
Correct |
44 ms |
29380 KB |
Output is correct |
24 |
Correct |
38 ms |
29380 KB |
Output is correct |
25 |
Correct |
30 ms |
29848 KB |
Output is correct |
26 |
Correct |
39 ms |
29516 KB |
Output is correct |
27 |
Correct |
11 ms |
19664 KB |
Output is correct |
28 |
Correct |
13 ms |
19604 KB |
Output is correct |
29 |
Correct |
14 ms |
19664 KB |
Output is correct |
30 |
Correct |
11 ms |
19280 KB |
Output is correct |
31 |
Correct |
12 ms |
19644 KB |
Output is correct |
32 |
Correct |
11 ms |
19260 KB |
Output is correct |
33 |
Correct |
11 ms |
19328 KB |
Output is correct |
34 |
Correct |
10 ms |
19280 KB |
Output is correct |
35 |
Correct |
11 ms |
19280 KB |
Output is correct |
36 |
Correct |
10 ms |
19280 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
289 ms |
21520 KB |
Output is correct |
2 |
Correct |
1018 ms |
29368 KB |
Output is correct |
3 |
Correct |
1339 ms |
29344 KB |
Output is correct |
4 |
Correct |
743 ms |
29380 KB |
Output is correct |
5 |
Correct |
796 ms |
29380 KB |
Output is correct |
6 |
Correct |
977 ms |
29368 KB |
Output is correct |
7 |
Correct |
837 ms |
29456 KB |
Output is correct |
8 |
Correct |
868 ms |
29764 KB |
Output is correct |
9 |
Correct |
791 ms |
29836 KB |
Output is correct |
10 |
Correct |
939 ms |
29600 KB |
Output is correct |
11 |
Correct |
606 ms |
29648 KB |
Output is correct |
12 |
Correct |
33 ms |
29348 KB |
Output is correct |
13 |
Correct |
36 ms |
29336 KB |
Output is correct |
14 |
Correct |
38 ms |
29464 KB |
Output is correct |
15 |
Correct |
40 ms |
29840 KB |
Output is correct |
16 |
Correct |
30 ms |
29472 KB |
Output is correct |
17 |
Correct |
42 ms |
29068 KB |
Output is correct |
18 |
Correct |
35 ms |
29348 KB |
Output is correct |
19 |
Correct |
32 ms |
29328 KB |
Output is correct |
20 |
Correct |
32 ms |
29340 KB |
Output is correct |
21 |
Correct |
34 ms |
29356 KB |
Output is correct |
22 |
Correct |
39 ms |
29344 KB |
Output is correct |
23 |
Correct |
45 ms |
29380 KB |
Output is correct |
24 |
Correct |
29 ms |
29640 KB |
Output is correct |
25 |
Correct |
29 ms |
29764 KB |
Output is correct |
26 |
Correct |
29 ms |
29480 KB |
Output is correct |
27 |
Correct |
38 ms |
29724 KB |
Output is correct |
28 |
Correct |
10 ms |
19280 KB |
Output is correct |
29 |
Correct |
13 ms |
19280 KB |
Output is correct |
30 |
Correct |
11 ms |
19280 KB |
Output is correct |
31 |
Correct |
10 ms |
19344 KB |
Output is correct |
32 |
Correct |
10 ms |
19324 KB |
Output is correct |
33 |
Correct |
10 ms |
19116 KB |
Output is correct |
34 |
Correct |
11 ms |
19280 KB |
Output is correct |
35 |
Correct |
11 ms |
19280 KB |
Output is correct |
36 |
Correct |
11 ms |
19280 KB |
Output is correct |
37 |
Correct |
11 ms |
19224 KB |
Output is correct |
38 |
Correct |
11 ms |
19280 KB |
Output is correct |
39 |
Correct |
10 ms |
19276 KB |
Output is correct |
40 |
Correct |
11 ms |
19260 KB |
Output is correct |
41 |
Correct |
10 ms |
19244 KB |
Output is correct |
42 |
Correct |
10 ms |
19328 KB |
Output is correct |
43 |
Correct |
11 ms |
19340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
19152 KB |
Output is correct |
2 |
Correct |
12 ms |
19664 KB |
Output is correct |
3 |
Correct |
13 ms |
19664 KB |
Output is correct |
4 |
Correct |
12 ms |
19664 KB |
Output is correct |
5 |
Correct |
13 ms |
19664 KB |
Output is correct |
6 |
Correct |
12 ms |
19592 KB |
Output is correct |
7 |
Correct |
11 ms |
19700 KB |
Output is correct |
8 |
Correct |
12 ms |
19252 KB |
Output is correct |
9 |
Correct |
13 ms |
19280 KB |
Output is correct |
10 |
Correct |
12 ms |
19664 KB |
Output is correct |
11 |
Correct |
12 ms |
19664 KB |
Output is correct |
12 |
Correct |
11 ms |
19124 KB |
Output is correct |
13 |
Correct |
11 ms |
19232 KB |
Output is correct |
14 |
Correct |
11 ms |
19260 KB |
Output is correct |
15 |
Correct |
12 ms |
19684 KB |
Output is correct |
16 |
Correct |
15 ms |
19672 KB |
Output is correct |
17 |
Correct |
12 ms |
19628 KB |
Output is correct |
18 |
Correct |
11 ms |
19244 KB |
Output is correct |
19 |
Correct |
12 ms |
19664 KB |
Output is correct |
20 |
Correct |
11 ms |
19312 KB |
Output is correct |
21 |
Correct |
13 ms |
19244 KB |
Output is correct |
22 |
Correct |
11 ms |
19280 KB |
Output is correct |
23 |
Correct |
13 ms |
19232 KB |
Output is correct |
24 |
Correct |
13 ms |
19336 KB |
Output is correct |
25 |
Correct |
12 ms |
19160 KB |
Output is correct |
26 |
Correct |
12 ms |
19280 KB |
Output is correct |
27 |
Correct |
12 ms |
19336 KB |
Output is correct |
28 |
Correct |
12 ms |
19248 KB |
Output is correct |
29 |
Correct |
12 ms |
19336 KB |
Output is correct |
30 |
Correct |
11 ms |
19280 KB |
Output is correct |
31 |
Correct |
14 ms |
19284 KB |
Output is correct |
32 |
Correct |
12 ms |
19280 KB |
Output is correct |
33 |
Correct |
14 ms |
19360 KB |
Output is correct |
34 |
Correct |
13 ms |
19292 KB |
Output is correct |
35 |
Correct |
11 ms |
19292 KB |
Output is correct |
36 |
Correct |
57 ms |
40532 KB |
Output is correct |
37 |
Correct |
89 ms |
52480 KB |
Output is correct |
38 |
Correct |
93 ms |
52540 KB |
Output is correct |
39 |
Correct |
93 ms |
52496 KB |
Output is correct |
40 |
Correct |
93 ms |
52468 KB |
Output is correct |
41 |
Correct |
93 ms |
52500 KB |
Output is correct |
42 |
Correct |
101 ms |
52468 KB |
Output is correct |
43 |
Correct |
41 ms |
29644 KB |
Output is correct |
44 |
Correct |
42 ms |
29844 KB |
Output is correct |
45 |
Correct |
87 ms |
52492 KB |
Output is correct |
46 |
Correct |
99 ms |
52756 KB |
Output is correct |
47 |
Correct |
91 ms |
52536 KB |
Output is correct |
48 |
Correct |
90 ms |
52488 KB |
Output is correct |
49 |
Correct |
110 ms |
52632 KB |
Output is correct |
50 |
Correct |
42 ms |
29860 KB |
Output is correct |
51 |
Correct |
85 ms |
52496 KB |
Output is correct |
52 |
Correct |
49 ms |
29416 KB |
Output is correct |
53 |
Correct |
47 ms |
29336 KB |
Output is correct |
54 |
Correct |
37 ms |
29364 KB |
Output is correct |
55 |
Correct |
32 ms |
29724 KB |
Output is correct |
56 |
Correct |
31 ms |
29584 KB |
Output is correct |
57 |
Correct |
35 ms |
29064 KB |
Output is correct |
58 |
Correct |
49 ms |
29348 KB |
Output is correct |
59 |
Correct |
42 ms |
29348 KB |
Output is correct |
60 |
Correct |
39 ms |
29312 KB |
Output is correct |
61 |
Correct |
39 ms |
29336 KB |
Output is correct |
62 |
Correct |
31 ms |
29324 KB |
Output is correct |
63 |
Correct |
43 ms |
29344 KB |
Output is correct |
64 |
Correct |
37 ms |
29604 KB |
Output is correct |
65 |
Correct |
28 ms |
29764 KB |
Output is correct |
66 |
Correct |
38 ms |
29528 KB |
Output is correct |
67 |
Correct |
28 ms |
29708 KB |
Output is correct |
68 |
Correct |
1201 ms |
52280 KB |
Output is correct |
69 |
Correct |
1382 ms |
52456 KB |
Output is correct |
70 |
Correct |
1109 ms |
52480 KB |
Output is correct |
71 |
Correct |
1314 ms |
52616 KB |
Output is correct |
72 |
Correct |
1465 ms |
52472 KB |
Output is correct |
73 |
Correct |
1500 ms |
52464 KB |
Output is correct |
74 |
Correct |
1553 ms |
52436 KB |
Output is correct |
75 |
Correct |
791 ms |
29708 KB |
Output is correct |
76 |
Correct |
957 ms |
29748 KB |
Output is correct |
77 |
Correct |
1478 ms |
52556 KB |
Output is correct |
78 |
Correct |
1399 ms |
52708 KB |
Output is correct |
79 |
Correct |
866 ms |
29764 KB |
Output is correct |
80 |
Correct |
815 ms |
29784 KB |
Output is correct |
81 |
Correct |
11 ms |
19024 KB |
Output is correct |
82 |
Correct |
11 ms |
19244 KB |
Output is correct |
83 |
Correct |
11 ms |
19280 KB |
Output is correct |
84 |
Correct |
119 ms |
52460 KB |
Output is correct |
85 |
Correct |
109 ms |
52468 KB |
Output is correct |
86 |
Correct |
91 ms |
52492 KB |
Output is correct |
87 |
Correct |
30 ms |
29724 KB |
Output is correct |
88 |
Correct |
80 ms |
52452 KB |
Output is correct |
89 |
Correct |
39 ms |
29408 KB |
Output is correct |
90 |
Correct |
44 ms |
29380 KB |
Output is correct |
91 |
Correct |
38 ms |
29380 KB |
Output is correct |
92 |
Correct |
30 ms |
29848 KB |
Output is correct |
93 |
Correct |
39 ms |
29516 KB |
Output is correct |
94 |
Correct |
11 ms |
19664 KB |
Output is correct |
95 |
Correct |
13 ms |
19604 KB |
Output is correct |
96 |
Correct |
14 ms |
19664 KB |
Output is correct |
97 |
Correct |
11 ms |
19280 KB |
Output is correct |
98 |
Correct |
12 ms |
19644 KB |
Output is correct |
99 |
Correct |
11 ms |
19260 KB |
Output is correct |
100 |
Correct |
11 ms |
19328 KB |
Output is correct |
101 |
Correct |
10 ms |
19280 KB |
Output is correct |
102 |
Correct |
11 ms |
19280 KB |
Output is correct |
103 |
Correct |
10 ms |
19280 KB |
Output is correct |
104 |
Correct |
1072 ms |
48620 KB |
Output is correct |
105 |
Correct |
1248 ms |
52536 KB |
Output is correct |
106 |
Correct |
1304 ms |
52500 KB |
Output is correct |
107 |
Correct |
1117 ms |
52512 KB |
Output is correct |
108 |
Correct |
1164 ms |
52464 KB |
Output is correct |
109 |
Correct |
1144 ms |
52480 KB |
Output is correct |
110 |
Correct |
1186 ms |
52496 KB |
Output is correct |
111 |
Correct |
828 ms |
29640 KB |
Output is correct |
112 |
Correct |
827 ms |
29764 KB |
Output is correct |
113 |
Correct |
1268 ms |
52500 KB |
Output is correct |
114 |
Correct |
1160 ms |
52664 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
526 ms |
25292 KB |
Output is correct |
2 |
Correct |
783 ms |
29580 KB |
Output is correct |
3 |
Correct |
864 ms |
29548 KB |
Output is correct |
4 |
Correct |
879 ms |
29712 KB |
Output is correct |
5 |
Correct |
676 ms |
29820 KB |
Output is correct |
6 |
Correct |
768 ms |
29740 KB |
Output is correct |
7 |
Correct |
871 ms |
29912 KB |
Output is correct |
8 |
Correct |
13 ms |
19132 KB |
Output is correct |
9 |
Correct |
12 ms |
19280 KB |
Output is correct |
10 |
Correct |
11 ms |
19340 KB |
Output is correct |
11 |
Correct |
11 ms |
19152 KB |
Output is correct |
12 |
Correct |
12 ms |
19664 KB |
Output is correct |
13 |
Correct |
13 ms |
19664 KB |
Output is correct |
14 |
Correct |
12 ms |
19664 KB |
Output is correct |
15 |
Correct |
13 ms |
19664 KB |
Output is correct |
16 |
Correct |
12 ms |
19592 KB |
Output is correct |
17 |
Correct |
11 ms |
19700 KB |
Output is correct |
18 |
Correct |
12 ms |
19252 KB |
Output is correct |
19 |
Correct |
13 ms |
19280 KB |
Output is correct |
20 |
Correct |
12 ms |
19664 KB |
Output is correct |
21 |
Correct |
12 ms |
19664 KB |
Output is correct |
22 |
Correct |
11 ms |
19124 KB |
Output is correct |
23 |
Correct |
11 ms |
19232 KB |
Output is correct |
24 |
Correct |
11 ms |
19260 KB |
Output is correct |
25 |
Correct |
12 ms |
19684 KB |
Output is correct |
26 |
Correct |
15 ms |
19672 KB |
Output is correct |
27 |
Correct |
12 ms |
19628 KB |
Output is correct |
28 |
Correct |
11 ms |
19244 KB |
Output is correct |
29 |
Correct |
12 ms |
19664 KB |
Output is correct |
30 |
Correct |
11 ms |
19312 KB |
Output is correct |
31 |
Correct |
13 ms |
19244 KB |
Output is correct |
32 |
Correct |
11 ms |
19280 KB |
Output is correct |
33 |
Correct |
13 ms |
19232 KB |
Output is correct |
34 |
Correct |
13 ms |
19336 KB |
Output is correct |
35 |
Correct |
12 ms |
19160 KB |
Output is correct |
36 |
Correct |
12 ms |
19280 KB |
Output is correct |
37 |
Correct |
12 ms |
19336 KB |
Output is correct |
38 |
Correct |
12 ms |
19248 KB |
Output is correct |
39 |
Correct |
12 ms |
19336 KB |
Output is correct |
40 |
Correct |
11 ms |
19280 KB |
Output is correct |
41 |
Correct |
14 ms |
19284 KB |
Output is correct |
42 |
Correct |
12 ms |
19280 KB |
Output is correct |
43 |
Correct |
14 ms |
19360 KB |
Output is correct |
44 |
Correct |
13 ms |
19292 KB |
Output is correct |
45 |
Correct |
11 ms |
19292 KB |
Output is correct |
46 |
Correct |
57 ms |
40532 KB |
Output is correct |
47 |
Correct |
89 ms |
52480 KB |
Output is correct |
48 |
Correct |
93 ms |
52540 KB |
Output is correct |
49 |
Correct |
93 ms |
52496 KB |
Output is correct |
50 |
Correct |
93 ms |
52468 KB |
Output is correct |
51 |
Correct |
93 ms |
52500 KB |
Output is correct |
52 |
Correct |
101 ms |
52468 KB |
Output is correct |
53 |
Correct |
41 ms |
29644 KB |
Output is correct |
54 |
Correct |
42 ms |
29844 KB |
Output is correct |
55 |
Correct |
87 ms |
52492 KB |
Output is correct |
56 |
Correct |
99 ms |
52756 KB |
Output is correct |
57 |
Correct |
91 ms |
52536 KB |
Output is correct |
58 |
Correct |
90 ms |
52488 KB |
Output is correct |
59 |
Correct |
110 ms |
52632 KB |
Output is correct |
60 |
Correct |
42 ms |
29860 KB |
Output is correct |
61 |
Correct |
85 ms |
52496 KB |
Output is correct |
62 |
Correct |
49 ms |
29416 KB |
Output is correct |
63 |
Correct |
47 ms |
29336 KB |
Output is correct |
64 |
Correct |
37 ms |
29364 KB |
Output is correct |
65 |
Correct |
32 ms |
29724 KB |
Output is correct |
66 |
Correct |
31 ms |
29584 KB |
Output is correct |
67 |
Correct |
35 ms |
29064 KB |
Output is correct |
68 |
Correct |
49 ms |
29348 KB |
Output is correct |
69 |
Correct |
42 ms |
29348 KB |
Output is correct |
70 |
Correct |
39 ms |
29312 KB |
Output is correct |
71 |
Correct |
39 ms |
29336 KB |
Output is correct |
72 |
Correct |
31 ms |
29324 KB |
Output is correct |
73 |
Correct |
43 ms |
29344 KB |
Output is correct |
74 |
Correct |
37 ms |
29604 KB |
Output is correct |
75 |
Correct |
28 ms |
29764 KB |
Output is correct |
76 |
Correct |
38 ms |
29528 KB |
Output is correct |
77 |
Correct |
28 ms |
29708 KB |
Output is correct |
78 |
Correct |
1201 ms |
52280 KB |
Output is correct |
79 |
Correct |
1382 ms |
52456 KB |
Output is correct |
80 |
Correct |
1109 ms |
52480 KB |
Output is correct |
81 |
Correct |
1314 ms |
52616 KB |
Output is correct |
82 |
Correct |
1465 ms |
52472 KB |
Output is correct |
83 |
Correct |
1500 ms |
52464 KB |
Output is correct |
84 |
Correct |
1553 ms |
52436 KB |
Output is correct |
85 |
Correct |
791 ms |
29708 KB |
Output is correct |
86 |
Correct |
957 ms |
29748 KB |
Output is correct |
87 |
Correct |
1478 ms |
52556 KB |
Output is correct |
88 |
Correct |
1399 ms |
52708 KB |
Output is correct |
89 |
Correct |
866 ms |
29764 KB |
Output is correct |
90 |
Correct |
815 ms |
29784 KB |
Output is correct |
91 |
Correct |
11 ms |
19024 KB |
Output is correct |
92 |
Correct |
11 ms |
19244 KB |
Output is correct |
93 |
Correct |
11 ms |
19280 KB |
Output is correct |
94 |
Correct |
119 ms |
52460 KB |
Output is correct |
95 |
Correct |
109 ms |
52468 KB |
Output is correct |
96 |
Correct |
91 ms |
52492 KB |
Output is correct |
97 |
Correct |
30 ms |
29724 KB |
Output is correct |
98 |
Correct |
80 ms |
52452 KB |
Output is correct |
99 |
Correct |
39 ms |
29408 KB |
Output is correct |
100 |
Correct |
44 ms |
29380 KB |
Output is correct |
101 |
Correct |
38 ms |
29380 KB |
Output is correct |
102 |
Correct |
30 ms |
29848 KB |
Output is correct |
103 |
Correct |
39 ms |
29516 KB |
Output is correct |
104 |
Correct |
11 ms |
19664 KB |
Output is correct |
105 |
Correct |
13 ms |
19604 KB |
Output is correct |
106 |
Correct |
14 ms |
19664 KB |
Output is correct |
107 |
Correct |
11 ms |
19280 KB |
Output is correct |
108 |
Correct |
12 ms |
19644 KB |
Output is correct |
109 |
Correct |
11 ms |
19260 KB |
Output is correct |
110 |
Correct |
11 ms |
19328 KB |
Output is correct |
111 |
Correct |
10 ms |
19280 KB |
Output is correct |
112 |
Correct |
11 ms |
19280 KB |
Output is correct |
113 |
Correct |
10 ms |
19280 KB |
Output is correct |
114 |
Correct |
289 ms |
21520 KB |
Output is correct |
115 |
Correct |
1018 ms |
29368 KB |
Output is correct |
116 |
Correct |
1339 ms |
29344 KB |
Output is correct |
117 |
Correct |
743 ms |
29380 KB |
Output is correct |
118 |
Correct |
796 ms |
29380 KB |
Output is correct |
119 |
Correct |
977 ms |
29368 KB |
Output is correct |
120 |
Correct |
837 ms |
29456 KB |
Output is correct |
121 |
Correct |
868 ms |
29764 KB |
Output is correct |
122 |
Correct |
791 ms |
29836 KB |
Output is correct |
123 |
Correct |
939 ms |
29600 KB |
Output is correct |
124 |
Correct |
606 ms |
29648 KB |
Output is correct |
125 |
Correct |
33 ms |
29348 KB |
Output is correct |
126 |
Correct |
36 ms |
29336 KB |
Output is correct |
127 |
Correct |
38 ms |
29464 KB |
Output is correct |
128 |
Correct |
40 ms |
29840 KB |
Output is correct |
129 |
Correct |
30 ms |
29472 KB |
Output is correct |
130 |
Correct |
42 ms |
29068 KB |
Output is correct |
131 |
Correct |
35 ms |
29348 KB |
Output is correct |
132 |
Correct |
32 ms |
29328 KB |
Output is correct |
133 |
Correct |
32 ms |
29340 KB |
Output is correct |
134 |
Correct |
34 ms |
29356 KB |
Output is correct |
135 |
Correct |
39 ms |
29344 KB |
Output is correct |
136 |
Correct |
45 ms |
29380 KB |
Output is correct |
137 |
Correct |
29 ms |
29640 KB |
Output is correct |
138 |
Correct |
29 ms |
29764 KB |
Output is correct |
139 |
Correct |
29 ms |
29480 KB |
Output is correct |
140 |
Correct |
38 ms |
29724 KB |
Output is correct |
141 |
Correct |
10 ms |
19280 KB |
Output is correct |
142 |
Correct |
13 ms |
19280 KB |
Output is correct |
143 |
Correct |
11 ms |
19280 KB |
Output is correct |
144 |
Correct |
10 ms |
19344 KB |
Output is correct |
145 |
Correct |
10 ms |
19324 KB |
Output is correct |
146 |
Correct |
10 ms |
19116 KB |
Output is correct |
147 |
Correct |
11 ms |
19280 KB |
Output is correct |
148 |
Correct |
11 ms |
19280 KB |
Output is correct |
149 |
Correct |
11 ms |
19280 KB |
Output is correct |
150 |
Correct |
11 ms |
19224 KB |
Output is correct |
151 |
Correct |
11 ms |
19280 KB |
Output is correct |
152 |
Correct |
10 ms |
19276 KB |
Output is correct |
153 |
Correct |
11 ms |
19260 KB |
Output is correct |
154 |
Correct |
10 ms |
19244 KB |
Output is correct |
155 |
Correct |
10 ms |
19328 KB |
Output is correct |
156 |
Correct |
11 ms |
19340 KB |
Output is correct |
157 |
Correct |
1072 ms |
48620 KB |
Output is correct |
158 |
Correct |
1248 ms |
52536 KB |
Output is correct |
159 |
Correct |
1304 ms |
52500 KB |
Output is correct |
160 |
Correct |
1117 ms |
52512 KB |
Output is correct |
161 |
Correct |
1164 ms |
52464 KB |
Output is correct |
162 |
Correct |
1144 ms |
52480 KB |
Output is correct |
163 |
Correct |
1186 ms |
52496 KB |
Output is correct |
164 |
Correct |
828 ms |
29640 KB |
Output is correct |
165 |
Correct |
827 ms |
29764 KB |
Output is correct |
166 |
Correct |
1268 ms |
52500 KB |
Output is correct |
167 |
Correct |
1160 ms |
52664 KB |
Output is correct |
168 |
Correct |
10 ms |
19024 KB |
Output is correct |
169 |
Incorrect |
792 ms |
30060 KB |
2nd lines differ - on the 1st token, expected: '128', found: '1529' |
170 |
Halted |
0 ms |
0 KB |
- |