#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 binaryCount(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 binaryFirst(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 == tree[node].size() ? INF : tree[node][r]);
}
int binaryLast(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 (l == -1 ? 0 : tree[node][l]);
}
int queryCount(int l, int r, int node, int queryL, int queryR, int queryValL, int queryValR)
{
if (queryL <= l && r <= queryR)
{
return binaryCount(node, queryValR) - binaryCount(node, queryValL - 1);
}
int res = 0;
int mid = (l + r) / 2;
if (queryL <= mid) res += queryCount(l, mid, 2*node, queryL, queryR, queryValL, queryValR);
if (mid + 1 <= queryR) res += queryCount(mid + 1, r, 2*node + 1, queryL, queryR, queryValL, queryValR);
return res;
}
int queryFirst(int l, int r, int node, int queryL, int queryR, int queryVal)
{
if (queryL <= l && r <= queryR)
{
return binaryFirst(node, queryVal);
}
int res = INF;
int mid = (l + r) / 2;
if (queryL <= mid) res = std::min(res, queryFirst(l, mid, 2*node, queryL, queryR, queryVal));
if (mid + 1 <= queryR) res = std::min(res, queryFirst(mid + 1, r, 2*node + 1, queryL, queryR, queryVal));
return res;
}
int queryLast(int l, int r, int node, int queryL, int queryR, int queryVal)
{
if (queryL <= l && r <= queryR)
{
return binaryLast(node, queryVal);
}
int res = 0;
int mid = (l + r) / 2;
if (queryL <= mid) res = std::max(res, queryLast(l, mid, 2*node, queryL, queryR, queryVal));
if (mid + 1 <= queryR) res = std::max(res, queryLast(mid + 1, r, 2*node + 1, queryL, queryR, queryVal));
return res;
}
void build(int vals[])
{
build(1, n, 1, vals);
}
int queryCount(int to, int l, int r)
{
return queryCount(1, n, 1, 1, to, l, r);
}
int queryFirst(int to, int l)
{
return queryFirst(1, n, 1, 1, to, l);
}
int queryLast(int to, int r)
{
return queryLast(1, n, 1, 1, to, r);
}
};
MST left, right;
struct SparseMAX
{
int sparseMAX[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)
{
sparseMAX[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)
{
sparseMAX[log][i] = cmp(sparseMAX[log - 1][i], sparseMAX[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(sparseMAX[log][l], sparseMAX[log][r - (1 << log) + 1])];
}
int findIDX(int l, int r)
{
int log = lg[r - l + 1];
return cmp(sparseMAX[log][l], sparseMAX[log][r - (1 << log) + 1]);
}
};
struct SegmentTree
{
struct Node
{
int max;
int min;
int maxDiffL;
int maxDiffR;
Node()
{
max = -1;
}
};
Node combine(Node left, Node right)
{
if (left.max == -1)
{
return right;
}
Node res;
res.min = std::min(left.min, right.min);
res.max = std::max(left.max, right.max);
res.maxDiffL = std::max(left.maxDiffL, right.maxDiffL);
res.maxDiffR = std::max(left.maxDiffR, right.maxDiffR);
res.maxDiffL = std::max(res.maxDiffL, right.max - left.min);
res.maxDiffR = std::max(res.maxDiffR, left.max - right.min);
return res;
}
Node tree[4*MAXN];
void build(int l, int r, int node, int vals[])
{
if (l == r)
{
tree[node].min = vals[l];
tree[node].max = vals[l];
tree[node].maxDiffL = 0;
tree[node].maxDiffR = 0;
return;
}
int mid = (l + r) / 2;
build(l, mid, 2*node, vals);
build(mid + 1, r, 2*node + 1, vals);
tree[node] = combine(tree[2*node], tree[2*node + 1]);
}
Node query(int l, int r, int node, int queryL, int queryR)
{
if (queryL <= l && r <= queryR)
{
return tree[node];
}
Node res;
int mid = (l + r) / 2;
if (queryL <= mid) res = combine(res, query(l, mid, 2*node, queryL, queryR));
if (mid + 1 <= queryR) res = combine(res, query(mid + 1, r, 2*node + 1, queryL, queryR));
return res;
}
void build(int vals[])
{
build(1, n, 1, vals);
}
int queryL(int l, int r)
{
return query(1, n, 1, l, r).maxDiffL;
}
int queryR(int l, int r)
{
return query(1, n, 1, l, r).maxDiffR;
}
};
int a[MAXN];
int b[MAXN];
int c[MAXN];
int d[MAXN];
int h[MAXN];
int perm[MAXN];
int cost[MAXN];
SparseMAX sparseMAX;
SegmentTree maxDiff;
std::stack <int> st;
std::vector <int> v;
MST tree;
void init(int N, std::vector <int> H)
{
n = N;
for (int i = 1 ; i <= n ; ++i)
{
h[i] = H[i - 1];
}
sparseMAX.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);
}
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] = sparseMAX.findMAX(a[i] + 1, i - 1) - h[i];
}
if (c[i] == i + 1)
{
d[i] = 0;
} else
{
d[i] = sparseMAX.findMAX(i + 1, c[i] - 1) - h[i];
}
}
for (int i = 1 ; i <= n ; ++i)
{
cost[i] = INF;
if (a[i] > 0) cost[i] = std::min(cost[i], b[i]);
if (c[i] < n + 1) cost[i] = std::min(cost[i], d[i]);
}
std::iota(perm + 1, perm + 1 + n, 1);
std::sort(perm + 1, perm + 1 + n, [&](const int &x, const int &y)
{
return cost[x] > cost[y];
});
tree.build(perm);
maxDiff.build(h);
}
int max_towers(int L, int R, int D)
{
L++; R++;
int l = 0, r = n + 1, mid;
while (l < r - 1)
{
mid = (l + r) / 2;
if (cost[perm[mid]] >= D) l = mid;
else r = mid;
}
if (l == 0)
{
return 1;
}
int cnt = tree.queryCount(l, L, R);
if (cnt == 0)
{
l = L - 1;
r = R + 1;
while (l < r - 1)
{
mid = (l + r) / 2;
if (maxDiff.queryL(L, mid) >= D && maxDiff.queryR(mid, R) >= D)
{
return 2;
}
if (maxDiff.queryL(L, mid) < D) l = mid;
else r = mid;
}
return 1;
}
int first = tree.queryFirst(l, L);
int last = tree.queryLast(l, R);
l = L, r = first;
while (l < r - 1)
{
mid = (l + r) / 2;
if (sparseMAX.findMAX(mid, first - 1) < h[first] + D) r = mid;
else l = mid;
}
if (maxDiff.queryL(L, l) >= D)
{
cnt++;
}
l = last, r = R;
while (l < r - 1)
{
mid = (l + r) / 2;
if (sparseMAX.findMAX(last + 1, mid) < h[last] + D) l = mid;
else r = mid;
}
if (maxDiff.queryR(r, R) >= D)
{
cnt++;
}
return cnt;
}
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 'int MST::binaryFirst(int, int)':
towers.cpp:78:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
78 | return (r == tree[node].size() ? INF : tree[node][r]);
| ~~^~~~~~~~~~~~~~~~~~~~
towers.cpp: In member function 'void SparseMAX::build(int*)':
towers.cpp:182:97: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
182 | sparseMAX[log][i] = cmp(sparseMAX[log - 1][i], sparseMAX[log - 1][i + (1 << log - 1)]);
| ~~~~^~~
towers.cpp:189:29: warning: suggest parentheses around '+' inside '<<' [-Wparentheses]
189 | if ((1 << lg[i] + 1) < i)
| ~~~~~~^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
822 ms |
47612 KB |
Output is correct |
2 |
Correct |
2115 ms |
56612 KB |
Output is correct |
3 |
Correct |
1642 ms |
56688 KB |
Output is correct |
4 |
Correct |
1924 ms |
56692 KB |
Output is correct |
5 |
Correct |
1819 ms |
57112 KB |
Output is correct |
6 |
Correct |
1833 ms |
56648 KB |
Output is correct |
7 |
Correct |
1758 ms |
57056 KB |
Output is correct |
8 |
Correct |
18 ms |
34768 KB |
Output is correct |
9 |
Correct |
23 ms |
35152 KB |
Output is correct |
10 |
Correct |
20 ms |
35112 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
18 ms |
34784 KB |
Output is correct |
2 |
Correct |
20 ms |
35132 KB |
Output is correct |
3 |
Correct |
19 ms |
35152 KB |
Output is correct |
4 |
Correct |
20 ms |
35152 KB |
Output is correct |
5 |
Correct |
19 ms |
35144 KB |
Output is correct |
6 |
Correct |
20 ms |
35088 KB |
Output is correct |
7 |
Correct |
19 ms |
35152 KB |
Output is correct |
8 |
Correct |
20 ms |
35160 KB |
Output is correct |
9 |
Correct |
19 ms |
35152 KB |
Output is correct |
10 |
Correct |
19 ms |
35152 KB |
Output is correct |
11 |
Correct |
19 ms |
35168 KB |
Output is correct |
12 |
Correct |
19 ms |
34760 KB |
Output is correct |
13 |
Correct |
20 ms |
35152 KB |
Output is correct |
14 |
Correct |
21 ms |
35152 KB |
Output is correct |
15 |
Correct |
21 ms |
35152 KB |
Output is correct |
16 |
Correct |
19 ms |
35152 KB |
Output is correct |
17 |
Correct |
19 ms |
35152 KB |
Output is correct |
18 |
Correct |
19 ms |
35152 KB |
Output is correct |
19 |
Correct |
19 ms |
35152 KB |
Output is correct |
20 |
Correct |
19 ms |
35152 KB |
Output is correct |
21 |
Correct |
19 ms |
35152 KB |
Output is correct |
22 |
Correct |
20 ms |
35152 KB |
Output is correct |
23 |
Correct |
19 ms |
35116 KB |
Output is correct |
24 |
Correct |
19 ms |
35152 KB |
Output is correct |
25 |
Correct |
19 ms |
34856 KB |
Output is correct |
26 |
Correct |
19 ms |
35152 KB |
Output is correct |
27 |
Correct |
19 ms |
35056 KB |
Output is correct |
28 |
Correct |
18 ms |
35152 KB |
Output is correct |
29 |
Correct |
19 ms |
35152 KB |
Output is correct |
30 |
Correct |
18 ms |
35144 KB |
Output is correct |
31 |
Correct |
20 ms |
35156 KB |
Output is correct |
32 |
Correct |
18 ms |
35160 KB |
Output is correct |
33 |
Correct |
19 ms |
35152 KB |
Output is correct |
34 |
Correct |
19 ms |
35096 KB |
Output is correct |
35 |
Correct |
19 ms |
35152 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
18 ms |
34784 KB |
Output is correct |
2 |
Correct |
20 ms |
35132 KB |
Output is correct |
3 |
Correct |
19 ms |
35152 KB |
Output is correct |
4 |
Correct |
20 ms |
35152 KB |
Output is correct |
5 |
Correct |
19 ms |
35144 KB |
Output is correct |
6 |
Correct |
20 ms |
35088 KB |
Output is correct |
7 |
Correct |
19 ms |
35152 KB |
Output is correct |
8 |
Correct |
20 ms |
35160 KB |
Output is correct |
9 |
Correct |
19 ms |
35152 KB |
Output is correct |
10 |
Correct |
19 ms |
35152 KB |
Output is correct |
11 |
Correct |
19 ms |
35168 KB |
Output is correct |
12 |
Correct |
19 ms |
34760 KB |
Output is correct |
13 |
Correct |
20 ms |
35152 KB |
Output is correct |
14 |
Correct |
21 ms |
35152 KB |
Output is correct |
15 |
Correct |
21 ms |
35152 KB |
Output is correct |
16 |
Correct |
19 ms |
35152 KB |
Output is correct |
17 |
Correct |
19 ms |
35152 KB |
Output is correct |
18 |
Correct |
19 ms |
35152 KB |
Output is correct |
19 |
Correct |
19 ms |
35152 KB |
Output is correct |
20 |
Correct |
19 ms |
35152 KB |
Output is correct |
21 |
Correct |
19 ms |
35152 KB |
Output is correct |
22 |
Correct |
20 ms |
35152 KB |
Output is correct |
23 |
Correct |
19 ms |
35116 KB |
Output is correct |
24 |
Correct |
19 ms |
35152 KB |
Output is correct |
25 |
Correct |
19 ms |
34856 KB |
Output is correct |
26 |
Correct |
19 ms |
35152 KB |
Output is correct |
27 |
Correct |
19 ms |
35056 KB |
Output is correct |
28 |
Correct |
18 ms |
35152 KB |
Output is correct |
29 |
Correct |
19 ms |
35152 KB |
Output is correct |
30 |
Correct |
18 ms |
35144 KB |
Output is correct |
31 |
Correct |
20 ms |
35156 KB |
Output is correct |
32 |
Correct |
18 ms |
35160 KB |
Output is correct |
33 |
Correct |
19 ms |
35152 KB |
Output is correct |
34 |
Correct |
19 ms |
35096 KB |
Output is correct |
35 |
Correct |
19 ms |
35152 KB |
Output is correct |
36 |
Correct |
49 ms |
48772 KB |
Output is correct |
37 |
Correct |
79 ms |
56640 KB |
Output is correct |
38 |
Correct |
75 ms |
56636 KB |
Output is correct |
39 |
Correct |
86 ms |
56612 KB |
Output is correct |
40 |
Correct |
71 ms |
56684 KB |
Output is correct |
41 |
Correct |
75 ms |
56604 KB |
Output is correct |
42 |
Correct |
71 ms |
56648 KB |
Output is correct |
43 |
Correct |
72 ms |
56648 KB |
Output is correct |
44 |
Correct |
75 ms |
57100 KB |
Output is correct |
45 |
Correct |
68 ms |
56660 KB |
Output is correct |
46 |
Correct |
78 ms |
56900 KB |
Output is correct |
47 |
Correct |
76 ms |
56612 KB |
Output is correct |
48 |
Correct |
77 ms |
56684 KB |
Output is correct |
49 |
Correct |
82 ms |
56636 KB |
Output is correct |
50 |
Correct |
83 ms |
57032 KB |
Output is correct |
51 |
Correct |
77 ms |
56648 KB |
Output is correct |
52 |
Correct |
72 ms |
56628 KB |
Output is correct |
53 |
Correct |
78 ms |
56652 KB |
Output is correct |
54 |
Correct |
77 ms |
56648 KB |
Output is correct |
55 |
Correct |
64 ms |
57100 KB |
Output is correct |
56 |
Correct |
69 ms |
56668 KB |
Output is correct |
57 |
Correct |
78 ms |
55992 KB |
Output is correct |
58 |
Correct |
93 ms |
56652 KB |
Output is correct |
59 |
Correct |
77 ms |
56632 KB |
Output is correct |
60 |
Correct |
82 ms |
56672 KB |
Output is correct |
61 |
Correct |
73 ms |
56668 KB |
Output is correct |
62 |
Correct |
71 ms |
56648 KB |
Output is correct |
63 |
Correct |
74 ms |
56648 KB |
Output is correct |
64 |
Correct |
66 ms |
56692 KB |
Output is correct |
65 |
Correct |
72 ms |
57120 KB |
Output is correct |
66 |
Correct |
78 ms |
56616 KB |
Output is correct |
67 |
Correct |
65 ms |
57004 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
911 ms |
56580 KB |
Output is correct |
2 |
Correct |
1338 ms |
56648 KB |
Output is correct |
3 |
Correct |
1110 ms |
56660 KB |
Output is correct |
4 |
Correct |
1186 ms |
56652 KB |
Output is correct |
5 |
Correct |
1179 ms |
56636 KB |
Output is correct |
6 |
Correct |
913 ms |
56776 KB |
Output is correct |
7 |
Correct |
1427 ms |
56656 KB |
Output is correct |
8 |
Correct |
2193 ms |
56700 KB |
Output is correct |
9 |
Correct |
1913 ms |
57032 KB |
Output is correct |
10 |
Correct |
1332 ms |
56652 KB |
Output is correct |
11 |
Correct |
1250 ms |
56900 KB |
Output is correct |
12 |
Correct |
1937 ms |
56636 KB |
Output is correct |
13 |
Correct |
1893 ms |
57056 KB |
Output is correct |
14 |
Correct |
18 ms |
34768 KB |
Output is correct |
15 |
Correct |
22 ms |
35096 KB |
Output is correct |
16 |
Correct |
19 ms |
35080 KB |
Output is correct |
17 |
Correct |
76 ms |
56656 KB |
Output is correct |
18 |
Correct |
73 ms |
56644 KB |
Output is correct |
19 |
Correct |
80 ms |
56612 KB |
Output is correct |
20 |
Correct |
64 ms |
57116 KB |
Output is correct |
21 |
Correct |
66 ms |
56632 KB |
Output is correct |
22 |
Correct |
70 ms |
56648 KB |
Output is correct |
23 |
Correct |
75 ms |
56656 KB |
Output is correct |
24 |
Correct |
73 ms |
56604 KB |
Output is correct |
25 |
Correct |
65 ms |
57056 KB |
Output is correct |
26 |
Correct |
67 ms |
56692 KB |
Output is correct |
27 |
Correct |
20 ms |
35152 KB |
Output is correct |
28 |
Correct |
19 ms |
35152 KB |
Output is correct |
29 |
Correct |
19 ms |
35108 KB |
Output is correct |
30 |
Correct |
20 ms |
35072 KB |
Output is correct |
31 |
Correct |
21 ms |
35128 KB |
Output is correct |
32 |
Correct |
18 ms |
35152 KB |
Output is correct |
33 |
Correct |
20 ms |
35084 KB |
Output is correct |
34 |
Correct |
23 ms |
35152 KB |
Output is correct |
35 |
Correct |
19 ms |
35152 KB |
Output is correct |
36 |
Correct |
19 ms |
35152 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
384 ms |
39700 KB |
Output is correct |
2 |
Correct |
1166 ms |
56640 KB |
Output is correct |
3 |
Correct |
1497 ms |
56584 KB |
Output is correct |
4 |
Correct |
1797 ms |
56676 KB |
Output is correct |
5 |
Correct |
1330 ms |
56664 KB |
Output is correct |
6 |
Correct |
1156 ms |
56680 KB |
Output is correct |
7 |
Correct |
1195 ms |
56664 KB |
Output is correct |
8 |
Correct |
1000 ms |
56632 KB |
Output is correct |
9 |
Correct |
1094 ms |
57056 KB |
Output is correct |
10 |
Correct |
1115 ms |
56804 KB |
Output is correct |
11 |
Correct |
878 ms |
56776 KB |
Output is correct |
12 |
Correct |
75 ms |
56624 KB |
Output is correct |
13 |
Correct |
74 ms |
56596 KB |
Output is correct |
14 |
Correct |
74 ms |
56648 KB |
Output is correct |
15 |
Correct |
66 ms |
57048 KB |
Output is correct |
16 |
Correct |
68 ms |
56700 KB |
Output is correct |
17 |
Correct |
81 ms |
55992 KB |
Output is correct |
18 |
Correct |
75 ms |
56644 KB |
Output is correct |
19 |
Correct |
73 ms |
56648 KB |
Output is correct |
20 |
Correct |
70 ms |
56636 KB |
Output is correct |
21 |
Correct |
74 ms |
56628 KB |
Output is correct |
22 |
Correct |
75 ms |
56760 KB |
Output is correct |
23 |
Correct |
81 ms |
56648 KB |
Output is correct |
24 |
Correct |
66 ms |
56648 KB |
Output is correct |
25 |
Correct |
67 ms |
57036 KB |
Output is correct |
26 |
Correct |
65 ms |
56644 KB |
Output is correct |
27 |
Correct |
63 ms |
57036 KB |
Output is correct |
28 |
Correct |
19 ms |
35152 KB |
Output is correct |
29 |
Correct |
19 ms |
35072 KB |
Output is correct |
30 |
Correct |
18 ms |
35132 KB |
Output is correct |
31 |
Correct |
19 ms |
35096 KB |
Output is correct |
32 |
Correct |
19 ms |
35152 KB |
Output is correct |
33 |
Correct |
19 ms |
34916 KB |
Output is correct |
34 |
Correct |
19 ms |
35072 KB |
Output is correct |
35 |
Correct |
21 ms |
35152 KB |
Output is correct |
36 |
Correct |
22 ms |
35176 KB |
Output is correct |
37 |
Correct |
20 ms |
35152 KB |
Output is correct |
38 |
Correct |
19 ms |
35152 KB |
Output is correct |
39 |
Correct |
19 ms |
35072 KB |
Output is correct |
40 |
Correct |
19 ms |
35152 KB |
Output is correct |
41 |
Correct |
20 ms |
35128 KB |
Output is correct |
42 |
Correct |
21 ms |
35136 KB |
Output is correct |
43 |
Correct |
19 ms |
35104 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
18 ms |
34784 KB |
Output is correct |
2 |
Correct |
20 ms |
35132 KB |
Output is correct |
3 |
Correct |
19 ms |
35152 KB |
Output is correct |
4 |
Correct |
20 ms |
35152 KB |
Output is correct |
5 |
Correct |
19 ms |
35144 KB |
Output is correct |
6 |
Correct |
20 ms |
35088 KB |
Output is correct |
7 |
Correct |
19 ms |
35152 KB |
Output is correct |
8 |
Correct |
20 ms |
35160 KB |
Output is correct |
9 |
Correct |
19 ms |
35152 KB |
Output is correct |
10 |
Correct |
19 ms |
35152 KB |
Output is correct |
11 |
Correct |
19 ms |
35168 KB |
Output is correct |
12 |
Correct |
19 ms |
34760 KB |
Output is correct |
13 |
Correct |
20 ms |
35152 KB |
Output is correct |
14 |
Correct |
21 ms |
35152 KB |
Output is correct |
15 |
Correct |
21 ms |
35152 KB |
Output is correct |
16 |
Correct |
19 ms |
35152 KB |
Output is correct |
17 |
Correct |
19 ms |
35152 KB |
Output is correct |
18 |
Correct |
19 ms |
35152 KB |
Output is correct |
19 |
Correct |
19 ms |
35152 KB |
Output is correct |
20 |
Correct |
19 ms |
35152 KB |
Output is correct |
21 |
Correct |
19 ms |
35152 KB |
Output is correct |
22 |
Correct |
20 ms |
35152 KB |
Output is correct |
23 |
Correct |
19 ms |
35116 KB |
Output is correct |
24 |
Correct |
19 ms |
35152 KB |
Output is correct |
25 |
Correct |
19 ms |
34856 KB |
Output is correct |
26 |
Correct |
19 ms |
35152 KB |
Output is correct |
27 |
Correct |
19 ms |
35056 KB |
Output is correct |
28 |
Correct |
18 ms |
35152 KB |
Output is correct |
29 |
Correct |
19 ms |
35152 KB |
Output is correct |
30 |
Correct |
18 ms |
35144 KB |
Output is correct |
31 |
Correct |
20 ms |
35156 KB |
Output is correct |
32 |
Correct |
18 ms |
35160 KB |
Output is correct |
33 |
Correct |
19 ms |
35152 KB |
Output is correct |
34 |
Correct |
19 ms |
35096 KB |
Output is correct |
35 |
Correct |
19 ms |
35152 KB |
Output is correct |
36 |
Correct |
49 ms |
48772 KB |
Output is correct |
37 |
Correct |
79 ms |
56640 KB |
Output is correct |
38 |
Correct |
75 ms |
56636 KB |
Output is correct |
39 |
Correct |
86 ms |
56612 KB |
Output is correct |
40 |
Correct |
71 ms |
56684 KB |
Output is correct |
41 |
Correct |
75 ms |
56604 KB |
Output is correct |
42 |
Correct |
71 ms |
56648 KB |
Output is correct |
43 |
Correct |
72 ms |
56648 KB |
Output is correct |
44 |
Correct |
75 ms |
57100 KB |
Output is correct |
45 |
Correct |
68 ms |
56660 KB |
Output is correct |
46 |
Correct |
78 ms |
56900 KB |
Output is correct |
47 |
Correct |
76 ms |
56612 KB |
Output is correct |
48 |
Correct |
77 ms |
56684 KB |
Output is correct |
49 |
Correct |
82 ms |
56636 KB |
Output is correct |
50 |
Correct |
83 ms |
57032 KB |
Output is correct |
51 |
Correct |
77 ms |
56648 KB |
Output is correct |
52 |
Correct |
72 ms |
56628 KB |
Output is correct |
53 |
Correct |
78 ms |
56652 KB |
Output is correct |
54 |
Correct |
77 ms |
56648 KB |
Output is correct |
55 |
Correct |
64 ms |
57100 KB |
Output is correct |
56 |
Correct |
69 ms |
56668 KB |
Output is correct |
57 |
Correct |
78 ms |
55992 KB |
Output is correct |
58 |
Correct |
93 ms |
56652 KB |
Output is correct |
59 |
Correct |
77 ms |
56632 KB |
Output is correct |
60 |
Correct |
82 ms |
56672 KB |
Output is correct |
61 |
Correct |
73 ms |
56668 KB |
Output is correct |
62 |
Correct |
71 ms |
56648 KB |
Output is correct |
63 |
Correct |
74 ms |
56648 KB |
Output is correct |
64 |
Correct |
66 ms |
56692 KB |
Output is correct |
65 |
Correct |
72 ms |
57120 KB |
Output is correct |
66 |
Correct |
78 ms |
56616 KB |
Output is correct |
67 |
Correct |
65 ms |
57004 KB |
Output is correct |
68 |
Correct |
911 ms |
56580 KB |
Output is correct |
69 |
Correct |
1338 ms |
56648 KB |
Output is correct |
70 |
Correct |
1110 ms |
56660 KB |
Output is correct |
71 |
Correct |
1186 ms |
56652 KB |
Output is correct |
72 |
Correct |
1179 ms |
56636 KB |
Output is correct |
73 |
Correct |
913 ms |
56776 KB |
Output is correct |
74 |
Correct |
1427 ms |
56656 KB |
Output is correct |
75 |
Correct |
2193 ms |
56700 KB |
Output is correct |
76 |
Correct |
1913 ms |
57032 KB |
Output is correct |
77 |
Correct |
1332 ms |
56652 KB |
Output is correct |
78 |
Correct |
1250 ms |
56900 KB |
Output is correct |
79 |
Correct |
1937 ms |
56636 KB |
Output is correct |
80 |
Correct |
1893 ms |
57056 KB |
Output is correct |
81 |
Correct |
18 ms |
34768 KB |
Output is correct |
82 |
Correct |
22 ms |
35096 KB |
Output is correct |
83 |
Correct |
19 ms |
35080 KB |
Output is correct |
84 |
Correct |
76 ms |
56656 KB |
Output is correct |
85 |
Correct |
73 ms |
56644 KB |
Output is correct |
86 |
Correct |
80 ms |
56612 KB |
Output is correct |
87 |
Correct |
64 ms |
57116 KB |
Output is correct |
88 |
Correct |
66 ms |
56632 KB |
Output is correct |
89 |
Correct |
70 ms |
56648 KB |
Output is correct |
90 |
Correct |
75 ms |
56656 KB |
Output is correct |
91 |
Correct |
73 ms |
56604 KB |
Output is correct |
92 |
Correct |
65 ms |
57056 KB |
Output is correct |
93 |
Correct |
67 ms |
56692 KB |
Output is correct |
94 |
Correct |
20 ms |
35152 KB |
Output is correct |
95 |
Correct |
19 ms |
35152 KB |
Output is correct |
96 |
Correct |
19 ms |
35108 KB |
Output is correct |
97 |
Correct |
20 ms |
35072 KB |
Output is correct |
98 |
Correct |
21 ms |
35128 KB |
Output is correct |
99 |
Correct |
18 ms |
35152 KB |
Output is correct |
100 |
Correct |
20 ms |
35084 KB |
Output is correct |
101 |
Correct |
23 ms |
35152 KB |
Output is correct |
102 |
Correct |
19 ms |
35152 KB |
Output is correct |
103 |
Correct |
19 ms |
35152 KB |
Output is correct |
104 |
Correct |
1054 ms |
54160 KB |
Output is correct |
105 |
Correct |
1262 ms |
56616 KB |
Output is correct |
106 |
Correct |
1038 ms |
56644 KB |
Output is correct |
107 |
Correct |
995 ms |
56672 KB |
Output is correct |
108 |
Correct |
1207 ms |
56628 KB |
Output is correct |
109 |
Correct |
1298 ms |
56648 KB |
Output is correct |
110 |
Correct |
1299 ms |
56632 KB |
Output is correct |
111 |
Correct |
1807 ms |
56736 KB |
Output is correct |
112 |
Correct |
1936 ms |
57036 KB |
Output is correct |
113 |
Correct |
1819 ms |
56652 KB |
Output is correct |
114 |
Correct |
1719 ms |
56880 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
822 ms |
47612 KB |
Output is correct |
2 |
Correct |
2115 ms |
56612 KB |
Output is correct |
3 |
Correct |
1642 ms |
56688 KB |
Output is correct |
4 |
Correct |
1924 ms |
56692 KB |
Output is correct |
5 |
Correct |
1819 ms |
57112 KB |
Output is correct |
6 |
Correct |
1833 ms |
56648 KB |
Output is correct |
7 |
Correct |
1758 ms |
57056 KB |
Output is correct |
8 |
Correct |
18 ms |
34768 KB |
Output is correct |
9 |
Correct |
23 ms |
35152 KB |
Output is correct |
10 |
Correct |
20 ms |
35112 KB |
Output is correct |
11 |
Correct |
18 ms |
34784 KB |
Output is correct |
12 |
Correct |
20 ms |
35132 KB |
Output is correct |
13 |
Correct |
19 ms |
35152 KB |
Output is correct |
14 |
Correct |
20 ms |
35152 KB |
Output is correct |
15 |
Correct |
19 ms |
35144 KB |
Output is correct |
16 |
Correct |
20 ms |
35088 KB |
Output is correct |
17 |
Correct |
19 ms |
35152 KB |
Output is correct |
18 |
Correct |
20 ms |
35160 KB |
Output is correct |
19 |
Correct |
19 ms |
35152 KB |
Output is correct |
20 |
Correct |
19 ms |
35152 KB |
Output is correct |
21 |
Correct |
19 ms |
35168 KB |
Output is correct |
22 |
Correct |
19 ms |
34760 KB |
Output is correct |
23 |
Correct |
20 ms |
35152 KB |
Output is correct |
24 |
Correct |
21 ms |
35152 KB |
Output is correct |
25 |
Correct |
21 ms |
35152 KB |
Output is correct |
26 |
Correct |
19 ms |
35152 KB |
Output is correct |
27 |
Correct |
19 ms |
35152 KB |
Output is correct |
28 |
Correct |
19 ms |
35152 KB |
Output is correct |
29 |
Correct |
19 ms |
35152 KB |
Output is correct |
30 |
Correct |
19 ms |
35152 KB |
Output is correct |
31 |
Correct |
19 ms |
35152 KB |
Output is correct |
32 |
Correct |
20 ms |
35152 KB |
Output is correct |
33 |
Correct |
19 ms |
35116 KB |
Output is correct |
34 |
Correct |
19 ms |
35152 KB |
Output is correct |
35 |
Correct |
19 ms |
34856 KB |
Output is correct |
36 |
Correct |
19 ms |
35152 KB |
Output is correct |
37 |
Correct |
19 ms |
35056 KB |
Output is correct |
38 |
Correct |
18 ms |
35152 KB |
Output is correct |
39 |
Correct |
19 ms |
35152 KB |
Output is correct |
40 |
Correct |
18 ms |
35144 KB |
Output is correct |
41 |
Correct |
20 ms |
35156 KB |
Output is correct |
42 |
Correct |
18 ms |
35160 KB |
Output is correct |
43 |
Correct |
19 ms |
35152 KB |
Output is correct |
44 |
Correct |
19 ms |
35096 KB |
Output is correct |
45 |
Correct |
19 ms |
35152 KB |
Output is correct |
46 |
Correct |
49 ms |
48772 KB |
Output is correct |
47 |
Correct |
79 ms |
56640 KB |
Output is correct |
48 |
Correct |
75 ms |
56636 KB |
Output is correct |
49 |
Correct |
86 ms |
56612 KB |
Output is correct |
50 |
Correct |
71 ms |
56684 KB |
Output is correct |
51 |
Correct |
75 ms |
56604 KB |
Output is correct |
52 |
Correct |
71 ms |
56648 KB |
Output is correct |
53 |
Correct |
72 ms |
56648 KB |
Output is correct |
54 |
Correct |
75 ms |
57100 KB |
Output is correct |
55 |
Correct |
68 ms |
56660 KB |
Output is correct |
56 |
Correct |
78 ms |
56900 KB |
Output is correct |
57 |
Correct |
76 ms |
56612 KB |
Output is correct |
58 |
Correct |
77 ms |
56684 KB |
Output is correct |
59 |
Correct |
82 ms |
56636 KB |
Output is correct |
60 |
Correct |
83 ms |
57032 KB |
Output is correct |
61 |
Correct |
77 ms |
56648 KB |
Output is correct |
62 |
Correct |
72 ms |
56628 KB |
Output is correct |
63 |
Correct |
78 ms |
56652 KB |
Output is correct |
64 |
Correct |
77 ms |
56648 KB |
Output is correct |
65 |
Correct |
64 ms |
57100 KB |
Output is correct |
66 |
Correct |
69 ms |
56668 KB |
Output is correct |
67 |
Correct |
78 ms |
55992 KB |
Output is correct |
68 |
Correct |
93 ms |
56652 KB |
Output is correct |
69 |
Correct |
77 ms |
56632 KB |
Output is correct |
70 |
Correct |
82 ms |
56672 KB |
Output is correct |
71 |
Correct |
73 ms |
56668 KB |
Output is correct |
72 |
Correct |
71 ms |
56648 KB |
Output is correct |
73 |
Correct |
74 ms |
56648 KB |
Output is correct |
74 |
Correct |
66 ms |
56692 KB |
Output is correct |
75 |
Correct |
72 ms |
57120 KB |
Output is correct |
76 |
Correct |
78 ms |
56616 KB |
Output is correct |
77 |
Correct |
65 ms |
57004 KB |
Output is correct |
78 |
Correct |
911 ms |
56580 KB |
Output is correct |
79 |
Correct |
1338 ms |
56648 KB |
Output is correct |
80 |
Correct |
1110 ms |
56660 KB |
Output is correct |
81 |
Correct |
1186 ms |
56652 KB |
Output is correct |
82 |
Correct |
1179 ms |
56636 KB |
Output is correct |
83 |
Correct |
913 ms |
56776 KB |
Output is correct |
84 |
Correct |
1427 ms |
56656 KB |
Output is correct |
85 |
Correct |
2193 ms |
56700 KB |
Output is correct |
86 |
Correct |
1913 ms |
57032 KB |
Output is correct |
87 |
Correct |
1332 ms |
56652 KB |
Output is correct |
88 |
Correct |
1250 ms |
56900 KB |
Output is correct |
89 |
Correct |
1937 ms |
56636 KB |
Output is correct |
90 |
Correct |
1893 ms |
57056 KB |
Output is correct |
91 |
Correct |
18 ms |
34768 KB |
Output is correct |
92 |
Correct |
22 ms |
35096 KB |
Output is correct |
93 |
Correct |
19 ms |
35080 KB |
Output is correct |
94 |
Correct |
76 ms |
56656 KB |
Output is correct |
95 |
Correct |
73 ms |
56644 KB |
Output is correct |
96 |
Correct |
80 ms |
56612 KB |
Output is correct |
97 |
Correct |
64 ms |
57116 KB |
Output is correct |
98 |
Correct |
66 ms |
56632 KB |
Output is correct |
99 |
Correct |
70 ms |
56648 KB |
Output is correct |
100 |
Correct |
75 ms |
56656 KB |
Output is correct |
101 |
Correct |
73 ms |
56604 KB |
Output is correct |
102 |
Correct |
65 ms |
57056 KB |
Output is correct |
103 |
Correct |
67 ms |
56692 KB |
Output is correct |
104 |
Correct |
20 ms |
35152 KB |
Output is correct |
105 |
Correct |
19 ms |
35152 KB |
Output is correct |
106 |
Correct |
19 ms |
35108 KB |
Output is correct |
107 |
Correct |
20 ms |
35072 KB |
Output is correct |
108 |
Correct |
21 ms |
35128 KB |
Output is correct |
109 |
Correct |
18 ms |
35152 KB |
Output is correct |
110 |
Correct |
20 ms |
35084 KB |
Output is correct |
111 |
Correct |
23 ms |
35152 KB |
Output is correct |
112 |
Correct |
19 ms |
35152 KB |
Output is correct |
113 |
Correct |
19 ms |
35152 KB |
Output is correct |
114 |
Correct |
384 ms |
39700 KB |
Output is correct |
115 |
Correct |
1166 ms |
56640 KB |
Output is correct |
116 |
Correct |
1497 ms |
56584 KB |
Output is correct |
117 |
Correct |
1797 ms |
56676 KB |
Output is correct |
118 |
Correct |
1330 ms |
56664 KB |
Output is correct |
119 |
Correct |
1156 ms |
56680 KB |
Output is correct |
120 |
Correct |
1195 ms |
56664 KB |
Output is correct |
121 |
Correct |
1000 ms |
56632 KB |
Output is correct |
122 |
Correct |
1094 ms |
57056 KB |
Output is correct |
123 |
Correct |
1115 ms |
56804 KB |
Output is correct |
124 |
Correct |
878 ms |
56776 KB |
Output is correct |
125 |
Correct |
75 ms |
56624 KB |
Output is correct |
126 |
Correct |
74 ms |
56596 KB |
Output is correct |
127 |
Correct |
74 ms |
56648 KB |
Output is correct |
128 |
Correct |
66 ms |
57048 KB |
Output is correct |
129 |
Correct |
68 ms |
56700 KB |
Output is correct |
130 |
Correct |
81 ms |
55992 KB |
Output is correct |
131 |
Correct |
75 ms |
56644 KB |
Output is correct |
132 |
Correct |
73 ms |
56648 KB |
Output is correct |
133 |
Correct |
70 ms |
56636 KB |
Output is correct |
134 |
Correct |
74 ms |
56628 KB |
Output is correct |
135 |
Correct |
75 ms |
56760 KB |
Output is correct |
136 |
Correct |
81 ms |
56648 KB |
Output is correct |
137 |
Correct |
66 ms |
56648 KB |
Output is correct |
138 |
Correct |
67 ms |
57036 KB |
Output is correct |
139 |
Correct |
65 ms |
56644 KB |
Output is correct |
140 |
Correct |
63 ms |
57036 KB |
Output is correct |
141 |
Correct |
19 ms |
35152 KB |
Output is correct |
142 |
Correct |
19 ms |
35072 KB |
Output is correct |
143 |
Correct |
18 ms |
35132 KB |
Output is correct |
144 |
Correct |
19 ms |
35096 KB |
Output is correct |
145 |
Correct |
19 ms |
35152 KB |
Output is correct |
146 |
Correct |
19 ms |
34916 KB |
Output is correct |
147 |
Correct |
19 ms |
35072 KB |
Output is correct |
148 |
Correct |
21 ms |
35152 KB |
Output is correct |
149 |
Correct |
22 ms |
35176 KB |
Output is correct |
150 |
Correct |
20 ms |
35152 KB |
Output is correct |
151 |
Correct |
19 ms |
35152 KB |
Output is correct |
152 |
Correct |
19 ms |
35072 KB |
Output is correct |
153 |
Correct |
19 ms |
35152 KB |
Output is correct |
154 |
Correct |
20 ms |
35128 KB |
Output is correct |
155 |
Correct |
21 ms |
35136 KB |
Output is correct |
156 |
Correct |
19 ms |
35104 KB |
Output is correct |
157 |
Correct |
1054 ms |
54160 KB |
Output is correct |
158 |
Correct |
1262 ms |
56616 KB |
Output is correct |
159 |
Correct |
1038 ms |
56644 KB |
Output is correct |
160 |
Correct |
995 ms |
56672 KB |
Output is correct |
161 |
Correct |
1207 ms |
56628 KB |
Output is correct |
162 |
Correct |
1298 ms |
56648 KB |
Output is correct |
163 |
Correct |
1299 ms |
56632 KB |
Output is correct |
164 |
Correct |
1807 ms |
56736 KB |
Output is correct |
165 |
Correct |
1936 ms |
57036 KB |
Output is correct |
166 |
Correct |
1819 ms |
56652 KB |
Output is correct |
167 |
Correct |
1719 ms |
56880 KB |
Output is correct |
168 |
Correct |
17 ms |
34768 KB |
Output is correct |
169 |
Correct |
1014 ms |
41956 KB |
Output is correct |
170 |
Correct |
1473 ms |
56692 KB |
Output is correct |
171 |
Correct |
1529 ms |
56648 KB |
Output is correct |
172 |
Correct |
1726 ms |
56652 KB |
Output is correct |
173 |
Correct |
1652 ms |
56676 KB |
Output is correct |
174 |
Correct |
1443 ms |
56616 KB |
Output is correct |
175 |
Correct |
1398 ms |
56632 KB |
Output is correct |
176 |
Correct |
1677 ms |
56640 KB |
Output is correct |
177 |
Correct |
1938 ms |
57024 KB |
Output is correct |
178 |
Correct |
1617 ms |
56656 KB |
Output is correct |
179 |
Correct |
1342 ms |
56892 KB |
Output is correct |