#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 ans = 0;
for (int i = L ; i <= R ; ++i)
{
if ((a[i] < L || b[i] >= D) && (c[i] > R || d[i] >= D))
{
ans++;
}
}
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 |
435 ms |
25132 KB |
Output is correct |
2 |
Correct |
861 ms |
29568 KB |
Output is correct |
3 |
Correct |
714 ms |
29608 KB |
Output is correct |
4 |
Correct |
906 ms |
29640 KB |
Output is correct |
5 |
Correct |
737 ms |
29728 KB |
Output is correct |
6 |
Correct |
908 ms |
29640 KB |
Output is correct |
7 |
Correct |
819 ms |
29764 KB |
Output is correct |
8 |
Correct |
11 ms |
19024 KB |
Output is correct |
9 |
Correct |
10 ms |
19280 KB |
Output is correct |
10 |
Correct |
12 ms |
19280 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
19176 KB |
Output is correct |
2 |
Correct |
11 ms |
19664 KB |
Output is correct |
3 |
Correct |
12 ms |
19720 KB |
Output is correct |
4 |
Correct |
11 ms |
19664 KB |
Output is correct |
5 |
Correct |
11 ms |
19664 KB |
Output is correct |
6 |
Correct |
12 ms |
19840 KB |
Output is correct |
7 |
Correct |
11 ms |
19660 KB |
Output is correct |
8 |
Correct |
10 ms |
19280 KB |
Output is correct |
9 |
Correct |
11 ms |
19280 KB |
Output is correct |
10 |
Correct |
11 ms |
19664 KB |
Output is correct |
11 |
Correct |
11 ms |
19680 KB |
Output is correct |
12 |
Correct |
11 ms |
19124 KB |
Output is correct |
13 |
Correct |
11 ms |
19280 KB |
Output is correct |
14 |
Correct |
10 ms |
19280 KB |
Output is correct |
15 |
Correct |
12 ms |
19688 KB |
Output is correct |
16 |
Correct |
11 ms |
19596 KB |
Output is correct |
17 |
Correct |
11 ms |
19688 KB |
Output is correct |
18 |
Correct |
11 ms |
19288 KB |
Output is correct |
19 |
Correct |
10 ms |
19664 KB |
Output is correct |
20 |
Correct |
10 ms |
19280 KB |
Output is correct |
21 |
Correct |
10 ms |
19280 KB |
Output is correct |
22 |
Correct |
10 ms |
19280 KB |
Output is correct |
23 |
Correct |
10 ms |
19272 KB |
Output is correct |
24 |
Correct |
11 ms |
19280 KB |
Output is correct |
25 |
Correct |
10 ms |
19152 KB |
Output is correct |
26 |
Correct |
12 ms |
19216 KB |
Output is correct |
27 |
Correct |
11 ms |
19308 KB |
Output is correct |
28 |
Correct |
14 ms |
19248 KB |
Output is correct |
29 |
Correct |
11 ms |
19248 KB |
Output is correct |
30 |
Correct |
12 ms |
19408 KB |
Output is correct |
31 |
Correct |
11 ms |
19280 KB |
Output is correct |
32 |
Correct |
10 ms |
19300 KB |
Output is correct |
33 |
Correct |
10 ms |
19228 KB |
Output is correct |
34 |
Correct |
11 ms |
19252 KB |
Output is correct |
35 |
Correct |
13 ms |
19248 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
19176 KB |
Output is correct |
2 |
Correct |
11 ms |
19664 KB |
Output is correct |
3 |
Correct |
12 ms |
19720 KB |
Output is correct |
4 |
Correct |
11 ms |
19664 KB |
Output is correct |
5 |
Correct |
11 ms |
19664 KB |
Output is correct |
6 |
Correct |
12 ms |
19840 KB |
Output is correct |
7 |
Correct |
11 ms |
19660 KB |
Output is correct |
8 |
Correct |
10 ms |
19280 KB |
Output is correct |
9 |
Correct |
11 ms |
19280 KB |
Output is correct |
10 |
Correct |
11 ms |
19664 KB |
Output is correct |
11 |
Correct |
11 ms |
19680 KB |
Output is correct |
12 |
Correct |
11 ms |
19124 KB |
Output is correct |
13 |
Correct |
11 ms |
19280 KB |
Output is correct |
14 |
Correct |
10 ms |
19280 KB |
Output is correct |
15 |
Correct |
12 ms |
19688 KB |
Output is correct |
16 |
Correct |
11 ms |
19596 KB |
Output is correct |
17 |
Correct |
11 ms |
19688 KB |
Output is correct |
18 |
Correct |
11 ms |
19288 KB |
Output is correct |
19 |
Correct |
10 ms |
19664 KB |
Output is correct |
20 |
Correct |
10 ms |
19280 KB |
Output is correct |
21 |
Correct |
10 ms |
19280 KB |
Output is correct |
22 |
Correct |
10 ms |
19280 KB |
Output is correct |
23 |
Correct |
10 ms |
19272 KB |
Output is correct |
24 |
Correct |
11 ms |
19280 KB |
Output is correct |
25 |
Correct |
10 ms |
19152 KB |
Output is correct |
26 |
Correct |
12 ms |
19216 KB |
Output is correct |
27 |
Correct |
11 ms |
19308 KB |
Output is correct |
28 |
Correct |
14 ms |
19248 KB |
Output is correct |
29 |
Correct |
11 ms |
19248 KB |
Output is correct |
30 |
Correct |
12 ms |
19408 KB |
Output is correct |
31 |
Correct |
11 ms |
19280 KB |
Output is correct |
32 |
Correct |
10 ms |
19300 KB |
Output is correct |
33 |
Correct |
10 ms |
19228 KB |
Output is correct |
34 |
Correct |
11 ms |
19252 KB |
Output is correct |
35 |
Correct |
13 ms |
19248 KB |
Output is correct |
36 |
Correct |
56 ms |
40460 KB |
Output is correct |
37 |
Correct |
87 ms |
52492 KB |
Output is correct |
38 |
Correct |
82 ms |
52496 KB |
Output is correct |
39 |
Correct |
80 ms |
52488 KB |
Output is correct |
40 |
Correct |
82 ms |
52508 KB |
Output is correct |
41 |
Correct |
93 ms |
52408 KB |
Output is correct |
42 |
Correct |
80 ms |
52500 KB |
Output is correct |
43 |
Correct |
28 ms |
29724 KB |
Output is correct |
44 |
Correct |
28 ms |
29792 KB |
Output is correct |
45 |
Correct |
82 ms |
52472 KB |
Output is correct |
46 |
Correct |
81 ms |
52676 KB |
Output is correct |
47 |
Correct |
83 ms |
52536 KB |
Output is correct |
48 |
Correct |
86 ms |
52484 KB |
Output is correct |
49 |
Correct |
83 ms |
52480 KB |
Output is correct |
50 |
Correct |
39 ms |
29848 KB |
Output is correct |
51 |
Correct |
73 ms |
52532 KB |
Output is correct |
52 |
Correct |
33 ms |
29324 KB |
Output is correct |
53 |
Correct |
32 ms |
29344 KB |
Output is correct |
54 |
Correct |
33 ms |
29328 KB |
Output is correct |
55 |
Correct |
40 ms |
29952 KB |
Output is correct |
56 |
Correct |
29 ms |
29592 KB |
Output is correct |
57 |
Correct |
32 ms |
29064 KB |
Output is correct |
58 |
Correct |
33 ms |
29328 KB |
Output is correct |
59 |
Correct |
34 ms |
29344 KB |
Output is correct |
60 |
Correct |
37 ms |
29448 KB |
Output is correct |
61 |
Correct |
34 ms |
29324 KB |
Output is correct |
62 |
Correct |
33 ms |
29340 KB |
Output is correct |
63 |
Correct |
33 ms |
29328 KB |
Output is correct |
64 |
Correct |
30 ms |
29760 KB |
Output is correct |
65 |
Correct |
29 ms |
29832 KB |
Output is correct |
66 |
Correct |
29 ms |
29508 KB |
Output is correct |
67 |
Correct |
28 ms |
29716 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1053 ms |
52312 KB |
Output is correct |
2 |
Correct |
1223 ms |
52488 KB |
Output is correct |
3 |
Correct |
1330 ms |
52476 KB |
Output is correct |
4 |
Correct |
1293 ms |
52532 KB |
Output is correct |
5 |
Correct |
915 ms |
52424 KB |
Output is correct |
6 |
Correct |
1274 ms |
52532 KB |
Output is correct |
7 |
Correct |
1260 ms |
52472 KB |
Output is correct |
8 |
Correct |
1147 ms |
29720 KB |
Output is correct |
9 |
Correct |
875 ms |
29856 KB |
Output is correct |
10 |
Correct |
1390 ms |
52664 KB |
Output is correct |
11 |
Correct |
1123 ms |
52672 KB |
Output is correct |
12 |
Correct |
826 ms |
29648 KB |
Output is correct |
13 |
Correct |
949 ms |
29840 KB |
Output is correct |
14 |
Correct |
15 ms |
19136 KB |
Output is correct |
15 |
Correct |
15 ms |
19280 KB |
Output is correct |
16 |
Correct |
14 ms |
19280 KB |
Output is correct |
17 |
Correct |
102 ms |
52456 KB |
Output is correct |
18 |
Correct |
94 ms |
52452 KB |
Output is correct |
19 |
Correct |
90 ms |
52464 KB |
Output is correct |
20 |
Correct |
36 ms |
29788 KB |
Output is correct |
21 |
Correct |
93 ms |
52472 KB |
Output is correct |
22 |
Correct |
42 ms |
29388 KB |
Output is correct |
23 |
Correct |
38 ms |
29328 KB |
Output is correct |
24 |
Correct |
37 ms |
29308 KB |
Output is correct |
25 |
Correct |
37 ms |
29844 KB |
Output is correct |
26 |
Correct |
35 ms |
29476 KB |
Output is correct |
27 |
Correct |
14 ms |
19688 KB |
Output is correct |
28 |
Correct |
13 ms |
19604 KB |
Output is correct |
29 |
Correct |
13 ms |
19616 KB |
Output is correct |
30 |
Correct |
12 ms |
19348 KB |
Output is correct |
31 |
Correct |
14 ms |
19664 KB |
Output is correct |
32 |
Correct |
12 ms |
19280 KB |
Output is correct |
33 |
Correct |
12 ms |
19232 KB |
Output is correct |
34 |
Correct |
12 ms |
19280 KB |
Output is correct |
35 |
Correct |
13 ms |
19256 KB |
Output is correct |
36 |
Correct |
12 ms |
19256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
381 ms |
21492 KB |
Output is correct |
2 |
Correct |
925 ms |
29344 KB |
Output is correct |
3 |
Correct |
1067 ms |
29440 KB |
Output is correct |
4 |
Correct |
471 ms |
29332 KB |
Output is correct |
5 |
Correct |
917 ms |
29348 KB |
Output is correct |
6 |
Correct |
721 ms |
29312 KB |
Output is correct |
7 |
Correct |
874 ms |
29348 KB |
Output is correct |
8 |
Correct |
721 ms |
29608 KB |
Output is correct |
9 |
Correct |
968 ms |
29832 KB |
Output is correct |
10 |
Correct |
648 ms |
29508 KB |
Output is correct |
11 |
Correct |
886 ms |
29660 KB |
Output is correct |
12 |
Correct |
36 ms |
29324 KB |
Output is correct |
13 |
Correct |
46 ms |
29360 KB |
Output is correct |
14 |
Correct |
53 ms |
29336 KB |
Output is correct |
15 |
Correct |
34 ms |
29832 KB |
Output is correct |
16 |
Correct |
44 ms |
29600 KB |
Output is correct |
17 |
Correct |
47 ms |
29064 KB |
Output is correct |
18 |
Correct |
41 ms |
29324 KB |
Output is correct |
19 |
Correct |
48 ms |
29368 KB |
Output is correct |
20 |
Correct |
36 ms |
29376 KB |
Output is correct |
21 |
Correct |
43 ms |
29340 KB |
Output is correct |
22 |
Correct |
34 ms |
29428 KB |
Output is correct |
23 |
Correct |
36 ms |
29388 KB |
Output is correct |
24 |
Correct |
41 ms |
29712 KB |
Output is correct |
25 |
Correct |
44 ms |
29848 KB |
Output is correct |
26 |
Correct |
35 ms |
29456 KB |
Output is correct |
27 |
Correct |
34 ms |
29752 KB |
Output is correct |
28 |
Correct |
11 ms |
19280 KB |
Output is correct |
29 |
Correct |
12 ms |
19280 KB |
Output is correct |
30 |
Correct |
11 ms |
19280 KB |
Output is correct |
31 |
Correct |
10 ms |
19280 KB |
Output is correct |
32 |
Correct |
11 ms |
19280 KB |
Output is correct |
33 |
Correct |
11 ms |
19148 KB |
Output is correct |
34 |
Correct |
11 ms |
19224 KB |
Output is correct |
35 |
Correct |
11 ms |
19280 KB |
Output is correct |
36 |
Correct |
12 ms |
19272 KB |
Output is correct |
37 |
Correct |
12 ms |
19280 KB |
Output is correct |
38 |
Correct |
11 ms |
19276 KB |
Output is correct |
39 |
Correct |
14 ms |
19244 KB |
Output is correct |
40 |
Correct |
11 ms |
19220 KB |
Output is correct |
41 |
Correct |
14 ms |
19332 KB |
Output is correct |
42 |
Correct |
11 ms |
19348 KB |
Output is correct |
43 |
Correct |
12 ms |
19236 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
19176 KB |
Output is correct |
2 |
Correct |
11 ms |
19664 KB |
Output is correct |
3 |
Correct |
12 ms |
19720 KB |
Output is correct |
4 |
Correct |
11 ms |
19664 KB |
Output is correct |
5 |
Correct |
11 ms |
19664 KB |
Output is correct |
6 |
Correct |
12 ms |
19840 KB |
Output is correct |
7 |
Correct |
11 ms |
19660 KB |
Output is correct |
8 |
Correct |
10 ms |
19280 KB |
Output is correct |
9 |
Correct |
11 ms |
19280 KB |
Output is correct |
10 |
Correct |
11 ms |
19664 KB |
Output is correct |
11 |
Correct |
11 ms |
19680 KB |
Output is correct |
12 |
Correct |
11 ms |
19124 KB |
Output is correct |
13 |
Correct |
11 ms |
19280 KB |
Output is correct |
14 |
Correct |
10 ms |
19280 KB |
Output is correct |
15 |
Correct |
12 ms |
19688 KB |
Output is correct |
16 |
Correct |
11 ms |
19596 KB |
Output is correct |
17 |
Correct |
11 ms |
19688 KB |
Output is correct |
18 |
Correct |
11 ms |
19288 KB |
Output is correct |
19 |
Correct |
10 ms |
19664 KB |
Output is correct |
20 |
Correct |
10 ms |
19280 KB |
Output is correct |
21 |
Correct |
10 ms |
19280 KB |
Output is correct |
22 |
Correct |
10 ms |
19280 KB |
Output is correct |
23 |
Correct |
10 ms |
19272 KB |
Output is correct |
24 |
Correct |
11 ms |
19280 KB |
Output is correct |
25 |
Correct |
10 ms |
19152 KB |
Output is correct |
26 |
Correct |
12 ms |
19216 KB |
Output is correct |
27 |
Correct |
11 ms |
19308 KB |
Output is correct |
28 |
Correct |
14 ms |
19248 KB |
Output is correct |
29 |
Correct |
11 ms |
19248 KB |
Output is correct |
30 |
Correct |
12 ms |
19408 KB |
Output is correct |
31 |
Correct |
11 ms |
19280 KB |
Output is correct |
32 |
Correct |
10 ms |
19300 KB |
Output is correct |
33 |
Correct |
10 ms |
19228 KB |
Output is correct |
34 |
Correct |
11 ms |
19252 KB |
Output is correct |
35 |
Correct |
13 ms |
19248 KB |
Output is correct |
36 |
Correct |
56 ms |
40460 KB |
Output is correct |
37 |
Correct |
87 ms |
52492 KB |
Output is correct |
38 |
Correct |
82 ms |
52496 KB |
Output is correct |
39 |
Correct |
80 ms |
52488 KB |
Output is correct |
40 |
Correct |
82 ms |
52508 KB |
Output is correct |
41 |
Correct |
93 ms |
52408 KB |
Output is correct |
42 |
Correct |
80 ms |
52500 KB |
Output is correct |
43 |
Correct |
28 ms |
29724 KB |
Output is correct |
44 |
Correct |
28 ms |
29792 KB |
Output is correct |
45 |
Correct |
82 ms |
52472 KB |
Output is correct |
46 |
Correct |
81 ms |
52676 KB |
Output is correct |
47 |
Correct |
83 ms |
52536 KB |
Output is correct |
48 |
Correct |
86 ms |
52484 KB |
Output is correct |
49 |
Correct |
83 ms |
52480 KB |
Output is correct |
50 |
Correct |
39 ms |
29848 KB |
Output is correct |
51 |
Correct |
73 ms |
52532 KB |
Output is correct |
52 |
Correct |
33 ms |
29324 KB |
Output is correct |
53 |
Correct |
32 ms |
29344 KB |
Output is correct |
54 |
Correct |
33 ms |
29328 KB |
Output is correct |
55 |
Correct |
40 ms |
29952 KB |
Output is correct |
56 |
Correct |
29 ms |
29592 KB |
Output is correct |
57 |
Correct |
32 ms |
29064 KB |
Output is correct |
58 |
Correct |
33 ms |
29328 KB |
Output is correct |
59 |
Correct |
34 ms |
29344 KB |
Output is correct |
60 |
Correct |
37 ms |
29448 KB |
Output is correct |
61 |
Correct |
34 ms |
29324 KB |
Output is correct |
62 |
Correct |
33 ms |
29340 KB |
Output is correct |
63 |
Correct |
33 ms |
29328 KB |
Output is correct |
64 |
Correct |
30 ms |
29760 KB |
Output is correct |
65 |
Correct |
29 ms |
29832 KB |
Output is correct |
66 |
Correct |
29 ms |
29508 KB |
Output is correct |
67 |
Correct |
28 ms |
29716 KB |
Output is correct |
68 |
Correct |
1053 ms |
52312 KB |
Output is correct |
69 |
Correct |
1223 ms |
52488 KB |
Output is correct |
70 |
Correct |
1330 ms |
52476 KB |
Output is correct |
71 |
Correct |
1293 ms |
52532 KB |
Output is correct |
72 |
Correct |
915 ms |
52424 KB |
Output is correct |
73 |
Correct |
1274 ms |
52532 KB |
Output is correct |
74 |
Correct |
1260 ms |
52472 KB |
Output is correct |
75 |
Correct |
1147 ms |
29720 KB |
Output is correct |
76 |
Correct |
875 ms |
29856 KB |
Output is correct |
77 |
Correct |
1390 ms |
52664 KB |
Output is correct |
78 |
Correct |
1123 ms |
52672 KB |
Output is correct |
79 |
Correct |
826 ms |
29648 KB |
Output is correct |
80 |
Correct |
949 ms |
29840 KB |
Output is correct |
81 |
Correct |
15 ms |
19136 KB |
Output is correct |
82 |
Correct |
15 ms |
19280 KB |
Output is correct |
83 |
Correct |
14 ms |
19280 KB |
Output is correct |
84 |
Correct |
102 ms |
52456 KB |
Output is correct |
85 |
Correct |
94 ms |
52452 KB |
Output is correct |
86 |
Correct |
90 ms |
52464 KB |
Output is correct |
87 |
Correct |
36 ms |
29788 KB |
Output is correct |
88 |
Correct |
93 ms |
52472 KB |
Output is correct |
89 |
Correct |
42 ms |
29388 KB |
Output is correct |
90 |
Correct |
38 ms |
29328 KB |
Output is correct |
91 |
Correct |
37 ms |
29308 KB |
Output is correct |
92 |
Correct |
37 ms |
29844 KB |
Output is correct |
93 |
Correct |
35 ms |
29476 KB |
Output is correct |
94 |
Correct |
14 ms |
19688 KB |
Output is correct |
95 |
Correct |
13 ms |
19604 KB |
Output is correct |
96 |
Correct |
13 ms |
19616 KB |
Output is correct |
97 |
Correct |
12 ms |
19348 KB |
Output is correct |
98 |
Correct |
14 ms |
19664 KB |
Output is correct |
99 |
Correct |
12 ms |
19280 KB |
Output is correct |
100 |
Correct |
12 ms |
19232 KB |
Output is correct |
101 |
Correct |
12 ms |
19280 KB |
Output is correct |
102 |
Correct |
13 ms |
19256 KB |
Output is correct |
103 |
Correct |
12 ms |
19256 KB |
Output is correct |
104 |
Correct |
1076 ms |
48804 KB |
Output is correct |
105 |
Correct |
1364 ms |
52484 KB |
Output is correct |
106 |
Correct |
1407 ms |
52608 KB |
Output is correct |
107 |
Correct |
1514 ms |
52684 KB |
Output is correct |
108 |
Correct |
1472 ms |
52552 KB |
Output is correct |
109 |
Correct |
1299 ms |
52480 KB |
Output is correct |
110 |
Correct |
1616 ms |
52484 KB |
Output is correct |
111 |
Correct |
1064 ms |
29688 KB |
Output is correct |
112 |
Correct |
602 ms |
29772 KB |
Output is correct |
113 |
Correct |
1525 ms |
52520 KB |
Output is correct |
114 |
Correct |
1405 ms |
52628 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
435 ms |
25132 KB |
Output is correct |
2 |
Correct |
861 ms |
29568 KB |
Output is correct |
3 |
Correct |
714 ms |
29608 KB |
Output is correct |
4 |
Correct |
906 ms |
29640 KB |
Output is correct |
5 |
Correct |
737 ms |
29728 KB |
Output is correct |
6 |
Correct |
908 ms |
29640 KB |
Output is correct |
7 |
Correct |
819 ms |
29764 KB |
Output is correct |
8 |
Correct |
11 ms |
19024 KB |
Output is correct |
9 |
Correct |
10 ms |
19280 KB |
Output is correct |
10 |
Correct |
12 ms |
19280 KB |
Output is correct |
11 |
Correct |
12 ms |
19176 KB |
Output is correct |
12 |
Correct |
11 ms |
19664 KB |
Output is correct |
13 |
Correct |
12 ms |
19720 KB |
Output is correct |
14 |
Correct |
11 ms |
19664 KB |
Output is correct |
15 |
Correct |
11 ms |
19664 KB |
Output is correct |
16 |
Correct |
12 ms |
19840 KB |
Output is correct |
17 |
Correct |
11 ms |
19660 KB |
Output is correct |
18 |
Correct |
10 ms |
19280 KB |
Output is correct |
19 |
Correct |
11 ms |
19280 KB |
Output is correct |
20 |
Correct |
11 ms |
19664 KB |
Output is correct |
21 |
Correct |
11 ms |
19680 KB |
Output is correct |
22 |
Correct |
11 ms |
19124 KB |
Output is correct |
23 |
Correct |
11 ms |
19280 KB |
Output is correct |
24 |
Correct |
10 ms |
19280 KB |
Output is correct |
25 |
Correct |
12 ms |
19688 KB |
Output is correct |
26 |
Correct |
11 ms |
19596 KB |
Output is correct |
27 |
Correct |
11 ms |
19688 KB |
Output is correct |
28 |
Correct |
11 ms |
19288 KB |
Output is correct |
29 |
Correct |
10 ms |
19664 KB |
Output is correct |
30 |
Correct |
10 ms |
19280 KB |
Output is correct |
31 |
Correct |
10 ms |
19280 KB |
Output is correct |
32 |
Correct |
10 ms |
19280 KB |
Output is correct |
33 |
Correct |
10 ms |
19272 KB |
Output is correct |
34 |
Correct |
11 ms |
19280 KB |
Output is correct |
35 |
Correct |
10 ms |
19152 KB |
Output is correct |
36 |
Correct |
12 ms |
19216 KB |
Output is correct |
37 |
Correct |
11 ms |
19308 KB |
Output is correct |
38 |
Correct |
14 ms |
19248 KB |
Output is correct |
39 |
Correct |
11 ms |
19248 KB |
Output is correct |
40 |
Correct |
12 ms |
19408 KB |
Output is correct |
41 |
Correct |
11 ms |
19280 KB |
Output is correct |
42 |
Correct |
10 ms |
19300 KB |
Output is correct |
43 |
Correct |
10 ms |
19228 KB |
Output is correct |
44 |
Correct |
11 ms |
19252 KB |
Output is correct |
45 |
Correct |
13 ms |
19248 KB |
Output is correct |
46 |
Correct |
56 ms |
40460 KB |
Output is correct |
47 |
Correct |
87 ms |
52492 KB |
Output is correct |
48 |
Correct |
82 ms |
52496 KB |
Output is correct |
49 |
Correct |
80 ms |
52488 KB |
Output is correct |
50 |
Correct |
82 ms |
52508 KB |
Output is correct |
51 |
Correct |
93 ms |
52408 KB |
Output is correct |
52 |
Correct |
80 ms |
52500 KB |
Output is correct |
53 |
Correct |
28 ms |
29724 KB |
Output is correct |
54 |
Correct |
28 ms |
29792 KB |
Output is correct |
55 |
Correct |
82 ms |
52472 KB |
Output is correct |
56 |
Correct |
81 ms |
52676 KB |
Output is correct |
57 |
Correct |
83 ms |
52536 KB |
Output is correct |
58 |
Correct |
86 ms |
52484 KB |
Output is correct |
59 |
Correct |
83 ms |
52480 KB |
Output is correct |
60 |
Correct |
39 ms |
29848 KB |
Output is correct |
61 |
Correct |
73 ms |
52532 KB |
Output is correct |
62 |
Correct |
33 ms |
29324 KB |
Output is correct |
63 |
Correct |
32 ms |
29344 KB |
Output is correct |
64 |
Correct |
33 ms |
29328 KB |
Output is correct |
65 |
Correct |
40 ms |
29952 KB |
Output is correct |
66 |
Correct |
29 ms |
29592 KB |
Output is correct |
67 |
Correct |
32 ms |
29064 KB |
Output is correct |
68 |
Correct |
33 ms |
29328 KB |
Output is correct |
69 |
Correct |
34 ms |
29344 KB |
Output is correct |
70 |
Correct |
37 ms |
29448 KB |
Output is correct |
71 |
Correct |
34 ms |
29324 KB |
Output is correct |
72 |
Correct |
33 ms |
29340 KB |
Output is correct |
73 |
Correct |
33 ms |
29328 KB |
Output is correct |
74 |
Correct |
30 ms |
29760 KB |
Output is correct |
75 |
Correct |
29 ms |
29832 KB |
Output is correct |
76 |
Correct |
29 ms |
29508 KB |
Output is correct |
77 |
Correct |
28 ms |
29716 KB |
Output is correct |
78 |
Correct |
1053 ms |
52312 KB |
Output is correct |
79 |
Correct |
1223 ms |
52488 KB |
Output is correct |
80 |
Correct |
1330 ms |
52476 KB |
Output is correct |
81 |
Correct |
1293 ms |
52532 KB |
Output is correct |
82 |
Correct |
915 ms |
52424 KB |
Output is correct |
83 |
Correct |
1274 ms |
52532 KB |
Output is correct |
84 |
Correct |
1260 ms |
52472 KB |
Output is correct |
85 |
Correct |
1147 ms |
29720 KB |
Output is correct |
86 |
Correct |
875 ms |
29856 KB |
Output is correct |
87 |
Correct |
1390 ms |
52664 KB |
Output is correct |
88 |
Correct |
1123 ms |
52672 KB |
Output is correct |
89 |
Correct |
826 ms |
29648 KB |
Output is correct |
90 |
Correct |
949 ms |
29840 KB |
Output is correct |
91 |
Correct |
15 ms |
19136 KB |
Output is correct |
92 |
Correct |
15 ms |
19280 KB |
Output is correct |
93 |
Correct |
14 ms |
19280 KB |
Output is correct |
94 |
Correct |
102 ms |
52456 KB |
Output is correct |
95 |
Correct |
94 ms |
52452 KB |
Output is correct |
96 |
Correct |
90 ms |
52464 KB |
Output is correct |
97 |
Correct |
36 ms |
29788 KB |
Output is correct |
98 |
Correct |
93 ms |
52472 KB |
Output is correct |
99 |
Correct |
42 ms |
29388 KB |
Output is correct |
100 |
Correct |
38 ms |
29328 KB |
Output is correct |
101 |
Correct |
37 ms |
29308 KB |
Output is correct |
102 |
Correct |
37 ms |
29844 KB |
Output is correct |
103 |
Correct |
35 ms |
29476 KB |
Output is correct |
104 |
Correct |
14 ms |
19688 KB |
Output is correct |
105 |
Correct |
13 ms |
19604 KB |
Output is correct |
106 |
Correct |
13 ms |
19616 KB |
Output is correct |
107 |
Correct |
12 ms |
19348 KB |
Output is correct |
108 |
Correct |
14 ms |
19664 KB |
Output is correct |
109 |
Correct |
12 ms |
19280 KB |
Output is correct |
110 |
Correct |
12 ms |
19232 KB |
Output is correct |
111 |
Correct |
12 ms |
19280 KB |
Output is correct |
112 |
Correct |
13 ms |
19256 KB |
Output is correct |
113 |
Correct |
12 ms |
19256 KB |
Output is correct |
114 |
Correct |
381 ms |
21492 KB |
Output is correct |
115 |
Correct |
925 ms |
29344 KB |
Output is correct |
116 |
Correct |
1067 ms |
29440 KB |
Output is correct |
117 |
Correct |
471 ms |
29332 KB |
Output is correct |
118 |
Correct |
917 ms |
29348 KB |
Output is correct |
119 |
Correct |
721 ms |
29312 KB |
Output is correct |
120 |
Correct |
874 ms |
29348 KB |
Output is correct |
121 |
Correct |
721 ms |
29608 KB |
Output is correct |
122 |
Correct |
968 ms |
29832 KB |
Output is correct |
123 |
Correct |
648 ms |
29508 KB |
Output is correct |
124 |
Correct |
886 ms |
29660 KB |
Output is correct |
125 |
Correct |
36 ms |
29324 KB |
Output is correct |
126 |
Correct |
46 ms |
29360 KB |
Output is correct |
127 |
Correct |
53 ms |
29336 KB |
Output is correct |
128 |
Correct |
34 ms |
29832 KB |
Output is correct |
129 |
Correct |
44 ms |
29600 KB |
Output is correct |
130 |
Correct |
47 ms |
29064 KB |
Output is correct |
131 |
Correct |
41 ms |
29324 KB |
Output is correct |
132 |
Correct |
48 ms |
29368 KB |
Output is correct |
133 |
Correct |
36 ms |
29376 KB |
Output is correct |
134 |
Correct |
43 ms |
29340 KB |
Output is correct |
135 |
Correct |
34 ms |
29428 KB |
Output is correct |
136 |
Correct |
36 ms |
29388 KB |
Output is correct |
137 |
Correct |
41 ms |
29712 KB |
Output is correct |
138 |
Correct |
44 ms |
29848 KB |
Output is correct |
139 |
Correct |
35 ms |
29456 KB |
Output is correct |
140 |
Correct |
34 ms |
29752 KB |
Output is correct |
141 |
Correct |
11 ms |
19280 KB |
Output is correct |
142 |
Correct |
12 ms |
19280 KB |
Output is correct |
143 |
Correct |
11 ms |
19280 KB |
Output is correct |
144 |
Correct |
10 ms |
19280 KB |
Output is correct |
145 |
Correct |
11 ms |
19280 KB |
Output is correct |
146 |
Correct |
11 ms |
19148 KB |
Output is correct |
147 |
Correct |
11 ms |
19224 KB |
Output is correct |
148 |
Correct |
11 ms |
19280 KB |
Output is correct |
149 |
Correct |
12 ms |
19272 KB |
Output is correct |
150 |
Correct |
12 ms |
19280 KB |
Output is correct |
151 |
Correct |
11 ms |
19276 KB |
Output is correct |
152 |
Correct |
14 ms |
19244 KB |
Output is correct |
153 |
Correct |
11 ms |
19220 KB |
Output is correct |
154 |
Correct |
14 ms |
19332 KB |
Output is correct |
155 |
Correct |
11 ms |
19348 KB |
Output is correct |
156 |
Correct |
12 ms |
19236 KB |
Output is correct |
157 |
Correct |
1076 ms |
48804 KB |
Output is correct |
158 |
Correct |
1364 ms |
52484 KB |
Output is correct |
159 |
Correct |
1407 ms |
52608 KB |
Output is correct |
160 |
Correct |
1514 ms |
52684 KB |
Output is correct |
161 |
Correct |
1472 ms |
52552 KB |
Output is correct |
162 |
Correct |
1299 ms |
52480 KB |
Output is correct |
163 |
Correct |
1616 ms |
52484 KB |
Output is correct |
164 |
Correct |
1064 ms |
29688 KB |
Output is correct |
165 |
Correct |
602 ms |
29772 KB |
Output is correct |
166 |
Correct |
1525 ms |
52520 KB |
Output is correct |
167 |
Correct |
1405 ms |
52628 KB |
Output is correct |
168 |
Correct |
12 ms |
19072 KB |
Output is correct |
169 |
Incorrect |
925 ms |
30068 KB |
2nd lines differ - on the 1st token, expected: '128', found: '1529' |
170 |
Halted |
0 ms |
0 KB |
- |