#include "bits/stdc++.h"
using namespace std;
#ifdef Nero
#include "Deb.h"
#else
#define deb(...)
#endif
const int B = 450;
const int N = 3e5 + 5;
int a[N];
int freq[N];
int tot_freq[N];
long long res[N];
int cnt_freq[B + 1];
vector<int> large_vals;
inline int64_t hilbertOrder(int x, int y, int pow, int rotate) {
if (pow == 0) {
return 0;
}
int hpow = 1 << (pow - 1);
int seg = (x < hpow) ? ((y < hpow) ? 0 : 3) : ((y < hpow) ? 1 : 2);
seg = (seg + rotate) & 3;
const int rotateDelta[4] = {3, 0, 0, 1};
int nx = x & (x ^ hpow), ny = y & (y ^ hpow);
int nrot = (rotate + rotateDelta[seg]) & 3;
int64_t subSquareSize = int64_t(1) << (2 * pow - 2);
int64_t ans = seg * subSquareSize;
int64_t add = hilbertOrder(nx, ny, pow - 1, nrot);
ans += (seg == 1 || seg == 2) ? add : (subSquareSize - add - 1);
return ans;
}
struct Query{
int l, r, id;
int64_t ord;
inline void calcOrder() {
ord = hilbertOrder(l, r, 18, 0);
}
};
inline bool operator<(const Query &x, const Query &y){
return x.ord < y.ord;
}
inline void modify(int i, int v) {
if (freq[a[i]] && tot_freq[a[i]] <= B) {
cnt_freq[freq[a[i]]]--;
}
freq[a[i]] += v;
if (freq[a[i]] && tot_freq[a[i]] <= B) {
cnt_freq[freq[a[i]]]++;
}
}
inline vector<pair<int, int>> construct() {
vector<pair<int, int>> left;
vector<pair<int, int>> right;
bool go_left = true;
vector<pair<int, int>> xz;
for (int i = 1; i <= B; ++i) {
if (cnt_freq[i]) {
xz.push_back({i, cnt_freq[i]});
}
}
for (int i : large_vals) {
if (freq[i]) {
xz.push_back({freq[i], 1});
}
}
sort(xz.begin(), xz.end());
for (auto [i, z] : xz) {
int x = z / 2;
int y = z - x;
if ((x + y) % 2 == 0) {
left.push_back({i, x});
right.push_back({i, x});
} else {
if (go_left) {
left.push_back({i, y});
if (x) {
right.push_back({i, x});
}
} else {
if (x) {
left.push_back({i, x});
}
right.push_back({i, y});
}
go_left ^= 1;
}
}
vector<pair<int, int>> ret = left;
reverse(right.begin(), right.end());
for (auto [x, y] : right) {
ret.push_back({x, y});
}
return ret;
}
inline long long prop(int x) {
return (long long) x * (x + 1) / 2;
}
inline long long get(vector<pair<int, int>>& v) {
long long ret = 0;
long long last = 0;
long long normal_sum = 0;
for (int i = (int) v.size() - 1; i >= 0; --i) {
long long tmp = 0;
auto [element_freq, rep] = v[i];
long long z = rep - 1;
tmp += (long long) element_freq * z * (z + 1) * (z + 2) / 6 * element_freq;
tmp += last * element_freq * rep;
tmp += normal_sum * element_freq * rep * (rep + 1) / 2;
last = (long long) (rep - 1) * rep / 2 * element_freq + last + normal_sum * rep;
ret += tmp;
normal_sum += (long long) v[i].first * v[i].second;
}
ret += prop(normal_sum);
return ret;
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, q;
cin >> n >> q;
for (int i = 0; i < n; ++i) {
cin >> a[i];
tot_freq[a[i]]++;
}
for (int i = 1; i < N; ++i) {
if (tot_freq[i] > B) {
large_vals.push_back(i);
}
}
vector<Query> qs(q);
for (int i = 0; i < q; ++i) {
int l, r;
cin >> l >> r;
--l, --r;
qs[i].l = l, qs[i].r = r;
qs[i].id = i;
qs[i].calcOrder();
}
sort(qs.begin(), qs.end());
int l = 0, r = -1;
for (auto &pq : qs) {
int ql = pq.l, qr = pq.r, id = pq.id;
while (l > ql) modify(--l, 1);
while (r < qr) modify(++r, 1);
while (l < ql) modify(l++, -1);
while (r > qr) modify(r--, -1);
vector<pair<int, int>> v = construct();
res[id] = get(v);
}
for (int i = 0; i < q; ++i) {
cout << res[i] << '\n';
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
5 ms |
724 KB |
Output is correct |
5 |
Correct |
8 ms |
1108 KB |
Output is correct |
6 |
Correct |
13 ms |
1440 KB |
Output is correct |
7 |
Correct |
14 ms |
1572 KB |
Output is correct |
8 |
Correct |
16 ms |
1464 KB |
Output is correct |
9 |
Correct |
13 ms |
1444 KB |
Output is correct |
10 |
Correct |
13 ms |
1492 KB |
Output is correct |
11 |
Correct |
13 ms |
1452 KB |
Output is correct |
12 |
Correct |
16 ms |
1492 KB |
Output is correct |
13 |
Correct |
18 ms |
1512 KB |
Output is correct |
14 |
Correct |
16 ms |
1492 KB |
Output is correct |
15 |
Correct |
13 ms |
1492 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
5 ms |
724 KB |
Output is correct |
5 |
Correct |
8 ms |
1108 KB |
Output is correct |
6 |
Correct |
13 ms |
1440 KB |
Output is correct |
7 |
Correct |
14 ms |
1572 KB |
Output is correct |
8 |
Correct |
16 ms |
1464 KB |
Output is correct |
9 |
Correct |
13 ms |
1444 KB |
Output is correct |
10 |
Correct |
13 ms |
1492 KB |
Output is correct |
11 |
Correct |
13 ms |
1452 KB |
Output is correct |
12 |
Correct |
16 ms |
1492 KB |
Output is correct |
13 |
Correct |
18 ms |
1512 KB |
Output is correct |
14 |
Correct |
16 ms |
1492 KB |
Output is correct |
15 |
Correct |
13 ms |
1492 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Correct |
1 ms |
340 KB |
Output is correct |
19 |
Correct |
6 ms |
724 KB |
Output is correct |
20 |
Correct |
10 ms |
1108 KB |
Output is correct |
21 |
Correct |
17 ms |
1384 KB |
Output is correct |
22 |
Correct |
14 ms |
1500 KB |
Output is correct |
23 |
Correct |
14 ms |
1492 KB |
Output is correct |
24 |
Correct |
14 ms |
1556 KB |
Output is correct |
25 |
Correct |
14 ms |
1476 KB |
Output is correct |
26 |
Correct |
14 ms |
1492 KB |
Output is correct |
27 |
Correct |
14 ms |
1468 KB |
Output is correct |
28 |
Correct |
14 ms |
1504 KB |
Output is correct |
29 |
Correct |
14 ms |
1496 KB |
Output is correct |
30 |
Correct |
14 ms |
1516 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
5 ms |
724 KB |
Output is correct |
5 |
Correct |
8 ms |
1108 KB |
Output is correct |
6 |
Correct |
13 ms |
1440 KB |
Output is correct |
7 |
Correct |
14 ms |
1572 KB |
Output is correct |
8 |
Correct |
16 ms |
1464 KB |
Output is correct |
9 |
Correct |
13 ms |
1444 KB |
Output is correct |
10 |
Correct |
13 ms |
1492 KB |
Output is correct |
11 |
Correct |
13 ms |
1452 KB |
Output is correct |
12 |
Correct |
16 ms |
1492 KB |
Output is correct |
13 |
Correct |
18 ms |
1512 KB |
Output is correct |
14 |
Correct |
16 ms |
1492 KB |
Output is correct |
15 |
Correct |
13 ms |
1492 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Correct |
1 ms |
340 KB |
Output is correct |
19 |
Correct |
6 ms |
724 KB |
Output is correct |
20 |
Correct |
10 ms |
1108 KB |
Output is correct |
21 |
Correct |
17 ms |
1384 KB |
Output is correct |
22 |
Correct |
14 ms |
1500 KB |
Output is correct |
23 |
Correct |
14 ms |
1492 KB |
Output is correct |
24 |
Correct |
14 ms |
1556 KB |
Output is correct |
25 |
Correct |
14 ms |
1476 KB |
Output is correct |
26 |
Correct |
14 ms |
1492 KB |
Output is correct |
27 |
Correct |
14 ms |
1468 KB |
Output is correct |
28 |
Correct |
14 ms |
1504 KB |
Output is correct |
29 |
Correct |
14 ms |
1496 KB |
Output is correct |
30 |
Correct |
14 ms |
1516 KB |
Output is correct |
31 |
Correct |
1 ms |
340 KB |
Output is correct |
32 |
Correct |
1 ms |
340 KB |
Output is correct |
33 |
Correct |
1 ms |
340 KB |
Output is correct |
34 |
Correct |
1 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 |
3 ms |
468 KB |
Output is correct |
38 |
Correct |
3 ms |
556 KB |
Output is correct |
39 |
Correct |
6 ms |
724 KB |
Output is correct |
40 |
Correct |
11 ms |
1108 KB |
Output is correct |
41 |
Correct |
17 ms |
1492 KB |
Output is correct |
42 |
Correct |
17 ms |
1492 KB |
Output is correct |
43 |
Correct |
17 ms |
1504 KB |
Output is correct |
44 |
Correct |
17 ms |
1456 KB |
Output is correct |
45 |
Correct |
17 ms |
1520 KB |
Output is correct |
46 |
Correct |
17 ms |
1492 KB |
Output is correct |
47 |
Correct |
21 ms |
1456 KB |
Output is correct |
48 |
Correct |
17 ms |
1488 KB |
Output is correct |
49 |
Correct |
17 ms |
1480 KB |
Output is correct |
50 |
Correct |
18 ms |
1540 KB |
Output is correct |
51 |
Correct |
17 ms |
1492 KB |
Output is correct |
52 |
Correct |
17 ms |
1444 KB |
Output is correct |
53 |
Correct |
17 ms |
1524 KB |
Output is correct |
54 |
Correct |
17 ms |
1492 KB |
Output is correct |
55 |
Correct |
17 ms |
1500 KB |
Output is correct |
56 |
Correct |
17 ms |
1480 KB |
Output is correct |
57 |
Correct |
17 ms |
1552 KB |
Output is correct |
58 |
Correct |
17 ms |
1492 KB |
Output is correct |
59 |
Correct |
17 ms |
1504 KB |
Output is correct |
60 |
Correct |
22 ms |
1528 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
5 ms |
724 KB |
Output is correct |
15 |
Correct |
8 ms |
1108 KB |
Output is correct |
16 |
Correct |
13 ms |
1440 KB |
Output is correct |
17 |
Correct |
14 ms |
1572 KB |
Output is correct |
18 |
Correct |
16 ms |
1464 KB |
Output is correct |
19 |
Correct |
13 ms |
1444 KB |
Output is correct |
20 |
Correct |
13 ms |
1492 KB |
Output is correct |
21 |
Correct |
13 ms |
1452 KB |
Output is correct |
22 |
Correct |
16 ms |
1492 KB |
Output is correct |
23 |
Correct |
18 ms |
1512 KB |
Output is correct |
24 |
Correct |
16 ms |
1492 KB |
Output is correct |
25 |
Correct |
13 ms |
1492 KB |
Output is correct |
26 |
Correct |
1 ms |
340 KB |
Output is correct |
27 |
Correct |
1 ms |
340 KB |
Output is correct |
28 |
Correct |
1 ms |
340 KB |
Output is correct |
29 |
Correct |
6 ms |
724 KB |
Output is correct |
30 |
Correct |
10 ms |
1108 KB |
Output is correct |
31 |
Correct |
17 ms |
1384 KB |
Output is correct |
32 |
Correct |
14 ms |
1500 KB |
Output is correct |
33 |
Correct |
14 ms |
1492 KB |
Output is correct |
34 |
Correct |
14 ms |
1556 KB |
Output is correct |
35 |
Correct |
14 ms |
1476 KB |
Output is correct |
36 |
Correct |
14 ms |
1492 KB |
Output is correct |
37 |
Correct |
14 ms |
1468 KB |
Output is correct |
38 |
Correct |
14 ms |
1504 KB |
Output is correct |
39 |
Correct |
14 ms |
1496 KB |
Output is correct |
40 |
Correct |
14 ms |
1516 KB |
Output is correct |
41 |
Correct |
1 ms |
340 KB |
Output is correct |
42 |
Correct |
1 ms |
340 KB |
Output is correct |
43 |
Correct |
1 ms |
340 KB |
Output is correct |
44 |
Correct |
1 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 |
3 ms |
468 KB |
Output is correct |
48 |
Correct |
3 ms |
556 KB |
Output is correct |
49 |
Correct |
6 ms |
724 KB |
Output is correct |
50 |
Correct |
11 ms |
1108 KB |
Output is correct |
51 |
Correct |
17 ms |
1492 KB |
Output is correct |
52 |
Correct |
17 ms |
1492 KB |
Output is correct |
53 |
Correct |
17 ms |
1504 KB |
Output is correct |
54 |
Correct |
17 ms |
1456 KB |
Output is correct |
55 |
Correct |
17 ms |
1520 KB |
Output is correct |
56 |
Correct |
17 ms |
1492 KB |
Output is correct |
57 |
Correct |
21 ms |
1456 KB |
Output is correct |
58 |
Correct |
17 ms |
1488 KB |
Output is correct |
59 |
Correct |
17 ms |
1480 KB |
Output is correct |
60 |
Correct |
18 ms |
1540 KB |
Output is correct |
61 |
Correct |
17 ms |
1492 KB |
Output is correct |
62 |
Correct |
17 ms |
1444 KB |
Output is correct |
63 |
Correct |
17 ms |
1524 KB |
Output is correct |
64 |
Correct |
17 ms |
1492 KB |
Output is correct |
65 |
Correct |
17 ms |
1500 KB |
Output is correct |
66 |
Correct |
17 ms |
1480 KB |
Output is correct |
67 |
Correct |
17 ms |
1552 KB |
Output is correct |
68 |
Correct |
17 ms |
1492 KB |
Output is correct |
69 |
Correct |
17 ms |
1504 KB |
Output is correct |
70 |
Correct |
22 ms |
1528 KB |
Output is correct |
71 |
Correct |
3 ms |
468 KB |
Output is correct |
72 |
Correct |
4 ms |
468 KB |
Output is correct |
73 |
Correct |
4 ms |
468 KB |
Output is correct |
74 |
Correct |
3 ms |
548 KB |
Output is correct |
75 |
Correct |
4 ms |
528 KB |
Output is correct |
76 |
Correct |
6 ms |
724 KB |
Output is correct |
77 |
Correct |
7 ms |
728 KB |
Output is correct |
78 |
Correct |
6 ms |
776 KB |
Output is correct |
79 |
Correct |
6 ms |
724 KB |
Output is correct |
80 |
Correct |
6 ms |
724 KB |
Output is correct |
81 |
Correct |
12 ms |
1148 KB |
Output is correct |
82 |
Correct |
12 ms |
1196 KB |
Output is correct |
83 |
Correct |
11 ms |
1108 KB |
Output is correct |
84 |
Correct |
12 ms |
1208 KB |
Output is correct |
85 |
Correct |
11 ms |
1108 KB |
Output is correct |
86 |
Correct |
13 ms |
1300 KB |
Output is correct |
87 |
Correct |
13 ms |
1216 KB |
Output is correct |
88 |
Correct |
13 ms |
1236 KB |
Output is correct |
89 |
Correct |
13 ms |
1204 KB |
Output is correct |
90 |
Correct |
13 ms |
1276 KB |
Output is correct |
91 |
Correct |
20 ms |
2248 KB |
Output is correct |
92 |
Correct |
21 ms |
2256 KB |
Output is correct |
93 |
Correct |
22 ms |
2264 KB |
Output is correct |
94 |
Correct |
21 ms |
2252 KB |
Output is correct |
95 |
Correct |
21 ms |
2260 KB |
Output is correct |
96 |
Correct |
25 ms |
3020 KB |
Output is correct |
97 |
Correct |
23 ms |
2960 KB |
Output is correct |
98 |
Correct |
23 ms |
3036 KB |
Output is correct |
99 |
Correct |
23 ms |
2952 KB |
Output is correct |
100 |
Correct |
23 ms |
3076 KB |
Output is correct |
101 |
Correct |
23 ms |
3028 KB |
Output is correct |
102 |
Correct |
23 ms |
3040 KB |
Output is correct |
103 |
Correct |
24 ms |
3068 KB |
Output is correct |
104 |
Correct |
24 ms |
3004 KB |
Output is correct |
105 |
Correct |
23 ms |
3028 KB |
Output is correct |
106 |
Correct |
25 ms |
3340 KB |
Output is correct |
107 |
Correct |
26 ms |
3400 KB |
Output is correct |
108 |
Correct |
23 ms |
3388 KB |
Output is correct |
109 |
Correct |
27 ms |
3368 KB |
Output is correct |
110 |
Correct |
23 ms |
3448 KB |
Output is correct |
111 |
Correct |
24 ms |
3420 KB |
Output is correct |
112 |
Correct |
22 ms |
3412 KB |
Output is correct |
113 |
Correct |
23 ms |
3456 KB |
Output is correct |
114 |
Correct |
24 ms |
3420 KB |
Output is correct |
115 |
Correct |
25 ms |
3364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
5 ms |
724 KB |
Output is correct |
15 |
Correct |
8 ms |
1108 KB |
Output is correct |
16 |
Correct |
13 ms |
1440 KB |
Output is correct |
17 |
Correct |
14 ms |
1572 KB |
Output is correct |
18 |
Correct |
16 ms |
1464 KB |
Output is correct |
19 |
Correct |
13 ms |
1444 KB |
Output is correct |
20 |
Correct |
13 ms |
1492 KB |
Output is correct |
21 |
Correct |
13 ms |
1452 KB |
Output is correct |
22 |
Correct |
16 ms |
1492 KB |
Output is correct |
23 |
Correct |
18 ms |
1512 KB |
Output is correct |
24 |
Correct |
16 ms |
1492 KB |
Output is correct |
25 |
Correct |
13 ms |
1492 KB |
Output is correct |
26 |
Correct |
1 ms |
340 KB |
Output is correct |
27 |
Correct |
1 ms |
340 KB |
Output is correct |
28 |
Correct |
1 ms |
340 KB |
Output is correct |
29 |
Correct |
6 ms |
724 KB |
Output is correct |
30 |
Correct |
10 ms |
1108 KB |
Output is correct |
31 |
Correct |
17 ms |
1384 KB |
Output is correct |
32 |
Correct |
14 ms |
1500 KB |
Output is correct |
33 |
Correct |
14 ms |
1492 KB |
Output is correct |
34 |
Correct |
14 ms |
1556 KB |
Output is correct |
35 |
Correct |
14 ms |
1476 KB |
Output is correct |
36 |
Correct |
14 ms |
1492 KB |
Output is correct |
37 |
Correct |
14 ms |
1468 KB |
Output is correct |
38 |
Correct |
14 ms |
1504 KB |
Output is correct |
39 |
Correct |
14 ms |
1496 KB |
Output is correct |
40 |
Correct |
14 ms |
1516 KB |
Output is correct |
41 |
Correct |
1 ms |
340 KB |
Output is correct |
42 |
Correct |
1 ms |
340 KB |
Output is correct |
43 |
Correct |
1 ms |
340 KB |
Output is correct |
44 |
Correct |
1 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 |
3 ms |
468 KB |
Output is correct |
48 |
Correct |
3 ms |
556 KB |
Output is correct |
49 |
Correct |
6 ms |
724 KB |
Output is correct |
50 |
Correct |
11 ms |
1108 KB |
Output is correct |
51 |
Correct |
17 ms |
1492 KB |
Output is correct |
52 |
Correct |
17 ms |
1492 KB |
Output is correct |
53 |
Correct |
17 ms |
1504 KB |
Output is correct |
54 |
Correct |
17 ms |
1456 KB |
Output is correct |
55 |
Correct |
17 ms |
1520 KB |
Output is correct |
56 |
Correct |
17 ms |
1492 KB |
Output is correct |
57 |
Correct |
21 ms |
1456 KB |
Output is correct |
58 |
Correct |
17 ms |
1488 KB |
Output is correct |
59 |
Correct |
17 ms |
1480 KB |
Output is correct |
60 |
Correct |
18 ms |
1540 KB |
Output is correct |
61 |
Correct |
17 ms |
1492 KB |
Output is correct |
62 |
Correct |
17 ms |
1444 KB |
Output is correct |
63 |
Correct |
17 ms |
1524 KB |
Output is correct |
64 |
Correct |
17 ms |
1492 KB |
Output is correct |
65 |
Correct |
17 ms |
1500 KB |
Output is correct |
66 |
Correct |
17 ms |
1480 KB |
Output is correct |
67 |
Correct |
17 ms |
1552 KB |
Output is correct |
68 |
Correct |
17 ms |
1492 KB |
Output is correct |
69 |
Correct |
17 ms |
1504 KB |
Output is correct |
70 |
Correct |
22 ms |
1528 KB |
Output is correct |
71 |
Correct |
3 ms |
468 KB |
Output is correct |
72 |
Correct |
4 ms |
468 KB |
Output is correct |
73 |
Correct |
4 ms |
468 KB |
Output is correct |
74 |
Correct |
3 ms |
548 KB |
Output is correct |
75 |
Correct |
4 ms |
528 KB |
Output is correct |
76 |
Correct |
6 ms |
724 KB |
Output is correct |
77 |
Correct |
7 ms |
728 KB |
Output is correct |
78 |
Correct |
6 ms |
776 KB |
Output is correct |
79 |
Correct |
6 ms |
724 KB |
Output is correct |
80 |
Correct |
6 ms |
724 KB |
Output is correct |
81 |
Correct |
12 ms |
1148 KB |
Output is correct |
82 |
Correct |
12 ms |
1196 KB |
Output is correct |
83 |
Correct |
11 ms |
1108 KB |
Output is correct |
84 |
Correct |
12 ms |
1208 KB |
Output is correct |
85 |
Correct |
11 ms |
1108 KB |
Output is correct |
86 |
Correct |
13 ms |
1300 KB |
Output is correct |
87 |
Correct |
13 ms |
1216 KB |
Output is correct |
88 |
Correct |
13 ms |
1236 KB |
Output is correct |
89 |
Correct |
13 ms |
1204 KB |
Output is correct |
90 |
Correct |
13 ms |
1276 KB |
Output is correct |
91 |
Correct |
20 ms |
2248 KB |
Output is correct |
92 |
Correct |
21 ms |
2256 KB |
Output is correct |
93 |
Correct |
22 ms |
2264 KB |
Output is correct |
94 |
Correct |
21 ms |
2252 KB |
Output is correct |
95 |
Correct |
21 ms |
2260 KB |
Output is correct |
96 |
Correct |
25 ms |
3020 KB |
Output is correct |
97 |
Correct |
23 ms |
2960 KB |
Output is correct |
98 |
Correct |
23 ms |
3036 KB |
Output is correct |
99 |
Correct |
23 ms |
2952 KB |
Output is correct |
100 |
Correct |
23 ms |
3076 KB |
Output is correct |
101 |
Correct |
23 ms |
3028 KB |
Output is correct |
102 |
Correct |
23 ms |
3040 KB |
Output is correct |
103 |
Correct |
24 ms |
3068 KB |
Output is correct |
104 |
Correct |
24 ms |
3004 KB |
Output is correct |
105 |
Correct |
23 ms |
3028 KB |
Output is correct |
106 |
Correct |
25 ms |
3340 KB |
Output is correct |
107 |
Correct |
26 ms |
3400 KB |
Output is correct |
108 |
Correct |
23 ms |
3388 KB |
Output is correct |
109 |
Correct |
27 ms |
3368 KB |
Output is correct |
110 |
Correct |
23 ms |
3448 KB |
Output is correct |
111 |
Correct |
24 ms |
3420 KB |
Output is correct |
112 |
Correct |
22 ms |
3412 KB |
Output is correct |
113 |
Correct |
23 ms |
3456 KB |
Output is correct |
114 |
Correct |
24 ms |
3420 KB |
Output is correct |
115 |
Correct |
25 ms |
3364 KB |
Output is correct |
116 |
Correct |
122 ms |
2348 KB |
Output is correct |
117 |
Correct |
148 ms |
2380 KB |
Output is correct |
118 |
Correct |
249 ms |
2648 KB |
Output is correct |
119 |
Correct |
319 ms |
2636 KB |
Output is correct |
120 |
Correct |
229 ms |
2676 KB |
Output is correct |
121 |
Correct |
383 ms |
2952 KB |
Output is correct |
122 |
Correct |
295 ms |
2888 KB |
Output is correct |
123 |
Correct |
889 ms |
3460 KB |
Output is correct |
124 |
Correct |
331 ms |
4988 KB |
Output is correct |
125 |
Correct |
273 ms |
5056 KB |
Output is correct |
126 |
Correct |
1185 ms |
5376 KB |
Output is correct |
127 |
Correct |
1172 ms |
5380 KB |
Output is correct |
128 |
Correct |
1224 ms |
5452 KB |
Output is correct |
129 |
Correct |
1303 ms |
5380 KB |
Output is correct |
130 |
Correct |
1254 ms |
5492 KB |
Output is correct |
131 |
Correct |
1717 ms |
5552 KB |
Output is correct |
132 |
Correct |
1698 ms |
5556 KB |
Output is correct |
133 |
Correct |
1614 ms |
5536 KB |
Output is correct |
134 |
Correct |
1708 ms |
5536 KB |
Output is correct |
135 |
Correct |
1681 ms |
5548 KB |
Output is correct |
136 |
Correct |
1709 ms |
5548 KB |
Output is correct |
137 |
Correct |
1657 ms |
5560 KB |
Output is correct |
138 |
Correct |
1697 ms |
5548 KB |
Output is correct |
139 |
Correct |
1667 ms |
5544 KB |
Output is correct |
140 |
Correct |
1660 ms |
5540 KB |
Output is correct |
141 |
Correct |
2303 ms |
5724 KB |
Output is correct |
142 |
Correct |
2288 ms |
5584 KB |
Output is correct |
143 |
Correct |
2323 ms |
5600 KB |
Output is correct |
144 |
Correct |
2264 ms |
5612 KB |
Output is correct |
145 |
Correct |
2288 ms |
5588 KB |
Output is correct |
146 |
Correct |
727 ms |
5872 KB |
Output is correct |
147 |
Correct |
718 ms |
5900 KB |
Output is correct |
148 |
Correct |
736 ms |
5880 KB |
Output is correct |
149 |
Correct |
698 ms |
5876 KB |
Output is correct |
150 |
Correct |
754 ms |
5876 KB |
Output is correct |
151 |
Correct |
644 ms |
5900 KB |
Output is correct |
152 |
Correct |
646 ms |
5956 KB |
Output is correct |
153 |
Correct |
695 ms |
6004 KB |
Output is correct |
154 |
Correct |
654 ms |
6044 KB |
Output is correct |
155 |
Correct |
674 ms |
5928 KB |
Output is correct |
156 |
Correct |
1736 ms |
6556 KB |
Output is correct |
157 |
Correct |
1773 ms |
6556 KB |
Output is correct |
158 |
Correct |
1737 ms |
6556 KB |
Output is correct |
159 |
Correct |
1746 ms |
6564 KB |
Output is correct |
160 |
Correct |
1722 ms |
6568 KB |
Output is correct |
161 |
Correct |
1403 ms |
6464 KB |
Output is correct |
162 |
Correct |
1448 ms |
6468 KB |
Output is correct |
163 |
Correct |
1393 ms |
6588 KB |
Output is correct |
164 |
Correct |
1418 ms |
6464 KB |
Output is correct |
165 |
Correct |
1458 ms |
6460 KB |
Output is correct |
166 |
Correct |
1724 ms |
6060 KB |
Output is correct |
167 |
Correct |
1775 ms |
6008 KB |
Output is correct |
168 |
Correct |
1740 ms |
6064 KB |
Output is correct |
169 |
Correct |
1697 ms |
6056 KB |
Output is correct |
170 |
Correct |
1736 ms |
6052 KB |
Output is correct |
171 |
Correct |
1307 ms |
5980 KB |
Output is correct |
172 |
Correct |
1295 ms |
5992 KB |
Output is correct |
173 |
Correct |
1294 ms |
6016 KB |
Output is correct |
174 |
Correct |
1311 ms |
5980 KB |
Output is correct |
175 |
Correct |
1299 ms |
6120 KB |
Output is correct |