#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize ("Ofast")
typedef long long ll;
const int MAXN = 3e5 + 1;
const int B = 700;
int a[MAXN], n, q;
array <int, 3> queries[MAXN];
ll ans[MAXN];
int freq[MAXN], freq2[2 * MAXN + 1];
vector <int> large;
void add (int x) {
freq2[freq[a[x]] + MAXN]--;
freq[a[x]]++;
freq2[freq[a[x]] + MAXN]++;
}
void rem (int x) {
freq2[freq[a[x]] + MAXN]--;
freq[a[x]]--;
freq2[freq[a[x]] + MAXN]++;
}
int main () {
ios::sync_with_stdio(0); cin.tie(0);
cin >> n >> q;
freq2[MAXN] = MAXN;
for (int i = 1; i <= n; i++) cin >> a[i], freq[a[i]]++;
for (int i = 1; i < MAXN; i++) {
if (freq[i] > B) {
large.push_back(i);
}
}
memset(freq, 0, sizeof(freq));
for (int i = 1; i <= q; i++) {
int l, r; cin >> l >> r;
queries[i] = {l, r, i};
}
sort(queries + 1, queries + q + 1, [&] (array <int, 3> &x, array <int, 3> &y) {
return x[0] / B == y[0] / B ? x[1] < y[1] : x[0] / B < y[0] / B;
});
int L = queries[1][0] + 1, R = queries[1][0];
for (int i = 1; i <= q; i++) {
while (L > queries[i][0]) add(--L);
while (L < queries[i][0]) rem(L++);
while (R > queries[i][1]) rem(R--);
while (R < queries[i][1]) add(++R);
ll dis = 0; ll n = R - L + 1;
vector <pair <ll, ll>> pp[2];
int c = 0;
for (int j = 1; j <= B; j++) {
dis += freq2[j + MAXN];
int x = j, y = freq2[j + MAXN];
if (y == 1) {
pp[c].push_back({x, 1});
c ^= 1;
} else {
int l = (y + 1) / 2, r = y / 2;
pp[c].push_back({x, l});
pp[c ^ 1].push_back({x, r});
c ^= (y & 1);
}
}
sort(large.begin(), large.end(), [&] (int x, int y) {
return freq[x] < freq[y];
});
for (auto j : large) {
if (!freq[j] || freq[j] <= B) continue;
dis++;
int x = freq[j], y = 1;
if (y == 1) {
pp[c].push_back({x, 1});
c ^= 1;
} else {
int l = (y + 1) / 2, r = y / 2;
pp[c].push_back({x, l});
pp[c ^ 1].push_back({x, r});
c ^= (y & 1);
}
}
reverse(pp[1].begin(), pp[1].end());
ll cur = 0, pref = 0;
for (auto [x, y] : pp[0]) {
cur += pref * pref * y + y * (y - 1) / 2 * 2 * pref * x + x * x * (y - 1) * y * (2 * y - 1) / 6 + y * pref + x * y * (y - 1) / 2;
cur += y * n * n - y * n * pref - n * y * (y + 1) / 2 * x + y * n;
cur += -y * n * pref + pref * pref * y + pref * y * (y + 1) / 2 * x - y * pref;
cur += -n * y * (y + 1) / 2 * x + y * (y + 1) / 2 * x * pref + x * x * y * (y + 1) * (2 * y + 1) / 6 - y * (y + 1) / 2 * x;
pref += x * y;
}
for (auto [x, y] : pp[1]) {
cur += pref * pref * y + y * (y - 1) / 2 * 2 * pref * x + x * x * (y - 1) * y * (2 * y - 1) / 6 + y * pref + x * y * (y - 1) / 2;
cur += y * n * n - y * n * pref - n * y * (y + 1) / 2 * x + y * n;
cur += -y * n * pref + pref * pref * y + pref * y * (y + 1) / 2 * x - y * pref;
cur += -n * y * (y + 1) / 2 * x + y * (y + 1) / 2 * x * pref + x * x * y * (y + 1) * (2 * y + 1) / 6 - y * (y + 1) / 2 * x;
pref += x * y;
}
ans[queries[i][2]] = n * (n + 1) / 2 * dis - cur / 2;
}
for (int i = 1; i <= q; i++) cout << ans[i] << '\n';
}
Compilation message
diversity.cpp: In function 'int main()':
diversity.cpp:82:13: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
82 | for (auto [x, y] : pp[0]) {
| ^
diversity.cpp:89:13: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
89 | for (auto [x, y] : pp[1]) {
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
8540 KB |
Output is correct |
2 |
Correct |
1 ms |
8540 KB |
Output is correct |
3 |
Correct |
1 ms |
8536 KB |
Output is correct |
4 |
Correct |
2 ms |
8540 KB |
Output is correct |
5 |
Correct |
1 ms |
8536 KB |
Output is correct |
6 |
Correct |
1 ms |
8540 KB |
Output is correct |
7 |
Correct |
2 ms |
8540 KB |
Output is correct |
8 |
Correct |
1 ms |
8540 KB |
Output is correct |
9 |
Correct |
2 ms |
8536 KB |
Output is correct |
10 |
Correct |
2 ms |
8540 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
8540 KB |
Output is correct |
2 |
Correct |
2 ms |
8536 KB |
Output is correct |
3 |
Correct |
5 ms |
8536 KB |
Output is correct |
4 |
Correct |
7 ms |
8792 KB |
Output is correct |
5 |
Correct |
16 ms |
9032 KB |
Output is correct |
6 |
Correct |
15 ms |
9308 KB |
Output is correct |
7 |
Correct |
14 ms |
9308 KB |
Output is correct |
8 |
Correct |
14 ms |
9308 KB |
Output is correct |
9 |
Correct |
14 ms |
9308 KB |
Output is correct |
10 |
Correct |
15 ms |
9228 KB |
Output is correct |
11 |
Correct |
18 ms |
9292 KB |
Output is correct |
12 |
Correct |
23 ms |
9308 KB |
Output is correct |
13 |
Correct |
15 ms |
9304 KB |
Output is correct |
14 |
Correct |
14 ms |
9304 KB |
Output is correct |
15 |
Correct |
14 ms |
9308 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
8540 KB |
Output is correct |
2 |
Correct |
2 ms |
8536 KB |
Output is correct |
3 |
Correct |
5 ms |
8536 KB |
Output is correct |
4 |
Correct |
7 ms |
8792 KB |
Output is correct |
5 |
Correct |
16 ms |
9032 KB |
Output is correct |
6 |
Correct |
15 ms |
9308 KB |
Output is correct |
7 |
Correct |
14 ms |
9308 KB |
Output is correct |
8 |
Correct |
14 ms |
9308 KB |
Output is correct |
9 |
Correct |
14 ms |
9308 KB |
Output is correct |
10 |
Correct |
15 ms |
9228 KB |
Output is correct |
11 |
Correct |
18 ms |
9292 KB |
Output is correct |
12 |
Correct |
23 ms |
9308 KB |
Output is correct |
13 |
Correct |
15 ms |
9304 KB |
Output is correct |
14 |
Correct |
14 ms |
9304 KB |
Output is correct |
15 |
Correct |
14 ms |
9308 KB |
Output is correct |
16 |
Correct |
2 ms |
8540 KB |
Output is correct |
17 |
Correct |
2 ms |
8656 KB |
Output is correct |
18 |
Correct |
2 ms |
8540 KB |
Output is correct |
19 |
Correct |
6 ms |
8796 KB |
Output is correct |
20 |
Correct |
11 ms |
9248 KB |
Output is correct |
21 |
Correct |
25 ms |
9492 KB |
Output is correct |
22 |
Correct |
17 ms |
9556 KB |
Output is correct |
23 |
Correct |
16 ms |
9564 KB |
Output is correct |
24 |
Correct |
16 ms |
9564 KB |
Output is correct |
25 |
Correct |
15 ms |
9564 KB |
Output is correct |
26 |
Correct |
16 ms |
9300 KB |
Output is correct |
27 |
Correct |
16 ms |
9568 KB |
Output is correct |
28 |
Correct |
16 ms |
9296 KB |
Output is correct |
29 |
Correct |
15 ms |
9172 KB |
Output is correct |
30 |
Correct |
15 ms |
9560 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
8540 KB |
Output is correct |
2 |
Correct |
2 ms |
8536 KB |
Output is correct |
3 |
Correct |
5 ms |
8536 KB |
Output is correct |
4 |
Correct |
7 ms |
8792 KB |
Output is correct |
5 |
Correct |
16 ms |
9032 KB |
Output is correct |
6 |
Correct |
15 ms |
9308 KB |
Output is correct |
7 |
Correct |
14 ms |
9308 KB |
Output is correct |
8 |
Correct |
14 ms |
9308 KB |
Output is correct |
9 |
Correct |
14 ms |
9308 KB |
Output is correct |
10 |
Correct |
15 ms |
9228 KB |
Output is correct |
11 |
Correct |
18 ms |
9292 KB |
Output is correct |
12 |
Correct |
23 ms |
9308 KB |
Output is correct |
13 |
Correct |
15 ms |
9304 KB |
Output is correct |
14 |
Correct |
14 ms |
9304 KB |
Output is correct |
15 |
Correct |
14 ms |
9308 KB |
Output is correct |
16 |
Correct |
2 ms |
8540 KB |
Output is correct |
17 |
Correct |
2 ms |
8656 KB |
Output is correct |
18 |
Correct |
2 ms |
8540 KB |
Output is correct |
19 |
Correct |
6 ms |
8796 KB |
Output is correct |
20 |
Correct |
11 ms |
9248 KB |
Output is correct |
21 |
Correct |
25 ms |
9492 KB |
Output is correct |
22 |
Correct |
17 ms |
9556 KB |
Output is correct |
23 |
Correct |
16 ms |
9564 KB |
Output is correct |
24 |
Correct |
16 ms |
9564 KB |
Output is correct |
25 |
Correct |
15 ms |
9564 KB |
Output is correct |
26 |
Correct |
16 ms |
9300 KB |
Output is correct |
27 |
Correct |
16 ms |
9568 KB |
Output is correct |
28 |
Correct |
16 ms |
9296 KB |
Output is correct |
29 |
Correct |
15 ms |
9172 KB |
Output is correct |
30 |
Correct |
15 ms |
9560 KB |
Output is correct |
31 |
Correct |
2 ms |
8656 KB |
Output is correct |
32 |
Correct |
2 ms |
8536 KB |
Output is correct |
33 |
Correct |
2 ms |
8540 KB |
Output is correct |
34 |
Correct |
2 ms |
8540 KB |
Output is correct |
35 |
Correct |
2 ms |
8536 KB |
Output is correct |
36 |
Correct |
2 ms |
8540 KB |
Output is correct |
37 |
Correct |
4 ms |
8796 KB |
Output is correct |
38 |
Correct |
4 ms |
8860 KB |
Output is correct |
39 |
Correct |
6 ms |
9052 KB |
Output is correct |
40 |
Correct |
12 ms |
9052 KB |
Output is correct |
41 |
Correct |
16 ms |
9820 KB |
Output is correct |
42 |
Correct |
17 ms |
9824 KB |
Output is correct |
43 |
Correct |
17 ms |
9704 KB |
Output is correct |
44 |
Correct |
16 ms |
9820 KB |
Output is correct |
45 |
Correct |
16 ms |
9792 KB |
Output is correct |
46 |
Correct |
16 ms |
9808 KB |
Output is correct |
47 |
Correct |
16 ms |
9812 KB |
Output is correct |
48 |
Correct |
16 ms |
9704 KB |
Output is correct |
49 |
Correct |
18 ms |
9812 KB |
Output is correct |
50 |
Correct |
16 ms |
9816 KB |
Output is correct |
51 |
Correct |
16 ms |
9816 KB |
Output is correct |
52 |
Correct |
17 ms |
9792 KB |
Output is correct |
53 |
Correct |
21 ms |
9820 KB |
Output is correct |
54 |
Correct |
17 ms |
9820 KB |
Output is correct |
55 |
Correct |
17 ms |
9644 KB |
Output is correct |
56 |
Correct |
16 ms |
9852 KB |
Output is correct |
57 |
Correct |
17 ms |
9820 KB |
Output is correct |
58 |
Correct |
17 ms |
9672 KB |
Output is correct |
59 |
Correct |
17 ms |
9816 KB |
Output is correct |
60 |
Correct |
17 ms |
9820 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
8540 KB |
Output is correct |
2 |
Correct |
1 ms |
8540 KB |
Output is correct |
3 |
Correct |
1 ms |
8536 KB |
Output is correct |
4 |
Correct |
2 ms |
8540 KB |
Output is correct |
5 |
Correct |
1 ms |
8536 KB |
Output is correct |
6 |
Correct |
1 ms |
8540 KB |
Output is correct |
7 |
Correct |
2 ms |
8540 KB |
Output is correct |
8 |
Correct |
1 ms |
8540 KB |
Output is correct |
9 |
Correct |
2 ms |
8536 KB |
Output is correct |
10 |
Correct |
2 ms |
8540 KB |
Output is correct |
11 |
Correct |
1 ms |
8540 KB |
Output is correct |
12 |
Correct |
2 ms |
8536 KB |
Output is correct |
13 |
Correct |
5 ms |
8536 KB |
Output is correct |
14 |
Correct |
7 ms |
8792 KB |
Output is correct |
15 |
Correct |
16 ms |
9032 KB |
Output is correct |
16 |
Correct |
15 ms |
9308 KB |
Output is correct |
17 |
Correct |
14 ms |
9308 KB |
Output is correct |
18 |
Correct |
14 ms |
9308 KB |
Output is correct |
19 |
Correct |
14 ms |
9308 KB |
Output is correct |
20 |
Correct |
15 ms |
9228 KB |
Output is correct |
21 |
Correct |
18 ms |
9292 KB |
Output is correct |
22 |
Correct |
23 ms |
9308 KB |
Output is correct |
23 |
Correct |
15 ms |
9304 KB |
Output is correct |
24 |
Correct |
14 ms |
9304 KB |
Output is correct |
25 |
Correct |
14 ms |
9308 KB |
Output is correct |
26 |
Correct |
2 ms |
8540 KB |
Output is correct |
27 |
Correct |
2 ms |
8656 KB |
Output is correct |
28 |
Correct |
2 ms |
8540 KB |
Output is correct |
29 |
Correct |
6 ms |
8796 KB |
Output is correct |
30 |
Correct |
11 ms |
9248 KB |
Output is correct |
31 |
Correct |
25 ms |
9492 KB |
Output is correct |
32 |
Correct |
17 ms |
9556 KB |
Output is correct |
33 |
Correct |
16 ms |
9564 KB |
Output is correct |
34 |
Correct |
16 ms |
9564 KB |
Output is correct |
35 |
Correct |
15 ms |
9564 KB |
Output is correct |
36 |
Correct |
16 ms |
9300 KB |
Output is correct |
37 |
Correct |
16 ms |
9568 KB |
Output is correct |
38 |
Correct |
16 ms |
9296 KB |
Output is correct |
39 |
Correct |
15 ms |
9172 KB |
Output is correct |
40 |
Correct |
15 ms |
9560 KB |
Output is correct |
41 |
Correct |
2 ms |
8656 KB |
Output is correct |
42 |
Correct |
2 ms |
8536 KB |
Output is correct |
43 |
Correct |
2 ms |
8540 KB |
Output is correct |
44 |
Correct |
2 ms |
8540 KB |
Output is correct |
45 |
Correct |
2 ms |
8536 KB |
Output is correct |
46 |
Correct |
2 ms |
8540 KB |
Output is correct |
47 |
Correct |
4 ms |
8796 KB |
Output is correct |
48 |
Correct |
4 ms |
8860 KB |
Output is correct |
49 |
Correct |
6 ms |
9052 KB |
Output is correct |
50 |
Correct |
12 ms |
9052 KB |
Output is correct |
51 |
Correct |
16 ms |
9820 KB |
Output is correct |
52 |
Correct |
17 ms |
9824 KB |
Output is correct |
53 |
Correct |
17 ms |
9704 KB |
Output is correct |
54 |
Correct |
16 ms |
9820 KB |
Output is correct |
55 |
Correct |
16 ms |
9792 KB |
Output is correct |
56 |
Correct |
16 ms |
9808 KB |
Output is correct |
57 |
Correct |
16 ms |
9812 KB |
Output is correct |
58 |
Correct |
16 ms |
9704 KB |
Output is correct |
59 |
Correct |
18 ms |
9812 KB |
Output is correct |
60 |
Correct |
16 ms |
9816 KB |
Output is correct |
61 |
Correct |
16 ms |
9816 KB |
Output is correct |
62 |
Correct |
17 ms |
9792 KB |
Output is correct |
63 |
Correct |
21 ms |
9820 KB |
Output is correct |
64 |
Correct |
17 ms |
9820 KB |
Output is correct |
65 |
Correct |
17 ms |
9644 KB |
Output is correct |
66 |
Correct |
16 ms |
9852 KB |
Output is correct |
67 |
Correct |
17 ms |
9820 KB |
Output is correct |
68 |
Correct |
17 ms |
9672 KB |
Output is correct |
69 |
Correct |
17 ms |
9816 KB |
Output is correct |
70 |
Correct |
17 ms |
9820 KB |
Output is correct |
71 |
Correct |
4 ms |
8796 KB |
Output is correct |
72 |
Correct |
4 ms |
8796 KB |
Output is correct |
73 |
Correct |
4 ms |
9048 KB |
Output is correct |
74 |
Correct |
4 ms |
8792 KB |
Output is correct |
75 |
Correct |
4 ms |
8796 KB |
Output is correct |
76 |
Correct |
7 ms |
9052 KB |
Output is correct |
77 |
Correct |
9 ms |
9052 KB |
Output is correct |
78 |
Correct |
7 ms |
9052 KB |
Output is correct |
79 |
Correct |
8 ms |
9164 KB |
Output is correct |
80 |
Correct |
7 ms |
8972 KB |
Output is correct |
81 |
Correct |
13 ms |
9296 KB |
Output is correct |
82 |
Correct |
12 ms |
9356 KB |
Output is correct |
83 |
Correct |
12 ms |
9368 KB |
Output is correct |
84 |
Correct |
12 ms |
9308 KB |
Output is correct |
85 |
Correct |
13 ms |
9308 KB |
Output is correct |
86 |
Correct |
14 ms |
9512 KB |
Output is correct |
87 |
Correct |
17 ms |
9536 KB |
Output is correct |
88 |
Correct |
21 ms |
9524 KB |
Output is correct |
89 |
Correct |
14 ms |
9556 KB |
Output is correct |
90 |
Correct |
18 ms |
9564 KB |
Output is correct |
91 |
Correct |
21 ms |
9812 KB |
Output is correct |
92 |
Correct |
23 ms |
9808 KB |
Output is correct |
93 |
Correct |
22 ms |
10072 KB |
Output is correct |
94 |
Correct |
20 ms |
9812 KB |
Output is correct |
95 |
Correct |
30 ms |
9808 KB |
Output is correct |
96 |
Correct |
24 ms |
10064 KB |
Output is correct |
97 |
Correct |
22 ms |
10124 KB |
Output is correct |
98 |
Correct |
23 ms |
10068 KB |
Output is correct |
99 |
Correct |
23 ms |
10068 KB |
Output is correct |
100 |
Correct |
23 ms |
10000 KB |
Output is correct |
101 |
Correct |
22 ms |
10144 KB |
Output is correct |
102 |
Correct |
25 ms |
10080 KB |
Output is correct |
103 |
Correct |
35 ms |
10064 KB |
Output is correct |
104 |
Correct |
26 ms |
10012 KB |
Output is correct |
105 |
Correct |
25 ms |
9968 KB |
Output is correct |
106 |
Correct |
36 ms |
10044 KB |
Output is correct |
107 |
Correct |
24 ms |
10064 KB |
Output is correct |
108 |
Correct |
35 ms |
10072 KB |
Output is correct |
109 |
Correct |
25 ms |
10172 KB |
Output is correct |
110 |
Correct |
24 ms |
10076 KB |
Output is correct |
111 |
Correct |
23 ms |
10128 KB |
Output is correct |
112 |
Correct |
23 ms |
10184 KB |
Output is correct |
113 |
Correct |
26 ms |
10132 KB |
Output is correct |
114 |
Correct |
23 ms |
10076 KB |
Output is correct |
115 |
Correct |
25 ms |
4280 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
8540 KB |
Output is correct |
2 |
Correct |
1 ms |
8540 KB |
Output is correct |
3 |
Correct |
1 ms |
8536 KB |
Output is correct |
4 |
Correct |
2 ms |
8540 KB |
Output is correct |
5 |
Correct |
1 ms |
8536 KB |
Output is correct |
6 |
Correct |
1 ms |
8540 KB |
Output is correct |
7 |
Correct |
2 ms |
8540 KB |
Output is correct |
8 |
Correct |
1 ms |
8540 KB |
Output is correct |
9 |
Correct |
2 ms |
8536 KB |
Output is correct |
10 |
Correct |
2 ms |
8540 KB |
Output is correct |
11 |
Correct |
1 ms |
8540 KB |
Output is correct |
12 |
Correct |
2 ms |
8536 KB |
Output is correct |
13 |
Correct |
5 ms |
8536 KB |
Output is correct |
14 |
Correct |
7 ms |
8792 KB |
Output is correct |
15 |
Correct |
16 ms |
9032 KB |
Output is correct |
16 |
Correct |
15 ms |
9308 KB |
Output is correct |
17 |
Correct |
14 ms |
9308 KB |
Output is correct |
18 |
Correct |
14 ms |
9308 KB |
Output is correct |
19 |
Correct |
14 ms |
9308 KB |
Output is correct |
20 |
Correct |
15 ms |
9228 KB |
Output is correct |
21 |
Correct |
18 ms |
9292 KB |
Output is correct |
22 |
Correct |
23 ms |
9308 KB |
Output is correct |
23 |
Correct |
15 ms |
9304 KB |
Output is correct |
24 |
Correct |
14 ms |
9304 KB |
Output is correct |
25 |
Correct |
14 ms |
9308 KB |
Output is correct |
26 |
Correct |
2 ms |
8540 KB |
Output is correct |
27 |
Correct |
2 ms |
8656 KB |
Output is correct |
28 |
Correct |
2 ms |
8540 KB |
Output is correct |
29 |
Correct |
6 ms |
8796 KB |
Output is correct |
30 |
Correct |
11 ms |
9248 KB |
Output is correct |
31 |
Correct |
25 ms |
9492 KB |
Output is correct |
32 |
Correct |
17 ms |
9556 KB |
Output is correct |
33 |
Correct |
16 ms |
9564 KB |
Output is correct |
34 |
Correct |
16 ms |
9564 KB |
Output is correct |
35 |
Correct |
15 ms |
9564 KB |
Output is correct |
36 |
Correct |
16 ms |
9300 KB |
Output is correct |
37 |
Correct |
16 ms |
9568 KB |
Output is correct |
38 |
Correct |
16 ms |
9296 KB |
Output is correct |
39 |
Correct |
15 ms |
9172 KB |
Output is correct |
40 |
Correct |
15 ms |
9560 KB |
Output is correct |
41 |
Correct |
2 ms |
8656 KB |
Output is correct |
42 |
Correct |
2 ms |
8536 KB |
Output is correct |
43 |
Correct |
2 ms |
8540 KB |
Output is correct |
44 |
Correct |
2 ms |
8540 KB |
Output is correct |
45 |
Correct |
2 ms |
8536 KB |
Output is correct |
46 |
Correct |
2 ms |
8540 KB |
Output is correct |
47 |
Correct |
4 ms |
8796 KB |
Output is correct |
48 |
Correct |
4 ms |
8860 KB |
Output is correct |
49 |
Correct |
6 ms |
9052 KB |
Output is correct |
50 |
Correct |
12 ms |
9052 KB |
Output is correct |
51 |
Correct |
16 ms |
9820 KB |
Output is correct |
52 |
Correct |
17 ms |
9824 KB |
Output is correct |
53 |
Correct |
17 ms |
9704 KB |
Output is correct |
54 |
Correct |
16 ms |
9820 KB |
Output is correct |
55 |
Correct |
16 ms |
9792 KB |
Output is correct |
56 |
Correct |
16 ms |
9808 KB |
Output is correct |
57 |
Correct |
16 ms |
9812 KB |
Output is correct |
58 |
Correct |
16 ms |
9704 KB |
Output is correct |
59 |
Correct |
18 ms |
9812 KB |
Output is correct |
60 |
Correct |
16 ms |
9816 KB |
Output is correct |
61 |
Correct |
16 ms |
9816 KB |
Output is correct |
62 |
Correct |
17 ms |
9792 KB |
Output is correct |
63 |
Correct |
21 ms |
9820 KB |
Output is correct |
64 |
Correct |
17 ms |
9820 KB |
Output is correct |
65 |
Correct |
17 ms |
9644 KB |
Output is correct |
66 |
Correct |
16 ms |
9852 KB |
Output is correct |
67 |
Correct |
17 ms |
9820 KB |
Output is correct |
68 |
Correct |
17 ms |
9672 KB |
Output is correct |
69 |
Correct |
17 ms |
9816 KB |
Output is correct |
70 |
Correct |
17 ms |
9820 KB |
Output is correct |
71 |
Correct |
4 ms |
8796 KB |
Output is correct |
72 |
Correct |
4 ms |
8796 KB |
Output is correct |
73 |
Correct |
4 ms |
9048 KB |
Output is correct |
74 |
Correct |
4 ms |
8792 KB |
Output is correct |
75 |
Correct |
4 ms |
8796 KB |
Output is correct |
76 |
Correct |
7 ms |
9052 KB |
Output is correct |
77 |
Correct |
9 ms |
9052 KB |
Output is correct |
78 |
Correct |
7 ms |
9052 KB |
Output is correct |
79 |
Correct |
8 ms |
9164 KB |
Output is correct |
80 |
Correct |
7 ms |
8972 KB |
Output is correct |
81 |
Correct |
13 ms |
9296 KB |
Output is correct |
82 |
Correct |
12 ms |
9356 KB |
Output is correct |
83 |
Correct |
12 ms |
9368 KB |
Output is correct |
84 |
Correct |
12 ms |
9308 KB |
Output is correct |
85 |
Correct |
13 ms |
9308 KB |
Output is correct |
86 |
Correct |
14 ms |
9512 KB |
Output is correct |
87 |
Correct |
17 ms |
9536 KB |
Output is correct |
88 |
Correct |
21 ms |
9524 KB |
Output is correct |
89 |
Correct |
14 ms |
9556 KB |
Output is correct |
90 |
Correct |
18 ms |
9564 KB |
Output is correct |
91 |
Correct |
21 ms |
9812 KB |
Output is correct |
92 |
Correct |
23 ms |
9808 KB |
Output is correct |
93 |
Correct |
22 ms |
10072 KB |
Output is correct |
94 |
Correct |
20 ms |
9812 KB |
Output is correct |
95 |
Correct |
30 ms |
9808 KB |
Output is correct |
96 |
Correct |
24 ms |
10064 KB |
Output is correct |
97 |
Correct |
22 ms |
10124 KB |
Output is correct |
98 |
Correct |
23 ms |
10068 KB |
Output is correct |
99 |
Correct |
23 ms |
10068 KB |
Output is correct |
100 |
Correct |
23 ms |
10000 KB |
Output is correct |
101 |
Correct |
22 ms |
10144 KB |
Output is correct |
102 |
Correct |
25 ms |
10080 KB |
Output is correct |
103 |
Correct |
35 ms |
10064 KB |
Output is correct |
104 |
Correct |
26 ms |
10012 KB |
Output is correct |
105 |
Correct |
25 ms |
9968 KB |
Output is correct |
106 |
Correct |
36 ms |
10044 KB |
Output is correct |
107 |
Correct |
24 ms |
10064 KB |
Output is correct |
108 |
Correct |
35 ms |
10072 KB |
Output is correct |
109 |
Correct |
25 ms |
10172 KB |
Output is correct |
110 |
Correct |
24 ms |
10076 KB |
Output is correct |
111 |
Correct |
23 ms |
10128 KB |
Output is correct |
112 |
Correct |
23 ms |
10184 KB |
Output is correct |
113 |
Correct |
26 ms |
10132 KB |
Output is correct |
114 |
Correct |
23 ms |
10076 KB |
Output is correct |
115 |
Correct |
25 ms |
4280 KB |
Output is correct |
116 |
Correct |
1365 ms |
3424 KB |
Output is correct |
117 |
Correct |
1334 ms |
5488 KB |
Output is correct |
118 |
Correct |
1327 ms |
5956 KB |
Output is correct |
119 |
Correct |
1354 ms |
12024 KB |
Output is correct |
120 |
Correct |
1333 ms |
11860 KB |
Output is correct |
121 |
Correct |
1365 ms |
8732 KB |
Output is correct |
122 |
Correct |
1378 ms |
12240 KB |
Output is correct |
123 |
Correct |
1427 ms |
12624 KB |
Output is correct |
124 |
Correct |
1469 ms |
12836 KB |
Output is correct |
125 |
Correct |
1486 ms |
12852 KB |
Output is correct |
126 |
Correct |
1779 ms |
13132 KB |
Output is correct |
127 |
Correct |
1759 ms |
13128 KB |
Output is correct |
128 |
Correct |
1796 ms |
13124 KB |
Output is correct |
129 |
Correct |
1768 ms |
13132 KB |
Output is correct |
130 |
Correct |
1741 ms |
13124 KB |
Output is correct |
131 |
Correct |
1777 ms |
13172 KB |
Output is correct |
132 |
Correct |
1723 ms |
13180 KB |
Output is correct |
133 |
Correct |
1700 ms |
13160 KB |
Output is correct |
134 |
Correct |
1752 ms |
13164 KB |
Output is correct |
135 |
Correct |
1799 ms |
13172 KB |
Output is correct |
136 |
Correct |
1722 ms |
13072 KB |
Output is correct |
137 |
Correct |
1720 ms |
13188 KB |
Output is correct |
138 |
Correct |
1743 ms |
13164 KB |
Output is correct |
139 |
Correct |
1789 ms |
13164 KB |
Output is correct |
140 |
Correct |
1736 ms |
13164 KB |
Output is correct |
141 |
Correct |
1613 ms |
13196 KB |
Output is correct |
142 |
Correct |
1669 ms |
13192 KB |
Output is correct |
143 |
Correct |
1666 ms |
13200 KB |
Output is correct |
144 |
Correct |
1634 ms |
13208 KB |
Output is correct |
145 |
Correct |
1668 ms |
13192 KB |
Output is correct |
146 |
Correct |
1556 ms |
13472 KB |
Output is correct |
147 |
Correct |
1545 ms |
13456 KB |
Output is correct |
148 |
Correct |
1585 ms |
13464 KB |
Output is correct |
149 |
Correct |
1548 ms |
13468 KB |
Output is correct |
150 |
Correct |
1553 ms |
13460 KB |
Output is correct |
151 |
Correct |
1572 ms |
13492 KB |
Output is correct |
152 |
Correct |
1552 ms |
13744 KB |
Output is correct |
153 |
Correct |
1572 ms |
13484 KB |
Output is correct |
154 |
Correct |
1555 ms |
13484 KB |
Output is correct |
155 |
Correct |
1573 ms |
13480 KB |
Output is correct |
156 |
Correct |
1672 ms |
13768 KB |
Output is correct |
157 |
Correct |
1720 ms |
13772 KB |
Output is correct |
158 |
Correct |
1657 ms |
13776 KB |
Output is correct |
159 |
Correct |
1641 ms |
13780 KB |
Output is correct |
160 |
Correct |
1664 ms |
13772 KB |
Output is correct |
161 |
Correct |
1752 ms |
14068 KB |
Output is correct |
162 |
Correct |
1739 ms |
13868 KB |
Output is correct |
163 |
Correct |
1709 ms |
14072 KB |
Output is correct |
164 |
Correct |
1753 ms |
13864 KB |
Output is correct |
165 |
Correct |
1757 ms |
13876 KB |
Output is correct |
166 |
Correct |
1695 ms |
13668 KB |
Output is correct |
167 |
Correct |
1664 ms |
13664 KB |
Output is correct |
168 |
Correct |
1645 ms |
13664 KB |
Output is correct |
169 |
Correct |
1651 ms |
13660 KB |
Output is correct |
170 |
Correct |
1649 ms |
13664 KB |
Output is correct |
171 |
Correct |
1715 ms |
13724 KB |
Output is correct |
172 |
Correct |
1675 ms |
13740 KB |
Output is correct |
173 |
Correct |
1706 ms |
13724 KB |
Output is correct |
174 |
Correct |
1683 ms |
13724 KB |
Output is correct |
175 |
Correct |
1686 ms |
13736 KB |
Output is correct |