#include "towers.h"
#include <algorithm>
#include <iostream>
#include <vector>
typedef long long ll;
using namespace std;
const int maxn = 1 << 17, inf = 1e9 + 5;
struct node1 { int mi, mx, dix, dxi; node1() { mi = inf, mx = -inf, dix = 0, dxi = 0; } };
vector<node1> tmx(maxn * 2);
vector<int> h;
node1 merge(node1 l, node1 r)
{
node1 n;
n.mi = min(l.mi, r.mi);
n.mx = max(l.mx, r.mx);
n.dix = max({ l.dix, r.dix, r.mx - l.mi });
n.dxi = max({ l.dxi, r.dxi, l.mx - r.mi });
return n;
}
node1 query(int l, int r)
{
node1 n1, n2;
for (l += maxn, r += maxn + 1; l < r; l >>= 1, r >>= 1)
{
if (l & 1) n1 = merge(n1, tmx[l++]);
if (r & 1) n2 = merge(tmx[--r], n2);
}
return merge(n1, n2);
}
struct node2 { int tim, mi, mx; };
bool cmp(node2 a, node2 b) { return a.tim < b.tim; }
bool cmp2(node2 a, int t) { return a.tim < t; }
vector<vector<node2> > tr(maxn * 2);
void update(int i, int t, int x)
{
for (i += maxn; i > 0; i >>= 1) tr[i].push_back({ t, x, x });
}
void upd(int vr, int t, int& mi, int& mx, int& cnt)
{
int i = lower_bound(tr[vr].begin(), tr[vr].end(), t, cmp2) - tr[vr].begin();
if (i == tr[vr].size()) return;
mi = min(mi, tr[vr][i].mi), mx = max(mx, tr[vr][i].mx), cnt += tr[vr].size() - i;
}
void query(int l, int r, int t, int& mi, int& mx, int& cnt)
{
for (l += maxn, r += maxn + 1; l < r; l >>= 1, r >>= 1)
{
if (l & 1) upd(l++, t, mi, mx, cnt);
if (r & 1) upd(--r, t, mi, mx, cnt);
}
}
void init(int n, vector<int> H)
{
h = H;
for (int i = 0; i < n; i++) tmx[maxn + i].mi = tmx[maxn + i].mx = h[i];
for (int i = maxn - 1; i > 0; i--) tmx[i] = merge(tmx[(i << 1)], tmx[(i << 1) | 1]);
vector<int> l(n, -1), r(n, n);
vector<int> st;
for (int i = 0; i < n; i++)
{
while (!st.empty() && h[st.back()] > h[i]) st.pop_back();
if (!st.empty()) l[i] = st.back();
st.push_back(i);
}
st.clear();
for (int i = n - 1; i >= 0; i--)
{
while (!st.empty() && h[st.back()] > h[i]) st.pop_back();
if (!st.empty()) r[i] = st.back();
st.push_back(i);
}
for (int i = 0; i < n; i++)
{
int ml = (l[i] == -1 ? inf : query(l[i] + 1, i - 1).mx), mr = (r[i] == n - 1 ? inf : query(i + 1, r[i] - 1).mx);
int t = max(0, min(ml - h[i], mr - h[i]));
update(i, t, i);
}
for (int i = 0; i < maxn * 2; i++)
{
sort(tr[i].begin(), tr[i].end(), cmp);
for (int j = (int)tr[i].size() - 2; j >= 0; j--) tr[i][j].mi = min(tr[i][j].mi, tr[i][j + 1].mi), tr[i][j].mx = max(tr[i][j].mx, tr[i][j + 1].mx);
}
}
int max_towers(int l, int r, int d)
{
int lo = l, hi = r + 1;
while (lo < hi) // chceme najst prvy index...
{
int m = (lo + hi) / 2;
if (query(l, m).dix >= d) hi = m; // mozeme ist nizsie
else lo = m + 1;
}
int li = lo;
lo = l - 1, hi = r;
while (lo < hi) // chceme najst posledny index...
{
int m = (lo + hi + 1) / 2;
if (query(m, r).dxi >= d) lo = m; // mozeme ist vyssie
else hi = m - 1;
}
int ri = lo;
int mi = inf, mx = -inf, cnt = 0;
query(l, r, d, mi, mx, cnt);
if (cnt == 0) return 1 + (int)(li <= ri);
if (query(li, mi).mx >= h[mi] + d) cnt++;
if (query(mx, ri).mx >= h[mx] + d) cnt++;
return cnt;
}
Compilation message
towers.cpp: In function 'void upd(int, int, int&, int&, int&)':
towers.cpp:42:8: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<node2>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
42 | if (i == tr[vr].size()) return;
| ~~^~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
718 ms |
26420 KB |
Output is correct |
2 |
Correct |
1499 ms |
37204 KB |
Output is correct |
3 |
Correct |
2130 ms |
37164 KB |
Output is correct |
4 |
Correct |
1780 ms |
37164 KB |
Output is correct |
5 |
Correct |
1658 ms |
37172 KB |
Output is correct |
6 |
Correct |
1292 ms |
37168 KB |
Output is correct |
7 |
Correct |
1519 ms |
37164 KB |
Output is correct |
8 |
Correct |
7 ms |
10576 KB |
Output is correct |
9 |
Correct |
9 ms |
11088 KB |
Output is correct |
10 |
Correct |
8 ms |
11088 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
10700 KB |
Output is correct |
2 |
Correct |
10 ms |
11088 KB |
Output is correct |
3 |
Correct |
9 ms |
11088 KB |
Output is correct |
4 |
Correct |
9 ms |
11024 KB |
Output is correct |
5 |
Correct |
9 ms |
11040 KB |
Output is correct |
6 |
Correct |
9 ms |
11036 KB |
Output is correct |
7 |
Correct |
11 ms |
11088 KB |
Output is correct |
8 |
Correct |
9 ms |
11116 KB |
Output is correct |
9 |
Correct |
8 ms |
11088 KB |
Output is correct |
10 |
Correct |
8 ms |
11088 KB |
Output is correct |
11 |
Correct |
8 ms |
11088 KB |
Output is correct |
12 |
Correct |
7 ms |
10576 KB |
Output is correct |
13 |
Correct |
8 ms |
11112 KB |
Output is correct |
14 |
Correct |
8 ms |
11068 KB |
Output is correct |
15 |
Correct |
12 ms |
11088 KB |
Output is correct |
16 |
Correct |
9 ms |
11088 KB |
Output is correct |
17 |
Correct |
9 ms |
11088 KB |
Output is correct |
18 |
Correct |
8 ms |
11088 KB |
Output is correct |
19 |
Correct |
9 ms |
11088 KB |
Output is correct |
20 |
Correct |
9 ms |
10976 KB |
Output is correct |
21 |
Correct |
9 ms |
11088 KB |
Output is correct |
22 |
Correct |
8 ms |
10976 KB |
Output is correct |
23 |
Correct |
8 ms |
10996 KB |
Output is correct |
24 |
Correct |
8 ms |
11088 KB |
Output is correct |
25 |
Correct |
8 ms |
10724 KB |
Output is correct |
26 |
Correct |
8 ms |
11088 KB |
Output is correct |
27 |
Correct |
9 ms |
11088 KB |
Output is correct |
28 |
Correct |
9 ms |
11088 KB |
Output is correct |
29 |
Correct |
9 ms |
10976 KB |
Output is correct |
30 |
Correct |
9 ms |
11088 KB |
Output is correct |
31 |
Correct |
10 ms |
11068 KB |
Output is correct |
32 |
Correct |
9 ms |
11088 KB |
Output is correct |
33 |
Correct |
8 ms |
11088 KB |
Output is correct |
34 |
Correct |
9 ms |
11088 KB |
Output is correct |
35 |
Correct |
9 ms |
11064 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
10700 KB |
Output is correct |
2 |
Correct |
10 ms |
11088 KB |
Output is correct |
3 |
Correct |
9 ms |
11088 KB |
Output is correct |
4 |
Correct |
9 ms |
11024 KB |
Output is correct |
5 |
Correct |
9 ms |
11040 KB |
Output is correct |
6 |
Correct |
9 ms |
11036 KB |
Output is correct |
7 |
Correct |
11 ms |
11088 KB |
Output is correct |
8 |
Correct |
9 ms |
11116 KB |
Output is correct |
9 |
Correct |
8 ms |
11088 KB |
Output is correct |
10 |
Correct |
8 ms |
11088 KB |
Output is correct |
11 |
Correct |
8 ms |
11088 KB |
Output is correct |
12 |
Correct |
7 ms |
10576 KB |
Output is correct |
13 |
Correct |
8 ms |
11112 KB |
Output is correct |
14 |
Correct |
8 ms |
11068 KB |
Output is correct |
15 |
Correct |
12 ms |
11088 KB |
Output is correct |
16 |
Correct |
9 ms |
11088 KB |
Output is correct |
17 |
Correct |
9 ms |
11088 KB |
Output is correct |
18 |
Correct |
8 ms |
11088 KB |
Output is correct |
19 |
Correct |
9 ms |
11088 KB |
Output is correct |
20 |
Correct |
9 ms |
10976 KB |
Output is correct |
21 |
Correct |
9 ms |
11088 KB |
Output is correct |
22 |
Correct |
8 ms |
10976 KB |
Output is correct |
23 |
Correct |
8 ms |
10996 KB |
Output is correct |
24 |
Correct |
8 ms |
11088 KB |
Output is correct |
25 |
Correct |
8 ms |
10724 KB |
Output is correct |
26 |
Correct |
8 ms |
11088 KB |
Output is correct |
27 |
Correct |
9 ms |
11088 KB |
Output is correct |
28 |
Correct |
9 ms |
11088 KB |
Output is correct |
29 |
Correct |
9 ms |
10976 KB |
Output is correct |
30 |
Correct |
9 ms |
11088 KB |
Output is correct |
31 |
Correct |
10 ms |
11068 KB |
Output is correct |
32 |
Correct |
9 ms |
11088 KB |
Output is correct |
33 |
Correct |
8 ms |
11088 KB |
Output is correct |
34 |
Correct |
9 ms |
11088 KB |
Output is correct |
35 |
Correct |
9 ms |
11064 KB |
Output is correct |
36 |
Correct |
89 ms |
27688 KB |
Output is correct |
37 |
Correct |
130 ms |
36860 KB |
Output is correct |
38 |
Correct |
128 ms |
36784 KB |
Output is correct |
39 |
Correct |
133 ms |
36848 KB |
Output is correct |
40 |
Correct |
138 ms |
36860 KB |
Output is correct |
41 |
Correct |
143 ms |
36792 KB |
Output is correct |
42 |
Correct |
145 ms |
36740 KB |
Output is correct |
43 |
Correct |
104 ms |
37168 KB |
Output is correct |
44 |
Correct |
100 ms |
37168 KB |
Output is correct |
45 |
Correct |
103 ms |
37028 KB |
Output is correct |
46 |
Correct |
104 ms |
37024 KB |
Output is correct |
47 |
Correct |
139 ms |
36796 KB |
Output is correct |
48 |
Correct |
137 ms |
36892 KB |
Output is correct |
49 |
Correct |
136 ms |
36792 KB |
Output is correct |
50 |
Correct |
101 ms |
37164 KB |
Output is correct |
51 |
Correct |
114 ms |
37164 KB |
Output is correct |
52 |
Correct |
128 ms |
36788 KB |
Output is correct |
53 |
Correct |
130 ms |
36772 KB |
Output is correct |
54 |
Correct |
135 ms |
36844 KB |
Output is correct |
55 |
Correct |
95 ms |
37172 KB |
Output is correct |
56 |
Correct |
107 ms |
37032 KB |
Output is correct |
57 |
Correct |
123 ms |
35968 KB |
Output is correct |
58 |
Correct |
129 ms |
36824 KB |
Output is correct |
59 |
Correct |
127 ms |
36776 KB |
Output is correct |
60 |
Correct |
134 ms |
36784 KB |
Output is correct |
61 |
Correct |
135 ms |
36756 KB |
Output is correct |
62 |
Correct |
134 ms |
36784 KB |
Output is correct |
63 |
Correct |
135 ms |
36784 KB |
Output is correct |
64 |
Correct |
106 ms |
37156 KB |
Output is correct |
65 |
Correct |
105 ms |
37172 KB |
Output is correct |
66 |
Correct |
105 ms |
37024 KB |
Output is correct |
67 |
Correct |
93 ms |
37160 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1193 ms |
36804 KB |
Output is correct |
2 |
Correct |
1603 ms |
36928 KB |
Output is correct |
3 |
Correct |
1521 ms |
36752 KB |
Output is correct |
4 |
Correct |
1480 ms |
36848 KB |
Output is correct |
5 |
Correct |
1566 ms |
36812 KB |
Output is correct |
6 |
Correct |
1468 ms |
36784 KB |
Output is correct |
7 |
Correct |
1533 ms |
36796 KB |
Output is correct |
8 |
Correct |
1307 ms |
37164 KB |
Output is correct |
9 |
Correct |
1646 ms |
37168 KB |
Output is correct |
10 |
Correct |
1434 ms |
37044 KB |
Output is correct |
11 |
Correct |
1470 ms |
37044 KB |
Output is correct |
12 |
Correct |
1489 ms |
37116 KB |
Output is correct |
13 |
Correct |
1492 ms |
37168 KB |
Output is correct |
14 |
Correct |
8 ms |
10624 KB |
Output is correct |
15 |
Correct |
8 ms |
11108 KB |
Output is correct |
16 |
Correct |
8 ms |
11088 KB |
Output is correct |
17 |
Correct |
127 ms |
36844 KB |
Output is correct |
18 |
Correct |
135 ms |
36784 KB |
Output is correct |
19 |
Correct |
142 ms |
36792 KB |
Output is correct |
20 |
Correct |
103 ms |
37228 KB |
Output is correct |
21 |
Correct |
104 ms |
37156 KB |
Output is correct |
22 |
Correct |
137 ms |
36796 KB |
Output is correct |
23 |
Correct |
135 ms |
36848 KB |
Output is correct |
24 |
Correct |
142 ms |
36920 KB |
Output is correct |
25 |
Correct |
95 ms |
37168 KB |
Output is correct |
26 |
Correct |
105 ms |
37060 KB |
Output is correct |
27 |
Correct |
10 ms |
11112 KB |
Output is correct |
28 |
Correct |
9 ms |
11088 KB |
Output is correct |
29 |
Correct |
8 ms |
11088 KB |
Output is correct |
30 |
Correct |
9 ms |
11120 KB |
Output is correct |
31 |
Correct |
9 ms |
11088 KB |
Output is correct |
32 |
Correct |
9 ms |
11112 KB |
Output is correct |
33 |
Correct |
9 ms |
11088 KB |
Output is correct |
34 |
Correct |
11 ms |
11088 KB |
Output is correct |
35 |
Correct |
8 ms |
11096 KB |
Output is correct |
36 |
Correct |
8 ms |
11000 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
327 ms |
16856 KB |
Output is correct |
2 |
Correct |
1280 ms |
36820 KB |
Output is correct |
3 |
Correct |
1334 ms |
36788 KB |
Output is correct |
4 |
Correct |
1253 ms |
36784 KB |
Output is correct |
5 |
Correct |
1246 ms |
36964 KB |
Output is correct |
6 |
Correct |
1226 ms |
36792 KB |
Output is correct |
7 |
Correct |
1207 ms |
36784 KB |
Output is correct |
8 |
Correct |
1332 ms |
37188 KB |
Output is correct |
9 |
Correct |
1283 ms |
37152 KB |
Output is correct |
10 |
Correct |
1197 ms |
37044 KB |
Output is correct |
11 |
Correct |
1283 ms |
37100 KB |
Output is correct |
12 |
Correct |
133 ms |
36796 KB |
Output is correct |
13 |
Correct |
135 ms |
36796 KB |
Output is correct |
14 |
Correct |
133 ms |
36796 KB |
Output is correct |
15 |
Correct |
94 ms |
37216 KB |
Output is correct |
16 |
Correct |
118 ms |
37032 KB |
Output is correct |
17 |
Correct |
123 ms |
35896 KB |
Output is correct |
18 |
Correct |
129 ms |
36792 KB |
Output is correct |
19 |
Correct |
138 ms |
36816 KB |
Output is correct |
20 |
Correct |
138 ms |
36892 KB |
Output is correct |
21 |
Correct |
134 ms |
36852 KB |
Output is correct |
22 |
Correct |
135 ms |
36816 KB |
Output is correct |
23 |
Correct |
134 ms |
36788 KB |
Output is correct |
24 |
Correct |
109 ms |
37144 KB |
Output is correct |
25 |
Correct |
96 ms |
37160 KB |
Output is correct |
26 |
Correct |
104 ms |
37036 KB |
Output is correct |
27 |
Correct |
95 ms |
37204 KB |
Output is correct |
28 |
Correct |
9 ms |
11088 KB |
Output is correct |
29 |
Correct |
9 ms |
11088 KB |
Output is correct |
30 |
Correct |
9 ms |
11100 KB |
Output is correct |
31 |
Correct |
9 ms |
11088 KB |
Output is correct |
32 |
Correct |
8 ms |
11008 KB |
Output is correct |
33 |
Correct |
7 ms |
10828 KB |
Output is correct |
34 |
Correct |
9 ms |
11088 KB |
Output is correct |
35 |
Correct |
9 ms |
11048 KB |
Output is correct |
36 |
Correct |
9 ms |
11088 KB |
Output is correct |
37 |
Correct |
9 ms |
11104 KB |
Output is correct |
38 |
Correct |
8 ms |
11088 KB |
Output is correct |
39 |
Correct |
9 ms |
11088 KB |
Output is correct |
40 |
Correct |
8 ms |
11088 KB |
Output is correct |
41 |
Correct |
8 ms |
11088 KB |
Output is correct |
42 |
Correct |
8 ms |
11088 KB |
Output is correct |
43 |
Correct |
8 ms |
11084 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
10700 KB |
Output is correct |
2 |
Correct |
10 ms |
11088 KB |
Output is correct |
3 |
Correct |
9 ms |
11088 KB |
Output is correct |
4 |
Correct |
9 ms |
11024 KB |
Output is correct |
5 |
Correct |
9 ms |
11040 KB |
Output is correct |
6 |
Correct |
9 ms |
11036 KB |
Output is correct |
7 |
Correct |
11 ms |
11088 KB |
Output is correct |
8 |
Correct |
9 ms |
11116 KB |
Output is correct |
9 |
Correct |
8 ms |
11088 KB |
Output is correct |
10 |
Correct |
8 ms |
11088 KB |
Output is correct |
11 |
Correct |
8 ms |
11088 KB |
Output is correct |
12 |
Correct |
7 ms |
10576 KB |
Output is correct |
13 |
Correct |
8 ms |
11112 KB |
Output is correct |
14 |
Correct |
8 ms |
11068 KB |
Output is correct |
15 |
Correct |
12 ms |
11088 KB |
Output is correct |
16 |
Correct |
9 ms |
11088 KB |
Output is correct |
17 |
Correct |
9 ms |
11088 KB |
Output is correct |
18 |
Correct |
8 ms |
11088 KB |
Output is correct |
19 |
Correct |
9 ms |
11088 KB |
Output is correct |
20 |
Correct |
9 ms |
10976 KB |
Output is correct |
21 |
Correct |
9 ms |
11088 KB |
Output is correct |
22 |
Correct |
8 ms |
10976 KB |
Output is correct |
23 |
Correct |
8 ms |
10996 KB |
Output is correct |
24 |
Correct |
8 ms |
11088 KB |
Output is correct |
25 |
Correct |
8 ms |
10724 KB |
Output is correct |
26 |
Correct |
8 ms |
11088 KB |
Output is correct |
27 |
Correct |
9 ms |
11088 KB |
Output is correct |
28 |
Correct |
9 ms |
11088 KB |
Output is correct |
29 |
Correct |
9 ms |
10976 KB |
Output is correct |
30 |
Correct |
9 ms |
11088 KB |
Output is correct |
31 |
Correct |
10 ms |
11068 KB |
Output is correct |
32 |
Correct |
9 ms |
11088 KB |
Output is correct |
33 |
Correct |
8 ms |
11088 KB |
Output is correct |
34 |
Correct |
9 ms |
11088 KB |
Output is correct |
35 |
Correct |
9 ms |
11064 KB |
Output is correct |
36 |
Correct |
89 ms |
27688 KB |
Output is correct |
37 |
Correct |
130 ms |
36860 KB |
Output is correct |
38 |
Correct |
128 ms |
36784 KB |
Output is correct |
39 |
Correct |
133 ms |
36848 KB |
Output is correct |
40 |
Correct |
138 ms |
36860 KB |
Output is correct |
41 |
Correct |
143 ms |
36792 KB |
Output is correct |
42 |
Correct |
145 ms |
36740 KB |
Output is correct |
43 |
Correct |
104 ms |
37168 KB |
Output is correct |
44 |
Correct |
100 ms |
37168 KB |
Output is correct |
45 |
Correct |
103 ms |
37028 KB |
Output is correct |
46 |
Correct |
104 ms |
37024 KB |
Output is correct |
47 |
Correct |
139 ms |
36796 KB |
Output is correct |
48 |
Correct |
137 ms |
36892 KB |
Output is correct |
49 |
Correct |
136 ms |
36792 KB |
Output is correct |
50 |
Correct |
101 ms |
37164 KB |
Output is correct |
51 |
Correct |
114 ms |
37164 KB |
Output is correct |
52 |
Correct |
128 ms |
36788 KB |
Output is correct |
53 |
Correct |
130 ms |
36772 KB |
Output is correct |
54 |
Correct |
135 ms |
36844 KB |
Output is correct |
55 |
Correct |
95 ms |
37172 KB |
Output is correct |
56 |
Correct |
107 ms |
37032 KB |
Output is correct |
57 |
Correct |
123 ms |
35968 KB |
Output is correct |
58 |
Correct |
129 ms |
36824 KB |
Output is correct |
59 |
Correct |
127 ms |
36776 KB |
Output is correct |
60 |
Correct |
134 ms |
36784 KB |
Output is correct |
61 |
Correct |
135 ms |
36756 KB |
Output is correct |
62 |
Correct |
134 ms |
36784 KB |
Output is correct |
63 |
Correct |
135 ms |
36784 KB |
Output is correct |
64 |
Correct |
106 ms |
37156 KB |
Output is correct |
65 |
Correct |
105 ms |
37172 KB |
Output is correct |
66 |
Correct |
105 ms |
37024 KB |
Output is correct |
67 |
Correct |
93 ms |
37160 KB |
Output is correct |
68 |
Correct |
1193 ms |
36804 KB |
Output is correct |
69 |
Correct |
1603 ms |
36928 KB |
Output is correct |
70 |
Correct |
1521 ms |
36752 KB |
Output is correct |
71 |
Correct |
1480 ms |
36848 KB |
Output is correct |
72 |
Correct |
1566 ms |
36812 KB |
Output is correct |
73 |
Correct |
1468 ms |
36784 KB |
Output is correct |
74 |
Correct |
1533 ms |
36796 KB |
Output is correct |
75 |
Correct |
1307 ms |
37164 KB |
Output is correct |
76 |
Correct |
1646 ms |
37168 KB |
Output is correct |
77 |
Correct |
1434 ms |
37044 KB |
Output is correct |
78 |
Correct |
1470 ms |
37044 KB |
Output is correct |
79 |
Correct |
1489 ms |
37116 KB |
Output is correct |
80 |
Correct |
1492 ms |
37168 KB |
Output is correct |
81 |
Correct |
8 ms |
10624 KB |
Output is correct |
82 |
Correct |
8 ms |
11108 KB |
Output is correct |
83 |
Correct |
8 ms |
11088 KB |
Output is correct |
84 |
Correct |
127 ms |
36844 KB |
Output is correct |
85 |
Correct |
135 ms |
36784 KB |
Output is correct |
86 |
Correct |
142 ms |
36792 KB |
Output is correct |
87 |
Correct |
103 ms |
37228 KB |
Output is correct |
88 |
Correct |
104 ms |
37156 KB |
Output is correct |
89 |
Correct |
137 ms |
36796 KB |
Output is correct |
90 |
Correct |
135 ms |
36848 KB |
Output is correct |
91 |
Correct |
142 ms |
36920 KB |
Output is correct |
92 |
Correct |
95 ms |
37168 KB |
Output is correct |
93 |
Correct |
105 ms |
37060 KB |
Output is correct |
94 |
Correct |
10 ms |
11112 KB |
Output is correct |
95 |
Correct |
9 ms |
11088 KB |
Output is correct |
96 |
Correct |
8 ms |
11088 KB |
Output is correct |
97 |
Correct |
9 ms |
11120 KB |
Output is correct |
98 |
Correct |
9 ms |
11088 KB |
Output is correct |
99 |
Correct |
9 ms |
11112 KB |
Output is correct |
100 |
Correct |
9 ms |
11088 KB |
Output is correct |
101 |
Correct |
11 ms |
11088 KB |
Output is correct |
102 |
Correct |
8 ms |
11096 KB |
Output is correct |
103 |
Correct |
8 ms |
11000 KB |
Output is correct |
104 |
Correct |
1360 ms |
33888 KB |
Output is correct |
105 |
Correct |
1621 ms |
36784 KB |
Output is correct |
106 |
Correct |
1478 ms |
36848 KB |
Output is correct |
107 |
Correct |
1613 ms |
36848 KB |
Output is correct |
108 |
Correct |
1603 ms |
36788 KB |
Output is correct |
109 |
Correct |
1521 ms |
36848 KB |
Output is correct |
110 |
Correct |
1548 ms |
36848 KB |
Output is correct |
111 |
Correct |
1680 ms |
37172 KB |
Output is correct |
112 |
Correct |
1553 ms |
37208 KB |
Output is correct |
113 |
Correct |
1556 ms |
37000 KB |
Output is correct |
114 |
Correct |
1602 ms |
37300 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
718 ms |
26420 KB |
Output is correct |
2 |
Correct |
1499 ms |
37204 KB |
Output is correct |
3 |
Correct |
2130 ms |
37164 KB |
Output is correct |
4 |
Correct |
1780 ms |
37164 KB |
Output is correct |
5 |
Correct |
1658 ms |
37172 KB |
Output is correct |
6 |
Correct |
1292 ms |
37168 KB |
Output is correct |
7 |
Correct |
1519 ms |
37164 KB |
Output is correct |
8 |
Correct |
7 ms |
10576 KB |
Output is correct |
9 |
Correct |
9 ms |
11088 KB |
Output is correct |
10 |
Correct |
8 ms |
11088 KB |
Output is correct |
11 |
Correct |
7 ms |
10700 KB |
Output is correct |
12 |
Correct |
10 ms |
11088 KB |
Output is correct |
13 |
Correct |
9 ms |
11088 KB |
Output is correct |
14 |
Correct |
9 ms |
11024 KB |
Output is correct |
15 |
Correct |
9 ms |
11040 KB |
Output is correct |
16 |
Correct |
9 ms |
11036 KB |
Output is correct |
17 |
Correct |
11 ms |
11088 KB |
Output is correct |
18 |
Correct |
9 ms |
11116 KB |
Output is correct |
19 |
Correct |
8 ms |
11088 KB |
Output is correct |
20 |
Correct |
8 ms |
11088 KB |
Output is correct |
21 |
Correct |
8 ms |
11088 KB |
Output is correct |
22 |
Correct |
7 ms |
10576 KB |
Output is correct |
23 |
Correct |
8 ms |
11112 KB |
Output is correct |
24 |
Correct |
8 ms |
11068 KB |
Output is correct |
25 |
Correct |
12 ms |
11088 KB |
Output is correct |
26 |
Correct |
9 ms |
11088 KB |
Output is correct |
27 |
Correct |
9 ms |
11088 KB |
Output is correct |
28 |
Correct |
8 ms |
11088 KB |
Output is correct |
29 |
Correct |
9 ms |
11088 KB |
Output is correct |
30 |
Correct |
9 ms |
10976 KB |
Output is correct |
31 |
Correct |
9 ms |
11088 KB |
Output is correct |
32 |
Correct |
8 ms |
10976 KB |
Output is correct |
33 |
Correct |
8 ms |
10996 KB |
Output is correct |
34 |
Correct |
8 ms |
11088 KB |
Output is correct |
35 |
Correct |
8 ms |
10724 KB |
Output is correct |
36 |
Correct |
8 ms |
11088 KB |
Output is correct |
37 |
Correct |
9 ms |
11088 KB |
Output is correct |
38 |
Correct |
9 ms |
11088 KB |
Output is correct |
39 |
Correct |
9 ms |
10976 KB |
Output is correct |
40 |
Correct |
9 ms |
11088 KB |
Output is correct |
41 |
Correct |
10 ms |
11068 KB |
Output is correct |
42 |
Correct |
9 ms |
11088 KB |
Output is correct |
43 |
Correct |
8 ms |
11088 KB |
Output is correct |
44 |
Correct |
9 ms |
11088 KB |
Output is correct |
45 |
Correct |
9 ms |
11064 KB |
Output is correct |
46 |
Correct |
89 ms |
27688 KB |
Output is correct |
47 |
Correct |
130 ms |
36860 KB |
Output is correct |
48 |
Correct |
128 ms |
36784 KB |
Output is correct |
49 |
Correct |
133 ms |
36848 KB |
Output is correct |
50 |
Correct |
138 ms |
36860 KB |
Output is correct |
51 |
Correct |
143 ms |
36792 KB |
Output is correct |
52 |
Correct |
145 ms |
36740 KB |
Output is correct |
53 |
Correct |
104 ms |
37168 KB |
Output is correct |
54 |
Correct |
100 ms |
37168 KB |
Output is correct |
55 |
Correct |
103 ms |
37028 KB |
Output is correct |
56 |
Correct |
104 ms |
37024 KB |
Output is correct |
57 |
Correct |
139 ms |
36796 KB |
Output is correct |
58 |
Correct |
137 ms |
36892 KB |
Output is correct |
59 |
Correct |
136 ms |
36792 KB |
Output is correct |
60 |
Correct |
101 ms |
37164 KB |
Output is correct |
61 |
Correct |
114 ms |
37164 KB |
Output is correct |
62 |
Correct |
128 ms |
36788 KB |
Output is correct |
63 |
Correct |
130 ms |
36772 KB |
Output is correct |
64 |
Correct |
135 ms |
36844 KB |
Output is correct |
65 |
Correct |
95 ms |
37172 KB |
Output is correct |
66 |
Correct |
107 ms |
37032 KB |
Output is correct |
67 |
Correct |
123 ms |
35968 KB |
Output is correct |
68 |
Correct |
129 ms |
36824 KB |
Output is correct |
69 |
Correct |
127 ms |
36776 KB |
Output is correct |
70 |
Correct |
134 ms |
36784 KB |
Output is correct |
71 |
Correct |
135 ms |
36756 KB |
Output is correct |
72 |
Correct |
134 ms |
36784 KB |
Output is correct |
73 |
Correct |
135 ms |
36784 KB |
Output is correct |
74 |
Correct |
106 ms |
37156 KB |
Output is correct |
75 |
Correct |
105 ms |
37172 KB |
Output is correct |
76 |
Correct |
105 ms |
37024 KB |
Output is correct |
77 |
Correct |
93 ms |
37160 KB |
Output is correct |
78 |
Correct |
1193 ms |
36804 KB |
Output is correct |
79 |
Correct |
1603 ms |
36928 KB |
Output is correct |
80 |
Correct |
1521 ms |
36752 KB |
Output is correct |
81 |
Correct |
1480 ms |
36848 KB |
Output is correct |
82 |
Correct |
1566 ms |
36812 KB |
Output is correct |
83 |
Correct |
1468 ms |
36784 KB |
Output is correct |
84 |
Correct |
1533 ms |
36796 KB |
Output is correct |
85 |
Correct |
1307 ms |
37164 KB |
Output is correct |
86 |
Correct |
1646 ms |
37168 KB |
Output is correct |
87 |
Correct |
1434 ms |
37044 KB |
Output is correct |
88 |
Correct |
1470 ms |
37044 KB |
Output is correct |
89 |
Correct |
1489 ms |
37116 KB |
Output is correct |
90 |
Correct |
1492 ms |
37168 KB |
Output is correct |
91 |
Correct |
8 ms |
10624 KB |
Output is correct |
92 |
Correct |
8 ms |
11108 KB |
Output is correct |
93 |
Correct |
8 ms |
11088 KB |
Output is correct |
94 |
Correct |
127 ms |
36844 KB |
Output is correct |
95 |
Correct |
135 ms |
36784 KB |
Output is correct |
96 |
Correct |
142 ms |
36792 KB |
Output is correct |
97 |
Correct |
103 ms |
37228 KB |
Output is correct |
98 |
Correct |
104 ms |
37156 KB |
Output is correct |
99 |
Correct |
137 ms |
36796 KB |
Output is correct |
100 |
Correct |
135 ms |
36848 KB |
Output is correct |
101 |
Correct |
142 ms |
36920 KB |
Output is correct |
102 |
Correct |
95 ms |
37168 KB |
Output is correct |
103 |
Correct |
105 ms |
37060 KB |
Output is correct |
104 |
Correct |
10 ms |
11112 KB |
Output is correct |
105 |
Correct |
9 ms |
11088 KB |
Output is correct |
106 |
Correct |
8 ms |
11088 KB |
Output is correct |
107 |
Correct |
9 ms |
11120 KB |
Output is correct |
108 |
Correct |
9 ms |
11088 KB |
Output is correct |
109 |
Correct |
9 ms |
11112 KB |
Output is correct |
110 |
Correct |
9 ms |
11088 KB |
Output is correct |
111 |
Correct |
11 ms |
11088 KB |
Output is correct |
112 |
Correct |
8 ms |
11096 KB |
Output is correct |
113 |
Correct |
8 ms |
11000 KB |
Output is correct |
114 |
Correct |
327 ms |
16856 KB |
Output is correct |
115 |
Correct |
1280 ms |
36820 KB |
Output is correct |
116 |
Correct |
1334 ms |
36788 KB |
Output is correct |
117 |
Correct |
1253 ms |
36784 KB |
Output is correct |
118 |
Correct |
1246 ms |
36964 KB |
Output is correct |
119 |
Correct |
1226 ms |
36792 KB |
Output is correct |
120 |
Correct |
1207 ms |
36784 KB |
Output is correct |
121 |
Correct |
1332 ms |
37188 KB |
Output is correct |
122 |
Correct |
1283 ms |
37152 KB |
Output is correct |
123 |
Correct |
1197 ms |
37044 KB |
Output is correct |
124 |
Correct |
1283 ms |
37100 KB |
Output is correct |
125 |
Correct |
133 ms |
36796 KB |
Output is correct |
126 |
Correct |
135 ms |
36796 KB |
Output is correct |
127 |
Correct |
133 ms |
36796 KB |
Output is correct |
128 |
Correct |
94 ms |
37216 KB |
Output is correct |
129 |
Correct |
118 ms |
37032 KB |
Output is correct |
130 |
Correct |
123 ms |
35896 KB |
Output is correct |
131 |
Correct |
129 ms |
36792 KB |
Output is correct |
132 |
Correct |
138 ms |
36816 KB |
Output is correct |
133 |
Correct |
138 ms |
36892 KB |
Output is correct |
134 |
Correct |
134 ms |
36852 KB |
Output is correct |
135 |
Correct |
135 ms |
36816 KB |
Output is correct |
136 |
Correct |
134 ms |
36788 KB |
Output is correct |
137 |
Correct |
109 ms |
37144 KB |
Output is correct |
138 |
Correct |
96 ms |
37160 KB |
Output is correct |
139 |
Correct |
104 ms |
37036 KB |
Output is correct |
140 |
Correct |
95 ms |
37204 KB |
Output is correct |
141 |
Correct |
9 ms |
11088 KB |
Output is correct |
142 |
Correct |
9 ms |
11088 KB |
Output is correct |
143 |
Correct |
9 ms |
11100 KB |
Output is correct |
144 |
Correct |
9 ms |
11088 KB |
Output is correct |
145 |
Correct |
8 ms |
11008 KB |
Output is correct |
146 |
Correct |
7 ms |
10828 KB |
Output is correct |
147 |
Correct |
9 ms |
11088 KB |
Output is correct |
148 |
Correct |
9 ms |
11048 KB |
Output is correct |
149 |
Correct |
9 ms |
11088 KB |
Output is correct |
150 |
Correct |
9 ms |
11104 KB |
Output is correct |
151 |
Correct |
8 ms |
11088 KB |
Output is correct |
152 |
Correct |
9 ms |
11088 KB |
Output is correct |
153 |
Correct |
8 ms |
11088 KB |
Output is correct |
154 |
Correct |
8 ms |
11088 KB |
Output is correct |
155 |
Correct |
8 ms |
11088 KB |
Output is correct |
156 |
Correct |
8 ms |
11084 KB |
Output is correct |
157 |
Correct |
1360 ms |
33888 KB |
Output is correct |
158 |
Correct |
1621 ms |
36784 KB |
Output is correct |
159 |
Correct |
1478 ms |
36848 KB |
Output is correct |
160 |
Correct |
1613 ms |
36848 KB |
Output is correct |
161 |
Correct |
1603 ms |
36788 KB |
Output is correct |
162 |
Correct |
1521 ms |
36848 KB |
Output is correct |
163 |
Correct |
1548 ms |
36848 KB |
Output is correct |
164 |
Correct |
1680 ms |
37172 KB |
Output is correct |
165 |
Correct |
1553 ms |
37208 KB |
Output is correct |
166 |
Correct |
1556 ms |
37000 KB |
Output is correct |
167 |
Correct |
1602 ms |
37300 KB |
Output is correct |
168 |
Correct |
7 ms |
10576 KB |
Output is correct |
169 |
Correct |
905 ms |
19664 KB |
Output is correct |
170 |
Correct |
1354 ms |
36788 KB |
Output is correct |
171 |
Correct |
1713 ms |
36848 KB |
Output is correct |
172 |
Correct |
1671 ms |
36852 KB |
Output is correct |
173 |
Correct |
1664 ms |
36792 KB |
Output is correct |
174 |
Correct |
1564 ms |
36852 KB |
Output is correct |
175 |
Correct |
1647 ms |
36844 KB |
Output is correct |
176 |
Correct |
1743 ms |
37132 KB |
Output is correct |
177 |
Correct |
1637 ms |
37176 KB |
Output is correct |
178 |
Correct |
1507 ms |
37084 KB |
Output is correct |
179 |
Correct |
1514 ms |
37024 KB |
Output is correct |