#include <bits/stdc++.h>
using namespace std;
template <size_t N>
struct OrSegmentTree
{
bitset<2 * N> t;
bool operator[](size_t i) { return t[N + i]; }
void reset() { t.reset(); }
void set(size_t i, bool x)
{
t[i += N] = x;
while (i >>= 1)
t[i] = t[2 * i] | t[2 * i + 1];
}
int64_t previous_nonzero(size_t i)
{
i += N;
do
{
if ((i & 1) && t[i - 1])
{
--i;
while (i < N)
i = 2 * i + t[2 * i + 1];
return i - N;
}
} while ((i >>= 1) > 1);
return -1;
}
int64_t next_nonzero(size_t i)
{
i += N;
do
{
if (!(i & 1) && t[i + 1])
{
++i;
while (i < N)
i = 2 * i + !t[2 * i];
return i - N;
}
} while ((i >>= 1) > 1);
return N;
}
};
constexpr size_t N = 300000, K = 2400;
uint32_t a[N], freq[N], freq_of_freq[N];
uint64_t ans[N];
tuple<size_t, size_t, size_t> queries[N];
OrSegmentTree<N> tree;
inline uint64_t gauss(uint64_t n) { return (n * (n + 1)) / 2; }
inline uint64_t range_gauss(uint64_t a, uint64_t b)
{
return gauss(b) - (a ? gauss(a - 1) : 0);
}
inline uint64_t sum_of_squares(uint64_t n) { return (n * (n + 1) * ((n << 1) + 1)) / 6; }
inline uint64_t range_cost(uint64_t l0, uint64_t y, uint64_t z, uint64_t n)
{
return -range_gauss(l0, l0 + z * y - 1) - z * l0 * l0 - 2 * l0 * y * gauss(z - 1) -
y * y * sum_of_squares(z - 1) + z * n * (l0 + y) + y * n * gauss(z - 1);
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
size_t n, q;
cin >> n >> q;
for (size_t i = 0; i < n; ++i)
cin >> a[i], --a[i];
for (size_t i = 0; i < q; ++i)
cin >> get<0>(queries[i]) >> get<1>(queries[i]), --get<0>(queries[i]), --get<1>(queries[i]),
get<2>(queries[i]) = i;
sort(queries, queries + q, [](auto const &a, auto const &b)
{ return get<0>(a) / K == get<0>(b) / K ? get<1>(a) > get<1>(b) : get<0>(a) < get<0>(b); });
size_t i = 0, j = 0;
freq[a[0]] = 1;
freq_of_freq[1] = 1;
tree.set(freq[a[0]], 1);
for (size_t k = 0; k < q; ++k)
{
auto const [u, v, qi] = queries[k];
while (j < v)
{
++j;
freq[a[j]]++;
freq_of_freq[freq[a[j]] - 1]--;
freq_of_freq[freq[a[j]]]++;
if (!freq_of_freq[freq[a[j]] - 1])
tree.set(freq[a[j]] - 1, 0);
if (freq_of_freq[freq[a[j]]] == 1)
tree.set(freq[a[j]], 1);
}
while (i > u)
{
--i;
freq[a[i]]++;
freq_of_freq[freq[a[i]] - 1]--;
freq_of_freq[freq[a[i]]]++;
if (!freq_of_freq[freq[a[i]] - 1])
tree.set(freq[a[i]] - 1, 0);
if (freq_of_freq[freq[a[i]]] == 1)
tree.set(freq[a[i]], 1);
}
while (j > v)
{
freq_of_freq[freq[a[j]]]--;
freq_of_freq[freq[a[j]] - 1]++;
if (!freq_of_freq[freq[a[j]]])
tree.set(freq[a[j]], 0);
if (freq_of_freq[freq[a[j]] - 1] == 1)
tree.set(freq[a[j]] - 1, 1);
freq[a[j]]--;
--j;
}
while (i < u)
{
freq_of_freq[freq[a[i]]]--;
freq_of_freq[freq[a[i]] - 1]++;
if (!freq_of_freq[freq[a[i]]])
tree.set(freq[a[i]], 0);
if (freq_of_freq[freq[a[i]] - 1] == 1)
tree.set(freq[a[i]] - 1, 1);
freq[a[i]]--;
++i;
}
vector<pair<uint64_t, uint64_t>> y;
size_t i = tree.next_nonzero(0);
while (i < N)
{
y.emplace_back(i, freq_of_freq[i]);
i = tree.next_nonzero(i);
}
uint64_t lsum = 0, rsum = 0, cost = 0;
for (auto const &[freq, num] : y)
if (freq)
{
size_t num_left, num_right;
if (lsum < rsum)
num_right = num / 2, num_left = num - num_right;
else
num_left = num / 2, num_right = num - num_left;
cost += range_cost(lsum, freq, num_left, v - u + 1);
cost += range_cost((v - u + 1) - rsum - num_right * freq, freq, num_right, v - u + 1);
lsum += num_left * freq;
rsum += num_right * freq;
}
ans[qi] = cost;
}
for (size_t i = 0; i < q; ++i)
cout << ans[i] << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
0 ms |
340 KB |
Output is correct |
4 |
Correct |
0 ms |
340 KB |
Output is correct |
5 |
Correct |
0 ms |
340 KB |
Output is correct |
6 |
Correct |
0 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
0 ms |
340 KB |
Output is correct |
9 |
Correct |
0 ms |
340 KB |
Output is correct |
10 |
Correct |
0 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
2 ms |
340 KB |
Output is correct |
4 |
Correct |
13 ms |
852 KB |
Output is correct |
5 |
Correct |
27 ms |
1364 KB |
Output is correct |
6 |
Correct |
41 ms |
1728 KB |
Output is correct |
7 |
Correct |
41 ms |
2104 KB |
Output is correct |
8 |
Correct |
41 ms |
1684 KB |
Output is correct |
9 |
Correct |
40 ms |
1672 KB |
Output is correct |
10 |
Correct |
43 ms |
1896 KB |
Output is correct |
11 |
Correct |
45 ms |
1740 KB |
Output is correct |
12 |
Correct |
41 ms |
1752 KB |
Output is correct |
13 |
Correct |
48 ms |
1716 KB |
Output is correct |
14 |
Correct |
41 ms |
1744 KB |
Output is correct |
15 |
Correct |
40 ms |
1740 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
2 ms |
340 KB |
Output is correct |
4 |
Correct |
13 ms |
852 KB |
Output is correct |
5 |
Correct |
27 ms |
1364 KB |
Output is correct |
6 |
Correct |
41 ms |
1728 KB |
Output is correct |
7 |
Correct |
41 ms |
2104 KB |
Output is correct |
8 |
Correct |
41 ms |
1684 KB |
Output is correct |
9 |
Correct |
40 ms |
1672 KB |
Output is correct |
10 |
Correct |
43 ms |
1896 KB |
Output is correct |
11 |
Correct |
45 ms |
1740 KB |
Output is correct |
12 |
Correct |
41 ms |
1752 KB |
Output is correct |
13 |
Correct |
48 ms |
1716 KB |
Output is correct |
14 |
Correct |
41 ms |
1744 KB |
Output is correct |
15 |
Correct |
40 ms |
1740 KB |
Output is correct |
16 |
Correct |
0 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Correct |
2 ms |
340 KB |
Output is correct |
19 |
Correct |
14 ms |
724 KB |
Output is correct |
20 |
Correct |
28 ms |
1196 KB |
Output is correct |
21 |
Correct |
41 ms |
1740 KB |
Output is correct |
22 |
Correct |
41 ms |
1676 KB |
Output is correct |
23 |
Correct |
42 ms |
1668 KB |
Output is correct |
24 |
Correct |
41 ms |
1568 KB |
Output is correct |
25 |
Correct |
41 ms |
1676 KB |
Output is correct |
26 |
Correct |
41 ms |
1664 KB |
Output is correct |
27 |
Correct |
41 ms |
1664 KB |
Output is correct |
28 |
Correct |
41 ms |
1816 KB |
Output is correct |
29 |
Correct |
41 ms |
1612 KB |
Output is correct |
30 |
Correct |
41 ms |
1660 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
2 ms |
340 KB |
Output is correct |
4 |
Correct |
13 ms |
852 KB |
Output is correct |
5 |
Correct |
27 ms |
1364 KB |
Output is correct |
6 |
Correct |
41 ms |
1728 KB |
Output is correct |
7 |
Correct |
41 ms |
2104 KB |
Output is correct |
8 |
Correct |
41 ms |
1684 KB |
Output is correct |
9 |
Correct |
40 ms |
1672 KB |
Output is correct |
10 |
Correct |
43 ms |
1896 KB |
Output is correct |
11 |
Correct |
45 ms |
1740 KB |
Output is correct |
12 |
Correct |
41 ms |
1752 KB |
Output is correct |
13 |
Correct |
48 ms |
1716 KB |
Output is correct |
14 |
Correct |
41 ms |
1744 KB |
Output is correct |
15 |
Correct |
40 ms |
1740 KB |
Output is correct |
16 |
Correct |
0 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Correct |
2 ms |
340 KB |
Output is correct |
19 |
Correct |
14 ms |
724 KB |
Output is correct |
20 |
Correct |
28 ms |
1196 KB |
Output is correct |
21 |
Correct |
41 ms |
1740 KB |
Output is correct |
22 |
Correct |
41 ms |
1676 KB |
Output is correct |
23 |
Correct |
42 ms |
1668 KB |
Output is correct |
24 |
Correct |
41 ms |
1568 KB |
Output is correct |
25 |
Correct |
41 ms |
1676 KB |
Output is correct |
26 |
Correct |
41 ms |
1664 KB |
Output is correct |
27 |
Correct |
41 ms |
1664 KB |
Output is correct |
28 |
Correct |
41 ms |
1816 KB |
Output is correct |
29 |
Correct |
41 ms |
1612 KB |
Output is correct |
30 |
Correct |
41 ms |
1660 KB |
Output is correct |
31 |
Correct |
0 ms |
340 KB |
Output is correct |
32 |
Correct |
0 ms |
340 KB |
Output is correct |
33 |
Correct |
0 ms |
340 KB |
Output is correct |
34 |
Correct |
2 ms |
340 KB |
Output is correct |
35 |
Correct |
1 ms |
340 KB |
Output is correct |
36 |
Correct |
1 ms |
340 KB |
Output is correct |
37 |
Correct |
4 ms |
468 KB |
Output is correct |
38 |
Correct |
3 ms |
468 KB |
Output is correct |
39 |
Correct |
7 ms |
724 KB |
Output is correct |
40 |
Correct |
16 ms |
1160 KB |
Output is correct |
41 |
Correct |
24 ms |
1540 KB |
Output is correct |
42 |
Correct |
25 ms |
1540 KB |
Output is correct |
43 |
Correct |
25 ms |
1460 KB |
Output is correct |
44 |
Correct |
24 ms |
1544 KB |
Output is correct |
45 |
Correct |
26 ms |
1496 KB |
Output is correct |
46 |
Correct |
26 ms |
1540 KB |
Output is correct |
47 |
Correct |
26 ms |
1540 KB |
Output is correct |
48 |
Correct |
26 ms |
1540 KB |
Output is correct |
49 |
Correct |
25 ms |
1532 KB |
Output is correct |
50 |
Correct |
26 ms |
1536 KB |
Output is correct |
51 |
Correct |
28 ms |
1532 KB |
Output is correct |
52 |
Correct |
26 ms |
1572 KB |
Output is correct |
53 |
Correct |
26 ms |
1540 KB |
Output is correct |
54 |
Correct |
26 ms |
1548 KB |
Output is correct |
55 |
Correct |
28 ms |
1536 KB |
Output is correct |
56 |
Correct |
28 ms |
1600 KB |
Output is correct |
57 |
Correct |
26 ms |
1516 KB |
Output is correct |
58 |
Correct |
25 ms |
1496 KB |
Output is correct |
59 |
Correct |
24 ms |
1552 KB |
Output is correct |
60 |
Correct |
24 ms |
1472 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
0 ms |
340 KB |
Output is correct |
4 |
Correct |
0 ms |
340 KB |
Output is correct |
5 |
Correct |
0 ms |
340 KB |
Output is correct |
6 |
Correct |
0 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
0 ms |
340 KB |
Output is correct |
9 |
Correct |
0 ms |
340 KB |
Output is correct |
10 |
Correct |
0 ms |
340 KB |
Output is correct |
11 |
Correct |
0 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
2 ms |
340 KB |
Output is correct |
14 |
Correct |
13 ms |
852 KB |
Output is correct |
15 |
Correct |
27 ms |
1364 KB |
Output is correct |
16 |
Correct |
41 ms |
1728 KB |
Output is correct |
17 |
Correct |
41 ms |
2104 KB |
Output is correct |
18 |
Correct |
41 ms |
1684 KB |
Output is correct |
19 |
Correct |
40 ms |
1672 KB |
Output is correct |
20 |
Correct |
43 ms |
1896 KB |
Output is correct |
21 |
Correct |
45 ms |
1740 KB |
Output is correct |
22 |
Correct |
41 ms |
1752 KB |
Output is correct |
23 |
Correct |
48 ms |
1716 KB |
Output is correct |
24 |
Correct |
41 ms |
1744 KB |
Output is correct |
25 |
Correct |
40 ms |
1740 KB |
Output is correct |
26 |
Correct |
0 ms |
340 KB |
Output is correct |
27 |
Correct |
1 ms |
340 KB |
Output is correct |
28 |
Correct |
2 ms |
340 KB |
Output is correct |
29 |
Correct |
14 ms |
724 KB |
Output is correct |
30 |
Correct |
28 ms |
1196 KB |
Output is correct |
31 |
Correct |
41 ms |
1740 KB |
Output is correct |
32 |
Correct |
41 ms |
1676 KB |
Output is correct |
33 |
Correct |
42 ms |
1668 KB |
Output is correct |
34 |
Correct |
41 ms |
1568 KB |
Output is correct |
35 |
Correct |
41 ms |
1676 KB |
Output is correct |
36 |
Correct |
41 ms |
1664 KB |
Output is correct |
37 |
Correct |
41 ms |
1664 KB |
Output is correct |
38 |
Correct |
41 ms |
1816 KB |
Output is correct |
39 |
Correct |
41 ms |
1612 KB |
Output is correct |
40 |
Correct |
41 ms |
1660 KB |
Output is correct |
41 |
Correct |
0 ms |
340 KB |
Output is correct |
42 |
Correct |
0 ms |
340 KB |
Output is correct |
43 |
Correct |
0 ms |
340 KB |
Output is correct |
44 |
Correct |
2 ms |
340 KB |
Output is correct |
45 |
Correct |
1 ms |
340 KB |
Output is correct |
46 |
Correct |
1 ms |
340 KB |
Output is correct |
47 |
Correct |
4 ms |
468 KB |
Output is correct |
48 |
Correct |
3 ms |
468 KB |
Output is correct |
49 |
Correct |
7 ms |
724 KB |
Output is correct |
50 |
Correct |
16 ms |
1160 KB |
Output is correct |
51 |
Correct |
24 ms |
1540 KB |
Output is correct |
52 |
Correct |
25 ms |
1540 KB |
Output is correct |
53 |
Correct |
25 ms |
1460 KB |
Output is correct |
54 |
Correct |
24 ms |
1544 KB |
Output is correct |
55 |
Correct |
26 ms |
1496 KB |
Output is correct |
56 |
Correct |
26 ms |
1540 KB |
Output is correct |
57 |
Correct |
26 ms |
1540 KB |
Output is correct |
58 |
Correct |
26 ms |
1540 KB |
Output is correct |
59 |
Correct |
25 ms |
1532 KB |
Output is correct |
60 |
Correct |
26 ms |
1536 KB |
Output is correct |
61 |
Correct |
28 ms |
1532 KB |
Output is correct |
62 |
Correct |
26 ms |
1572 KB |
Output is correct |
63 |
Correct |
26 ms |
1540 KB |
Output is correct |
64 |
Correct |
26 ms |
1548 KB |
Output is correct |
65 |
Correct |
28 ms |
1536 KB |
Output is correct |
66 |
Correct |
28 ms |
1600 KB |
Output is correct |
67 |
Correct |
26 ms |
1516 KB |
Output is correct |
68 |
Correct |
25 ms |
1496 KB |
Output is correct |
69 |
Correct |
24 ms |
1552 KB |
Output is correct |
70 |
Correct |
24 ms |
1472 KB |
Output is correct |
71 |
Correct |
4 ms |
468 KB |
Output is correct |
72 |
Correct |
4 ms |
524 KB |
Output is correct |
73 |
Correct |
3 ms |
468 KB |
Output is correct |
74 |
Correct |
4 ms |
468 KB |
Output is correct |
75 |
Correct |
3 ms |
468 KB |
Output is correct |
76 |
Correct |
6 ms |
712 KB |
Output is correct |
77 |
Correct |
5 ms |
724 KB |
Output is correct |
78 |
Correct |
5 ms |
724 KB |
Output is correct |
79 |
Correct |
7 ms |
708 KB |
Output is correct |
80 |
Correct |
9 ms |
700 KB |
Output is correct |
81 |
Correct |
10 ms |
1108 KB |
Output is correct |
82 |
Correct |
11 ms |
1156 KB |
Output is correct |
83 |
Correct |
14 ms |
1088 KB |
Output is correct |
84 |
Correct |
10 ms |
1180 KB |
Output is correct |
85 |
Correct |
10 ms |
1100 KB |
Output is correct |
86 |
Correct |
11 ms |
1144 KB |
Output is correct |
87 |
Correct |
11 ms |
1196 KB |
Output is correct |
88 |
Correct |
12 ms |
1236 KB |
Output is correct |
89 |
Correct |
11 ms |
1144 KB |
Output is correct |
90 |
Correct |
11 ms |
1184 KB |
Output is correct |
91 |
Correct |
17 ms |
1824 KB |
Output is correct |
92 |
Correct |
18 ms |
1908 KB |
Output is correct |
93 |
Correct |
16 ms |
1976 KB |
Output is correct |
94 |
Correct |
24 ms |
1888 KB |
Output is correct |
95 |
Correct |
16 ms |
1928 KB |
Output is correct |
96 |
Correct |
20 ms |
2280 KB |
Output is correct |
97 |
Correct |
19 ms |
2208 KB |
Output is correct |
98 |
Correct |
19 ms |
2260 KB |
Output is correct |
99 |
Correct |
20 ms |
2260 KB |
Output is correct |
100 |
Correct |
19 ms |
2260 KB |
Output is correct |
101 |
Correct |
19 ms |
2264 KB |
Output is correct |
102 |
Correct |
19 ms |
2300 KB |
Output is correct |
103 |
Correct |
19 ms |
2244 KB |
Output is correct |
104 |
Correct |
19 ms |
2260 KB |
Output is correct |
105 |
Correct |
20 ms |
2204 KB |
Output is correct |
106 |
Correct |
19 ms |
2464 KB |
Output is correct |
107 |
Correct |
19 ms |
2448 KB |
Output is correct |
108 |
Correct |
18 ms |
2480 KB |
Output is correct |
109 |
Correct |
19 ms |
2516 KB |
Output is correct |
110 |
Correct |
19 ms |
2444 KB |
Output is correct |
111 |
Correct |
19 ms |
2396 KB |
Output is correct |
112 |
Correct |
19 ms |
2492 KB |
Output is correct |
113 |
Correct |
19 ms |
2516 KB |
Output is correct |
114 |
Correct |
22 ms |
2424 KB |
Output is correct |
115 |
Correct |
19 ms |
2428 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
0 ms |
340 KB |
Output is correct |
4 |
Correct |
0 ms |
340 KB |
Output is correct |
5 |
Correct |
0 ms |
340 KB |
Output is correct |
6 |
Correct |
0 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
0 ms |
340 KB |
Output is correct |
9 |
Correct |
0 ms |
340 KB |
Output is correct |
10 |
Correct |
0 ms |
340 KB |
Output is correct |
11 |
Correct |
0 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
2 ms |
340 KB |
Output is correct |
14 |
Correct |
13 ms |
852 KB |
Output is correct |
15 |
Correct |
27 ms |
1364 KB |
Output is correct |
16 |
Correct |
41 ms |
1728 KB |
Output is correct |
17 |
Correct |
41 ms |
2104 KB |
Output is correct |
18 |
Correct |
41 ms |
1684 KB |
Output is correct |
19 |
Correct |
40 ms |
1672 KB |
Output is correct |
20 |
Correct |
43 ms |
1896 KB |
Output is correct |
21 |
Correct |
45 ms |
1740 KB |
Output is correct |
22 |
Correct |
41 ms |
1752 KB |
Output is correct |
23 |
Correct |
48 ms |
1716 KB |
Output is correct |
24 |
Correct |
41 ms |
1744 KB |
Output is correct |
25 |
Correct |
40 ms |
1740 KB |
Output is correct |
26 |
Correct |
0 ms |
340 KB |
Output is correct |
27 |
Correct |
1 ms |
340 KB |
Output is correct |
28 |
Correct |
2 ms |
340 KB |
Output is correct |
29 |
Correct |
14 ms |
724 KB |
Output is correct |
30 |
Correct |
28 ms |
1196 KB |
Output is correct |
31 |
Correct |
41 ms |
1740 KB |
Output is correct |
32 |
Correct |
41 ms |
1676 KB |
Output is correct |
33 |
Correct |
42 ms |
1668 KB |
Output is correct |
34 |
Correct |
41 ms |
1568 KB |
Output is correct |
35 |
Correct |
41 ms |
1676 KB |
Output is correct |
36 |
Correct |
41 ms |
1664 KB |
Output is correct |
37 |
Correct |
41 ms |
1664 KB |
Output is correct |
38 |
Correct |
41 ms |
1816 KB |
Output is correct |
39 |
Correct |
41 ms |
1612 KB |
Output is correct |
40 |
Correct |
41 ms |
1660 KB |
Output is correct |
41 |
Correct |
0 ms |
340 KB |
Output is correct |
42 |
Correct |
0 ms |
340 KB |
Output is correct |
43 |
Correct |
0 ms |
340 KB |
Output is correct |
44 |
Correct |
2 ms |
340 KB |
Output is correct |
45 |
Correct |
1 ms |
340 KB |
Output is correct |
46 |
Correct |
1 ms |
340 KB |
Output is correct |
47 |
Correct |
4 ms |
468 KB |
Output is correct |
48 |
Correct |
3 ms |
468 KB |
Output is correct |
49 |
Correct |
7 ms |
724 KB |
Output is correct |
50 |
Correct |
16 ms |
1160 KB |
Output is correct |
51 |
Correct |
24 ms |
1540 KB |
Output is correct |
52 |
Correct |
25 ms |
1540 KB |
Output is correct |
53 |
Correct |
25 ms |
1460 KB |
Output is correct |
54 |
Correct |
24 ms |
1544 KB |
Output is correct |
55 |
Correct |
26 ms |
1496 KB |
Output is correct |
56 |
Correct |
26 ms |
1540 KB |
Output is correct |
57 |
Correct |
26 ms |
1540 KB |
Output is correct |
58 |
Correct |
26 ms |
1540 KB |
Output is correct |
59 |
Correct |
25 ms |
1532 KB |
Output is correct |
60 |
Correct |
26 ms |
1536 KB |
Output is correct |
61 |
Correct |
28 ms |
1532 KB |
Output is correct |
62 |
Correct |
26 ms |
1572 KB |
Output is correct |
63 |
Correct |
26 ms |
1540 KB |
Output is correct |
64 |
Correct |
26 ms |
1548 KB |
Output is correct |
65 |
Correct |
28 ms |
1536 KB |
Output is correct |
66 |
Correct |
28 ms |
1600 KB |
Output is correct |
67 |
Correct |
26 ms |
1516 KB |
Output is correct |
68 |
Correct |
25 ms |
1496 KB |
Output is correct |
69 |
Correct |
24 ms |
1552 KB |
Output is correct |
70 |
Correct |
24 ms |
1472 KB |
Output is correct |
71 |
Correct |
4 ms |
468 KB |
Output is correct |
72 |
Correct |
4 ms |
524 KB |
Output is correct |
73 |
Correct |
3 ms |
468 KB |
Output is correct |
74 |
Correct |
4 ms |
468 KB |
Output is correct |
75 |
Correct |
3 ms |
468 KB |
Output is correct |
76 |
Correct |
6 ms |
712 KB |
Output is correct |
77 |
Correct |
5 ms |
724 KB |
Output is correct |
78 |
Correct |
5 ms |
724 KB |
Output is correct |
79 |
Correct |
7 ms |
708 KB |
Output is correct |
80 |
Correct |
9 ms |
700 KB |
Output is correct |
81 |
Correct |
10 ms |
1108 KB |
Output is correct |
82 |
Correct |
11 ms |
1156 KB |
Output is correct |
83 |
Correct |
14 ms |
1088 KB |
Output is correct |
84 |
Correct |
10 ms |
1180 KB |
Output is correct |
85 |
Correct |
10 ms |
1100 KB |
Output is correct |
86 |
Correct |
11 ms |
1144 KB |
Output is correct |
87 |
Correct |
11 ms |
1196 KB |
Output is correct |
88 |
Correct |
12 ms |
1236 KB |
Output is correct |
89 |
Correct |
11 ms |
1144 KB |
Output is correct |
90 |
Correct |
11 ms |
1184 KB |
Output is correct |
91 |
Correct |
17 ms |
1824 KB |
Output is correct |
92 |
Correct |
18 ms |
1908 KB |
Output is correct |
93 |
Correct |
16 ms |
1976 KB |
Output is correct |
94 |
Correct |
24 ms |
1888 KB |
Output is correct |
95 |
Correct |
16 ms |
1928 KB |
Output is correct |
96 |
Correct |
20 ms |
2280 KB |
Output is correct |
97 |
Correct |
19 ms |
2208 KB |
Output is correct |
98 |
Correct |
19 ms |
2260 KB |
Output is correct |
99 |
Correct |
20 ms |
2260 KB |
Output is correct |
100 |
Correct |
19 ms |
2260 KB |
Output is correct |
101 |
Correct |
19 ms |
2264 KB |
Output is correct |
102 |
Correct |
19 ms |
2300 KB |
Output is correct |
103 |
Correct |
19 ms |
2244 KB |
Output is correct |
104 |
Correct |
19 ms |
2260 KB |
Output is correct |
105 |
Correct |
20 ms |
2204 KB |
Output is correct |
106 |
Correct |
19 ms |
2464 KB |
Output is correct |
107 |
Correct |
19 ms |
2448 KB |
Output is correct |
108 |
Correct |
18 ms |
2480 KB |
Output is correct |
109 |
Correct |
19 ms |
2516 KB |
Output is correct |
110 |
Correct |
19 ms |
2444 KB |
Output is correct |
111 |
Correct |
19 ms |
2396 KB |
Output is correct |
112 |
Correct |
19 ms |
2492 KB |
Output is correct |
113 |
Correct |
19 ms |
2516 KB |
Output is correct |
114 |
Correct |
22 ms |
2424 KB |
Output is correct |
115 |
Correct |
19 ms |
2428 KB |
Output is correct |
116 |
Correct |
3034 ms |
2356 KB |
Output is correct |
117 |
Correct |
2037 ms |
2352 KB |
Output is correct |
118 |
Correct |
3469 ms |
2644 KB |
Output is correct |
119 |
Correct |
1066 ms |
2648 KB |
Output is correct |
120 |
Correct |
520 ms |
2648 KB |
Output is correct |
121 |
Correct |
887 ms |
2856 KB |
Output is correct |
122 |
Correct |
441 ms |
2952 KB |
Output is correct |
123 |
Correct |
1709 ms |
3364 KB |
Output is correct |
124 |
Correct |
343 ms |
3404 KB |
Output is correct |
125 |
Correct |
209 ms |
3388 KB |
Output is correct |
126 |
Correct |
6322 ms |
3652 KB |
Output is correct |
127 |
Correct |
6245 ms |
5380 KB |
Output is correct |
128 |
Correct |
6242 ms |
5376 KB |
Output is correct |
129 |
Correct |
6272 ms |
5376 KB |
Output is correct |
130 |
Correct |
6149 ms |
5392 KB |
Output is correct |
131 |
Correct |
4933 ms |
5596 KB |
Output is correct |
132 |
Correct |
4868 ms |
5540 KB |
Output is correct |
133 |
Correct |
5252 ms |
5512 KB |
Output is correct |
134 |
Correct |
4981 ms |
5516 KB |
Output is correct |
135 |
Correct |
5021 ms |
5540 KB |
Output is correct |
136 |
Correct |
4709 ms |
5540 KB |
Output is correct |
137 |
Correct |
4970 ms |
5548 KB |
Output is correct |
138 |
Correct |
4720 ms |
5536 KB |
Output is correct |
139 |
Correct |
4974 ms |
5524 KB |
Output is correct |
140 |
Correct |
4882 ms |
5536 KB |
Output is correct |
141 |
Correct |
2658 ms |
5564 KB |
Output is correct |
142 |
Correct |
2823 ms |
5580 KB |
Output is correct |
143 |
Correct |
2798 ms |
5592 KB |
Output is correct |
144 |
Correct |
2766 ms |
5572 KB |
Output is correct |
145 |
Correct |
2706 ms |
5552 KB |
Output is correct |
146 |
Correct |
516 ms |
5820 KB |
Output is correct |
147 |
Correct |
499 ms |
5820 KB |
Output is correct |
148 |
Correct |
549 ms |
5824 KB |
Output is correct |
149 |
Correct |
481 ms |
5824 KB |
Output is correct |
150 |
Correct |
510 ms |
5824 KB |
Output is correct |
151 |
Correct |
311 ms |
5860 KB |
Output is correct |
152 |
Correct |
319 ms |
5824 KB |
Output is correct |
153 |
Correct |
319 ms |
5836 KB |
Output is correct |
154 |
Correct |
322 ms |
5860 KB |
Output is correct |
155 |
Correct |
300 ms |
5868 KB |
Output is correct |
156 |
Correct |
2730 ms |
6436 KB |
Output is correct |
157 |
Correct |
2706 ms |
6456 KB |
Output is correct |
158 |
Correct |
2796 ms |
6380 KB |
Output is correct |
159 |
Correct |
2736 ms |
6396 KB |
Output is correct |
160 |
Correct |
2680 ms |
6392 KB |
Output is correct |
161 |
Correct |
3591 ms |
6532 KB |
Output is correct |
162 |
Correct |
3568 ms |
6456 KB |
Output is correct |
163 |
Correct |
3607 ms |
6432 KB |
Output is correct |
164 |
Correct |
3604 ms |
6452 KB |
Output is correct |
165 |
Correct |
3534 ms |
6416 KB |
Output is correct |
166 |
Correct |
5028 ms |
6092 KB |
Output is correct |
167 |
Correct |
4966 ms |
6052 KB |
Output is correct |
168 |
Correct |
4954 ms |
6308 KB |
Output is correct |
169 |
Correct |
5117 ms |
6084 KB |
Output is correct |
170 |
Correct |
5191 ms |
6068 KB |
Output is correct |
171 |
Correct |
6430 ms |
6000 KB |
Output is correct |
172 |
Correct |
6445 ms |
6008 KB |
Output is correct |
173 |
Correct |
6441 ms |
6008 KB |
Output is correct |
174 |
Correct |
6451 ms |
6012 KB |
Output is correct |
175 |
Correct |
6383 ms |
6048 KB |
Output is correct |