/**
____ ____ ____ ____ ____
||a |||t |||o |||d |||o ||
||__|||__|||__|||__|||__||
|/__\|/__\|/__\|/__\|/__\|
**/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N_MAX = 300000;
const int A_MAX = 300000;
const int Q_MAX = 50000;
int N, Q;
int A[N_MAX + 2];
int bucketSize;
struct Query {
int l, r;
int id;
};
bool operator < (const Query &a, const Query &b) {
return make_pair((a.l - 1) / bucketSize, a.r) < make_pair((b.l - 1) / bucketSize, b.r);
}
Query queries[Q_MAX + 2];
int occ[A_MAX + 2];
unordered_map <int, int> mp;
void update (int val, int sgn) {
if (--mp[occ[val]] == 0) {
mp.erase(occ[val]);
}
occ[val] += sgn;
mp[occ[val]]++;
}
ll solve () {
vector <pair <int, int>> v;
for (pair <int, int> p : mp) {
v.push_back(p);
}
sort(v.begin(), v.end(), greater <pair <int, int>> ());
int sum = 0, cnt = 0;
ll sumLR = 0, sumRL = 0;
ll X = 0, Y = 0;
for (pair <int, int> p : v) {
int len, occ; tie(len, occ) = p;
ll u = sumRL - sumLR + (ll) sum * occ; int v = (2 * sum);
int L = min(max((v == 0 ? 0 : (u >= 0 ? u / v : -(-u / v))), (ll) 0), (ll) (occ - 1));
int R = (occ - 1) - L;
for (char c : {'L', 'R'}) {
ll sum1L = (ll) L * (L - 1) / 2, sum2L = (ll) L * (L - 1) * (2 * L - 1) / 6;
Y += len * (sumRL * L + (ll) len * cnt * sum1L + len * (sum2L - sum1L) / 2);
ll aux = 0;
aux += (ll) sum * sum * L;
aux += (ll) 2 * sum * len * sum1L;
aux += (ll) len * len * sum2L;
aux -= X * L + (ll) len * len * sum1L;
aux /= 2;
Y += aux;
X += (ll) len * len * L;
sumLR += (ll) sum * L + len * sum1L;
sumRL += (ll) len * cnt * L + len * sum1L;
sum += (ll) len * L;
cnt += L;
swap(L, R);
swap(sumLR, sumRL);
}
if (sumLR < sumRL) {
Y += sumRL * len + ((ll) sum * sum - X) / 2;
X += (ll) len * len;
sumLR += sum;
sumRL += (ll) len * cnt;
sum += len;
cnt += 1;
} else {
Y += sumLR * len + ((ll) sum * sum - X) / 2;
X += (ll) len * len;
sumRL += sum;
sumLR += (ll) len * cnt;
sum += len;
cnt += 1;
}
}
ll ret = (cnt - 1) * X + 2 * Y;
ret += (ll) sum * (cnt - 1);
ret /= 2;
ret = (ll) cnt * sum * (sum + 1) / 2 - ret;
return ret;
}
ll answer[Q_MAX + 2];
mt19937 rnd (13);
int main () {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> N >> Q;
for (int i = 1; i <= N; i++) {
cin >> A[i];
}
bucketSize = max(1, (int) (N / sqrt(Q)));
for (int i = 1; i <= Q; i++) {
cin >> queries[i].l >> queries[i].r;
queries[i].id = i;
}
sort(queries + 1, queries + Q + 1);
int l = 1, r = 0;
for (int i = 1; i <= Q; i++) {
while (queries[i].l < l) {
update(A[--l], +1);
}
while (r < queries[i].r) {
update(A[++r], +1);
}
while (l < queries[i].l) {
update(A[l++], -1);
}
while (queries[i].r < r) {
update(A[r--], -1);
}
answer[queries[i].id] = solve();
}
for (int i = 1; i <= Q; i++) {
cout << answer[i] << "\n";
}
return 0;
}
Compilation message
diversity.cpp: In function 'll solve()':
diversity.cpp:61:19: warning: unused variable 'c' [-Wunused-variable]
61 | for (char c : {'L', 'R'}) {
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 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 |
344 KB |
Output is correct |
7 |
Correct |
1 ms |
340 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 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
2 ms |
468 KB |
Output is correct |
4 |
Correct |
13 ms |
852 KB |
Output is correct |
5 |
Correct |
28 ms |
1512 KB |
Output is correct |
6 |
Correct |
42 ms |
2124 KB |
Output is correct |
7 |
Correct |
42 ms |
2024 KB |
Output is correct |
8 |
Correct |
42 ms |
2132 KB |
Output is correct |
9 |
Correct |
41 ms |
2124 KB |
Output is correct |
10 |
Correct |
40 ms |
2132 KB |
Output is correct |
11 |
Correct |
41 ms |
2148 KB |
Output is correct |
12 |
Correct |
44 ms |
2132 KB |
Output is correct |
13 |
Correct |
53 ms |
2048 KB |
Output is correct |
14 |
Correct |
44 ms |
2060 KB |
Output is correct |
15 |
Correct |
40 ms |
2148 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
2 ms |
468 KB |
Output is correct |
4 |
Correct |
13 ms |
852 KB |
Output is correct |
5 |
Correct |
28 ms |
1512 KB |
Output is correct |
6 |
Correct |
42 ms |
2124 KB |
Output is correct |
7 |
Correct |
42 ms |
2024 KB |
Output is correct |
8 |
Correct |
42 ms |
2132 KB |
Output is correct |
9 |
Correct |
41 ms |
2124 KB |
Output is correct |
10 |
Correct |
40 ms |
2132 KB |
Output is correct |
11 |
Correct |
41 ms |
2148 KB |
Output is correct |
12 |
Correct |
44 ms |
2132 KB |
Output is correct |
13 |
Correct |
53 ms |
2048 KB |
Output is correct |
14 |
Correct |
44 ms |
2060 KB |
Output is correct |
15 |
Correct |
40 ms |
2148 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 |
352 KB |
Output is correct |
19 |
Correct |
16 ms |
1012 KB |
Output is correct |
20 |
Correct |
28 ms |
1556 KB |
Output is correct |
21 |
Correct |
42 ms |
2320 KB |
Output is correct |
22 |
Correct |
50 ms |
2160 KB |
Output is correct |
23 |
Correct |
46 ms |
2184 KB |
Output is correct |
24 |
Correct |
42 ms |
2188 KB |
Output is correct |
25 |
Correct |
41 ms |
2252 KB |
Output is correct |
26 |
Correct |
42 ms |
2244 KB |
Output is correct |
27 |
Correct |
46 ms |
2276 KB |
Output is correct |
28 |
Correct |
40 ms |
2132 KB |
Output is correct |
29 |
Correct |
41 ms |
2260 KB |
Output is correct |
30 |
Correct |
45 ms |
2260 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
2 ms |
468 KB |
Output is correct |
4 |
Correct |
13 ms |
852 KB |
Output is correct |
5 |
Correct |
28 ms |
1512 KB |
Output is correct |
6 |
Correct |
42 ms |
2124 KB |
Output is correct |
7 |
Correct |
42 ms |
2024 KB |
Output is correct |
8 |
Correct |
42 ms |
2132 KB |
Output is correct |
9 |
Correct |
41 ms |
2124 KB |
Output is correct |
10 |
Correct |
40 ms |
2132 KB |
Output is correct |
11 |
Correct |
41 ms |
2148 KB |
Output is correct |
12 |
Correct |
44 ms |
2132 KB |
Output is correct |
13 |
Correct |
53 ms |
2048 KB |
Output is correct |
14 |
Correct |
44 ms |
2060 KB |
Output is correct |
15 |
Correct |
40 ms |
2148 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 |
352 KB |
Output is correct |
19 |
Correct |
16 ms |
1012 KB |
Output is correct |
20 |
Correct |
28 ms |
1556 KB |
Output is correct |
21 |
Correct |
42 ms |
2320 KB |
Output is correct |
22 |
Correct |
50 ms |
2160 KB |
Output is correct |
23 |
Correct |
46 ms |
2184 KB |
Output is correct |
24 |
Correct |
42 ms |
2188 KB |
Output is correct |
25 |
Correct |
41 ms |
2252 KB |
Output is correct |
26 |
Correct |
42 ms |
2244 KB |
Output is correct |
27 |
Correct |
46 ms |
2276 KB |
Output is correct |
28 |
Correct |
40 ms |
2132 KB |
Output is correct |
29 |
Correct |
41 ms |
2260 KB |
Output is correct |
30 |
Correct |
45 ms |
2260 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 |
2 ms |
352 KB |
Output is correct |
35 |
Correct |
2 ms |
352 KB |
Output is correct |
36 |
Correct |
1 ms |
340 KB |
Output is correct |
37 |
Correct |
6 ms |
724 KB |
Output is correct |
38 |
Correct |
5 ms |
752 KB |
Output is correct |
39 |
Correct |
13 ms |
1108 KB |
Output is correct |
40 |
Correct |
20 ms |
1872 KB |
Output is correct |
41 |
Correct |
33 ms |
2484 KB |
Output is correct |
42 |
Correct |
33 ms |
2540 KB |
Output is correct |
43 |
Correct |
35 ms |
2548 KB |
Output is correct |
44 |
Correct |
35 ms |
2444 KB |
Output is correct |
45 |
Correct |
33 ms |
2540 KB |
Output is correct |
46 |
Correct |
32 ms |
2548 KB |
Output is correct |
47 |
Correct |
35 ms |
2548 KB |
Output is correct |
48 |
Correct |
33 ms |
2556 KB |
Output is correct |
49 |
Correct |
34 ms |
2520 KB |
Output is correct |
50 |
Correct |
32 ms |
2516 KB |
Output is correct |
51 |
Correct |
35 ms |
2668 KB |
Output is correct |
52 |
Correct |
32 ms |
2508 KB |
Output is correct |
53 |
Correct |
36 ms |
2648 KB |
Output is correct |
54 |
Correct |
35 ms |
2604 KB |
Output is correct |
55 |
Correct |
33 ms |
2680 KB |
Output is correct |
56 |
Correct |
33 ms |
2680 KB |
Output is correct |
57 |
Correct |
31 ms |
2576 KB |
Output is correct |
58 |
Correct |
32 ms |
2636 KB |
Output is correct |
59 |
Correct |
33 ms |
2628 KB |
Output is correct |
60 |
Correct |
33 ms |
2612 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 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 |
344 KB |
Output is correct |
7 |
Correct |
1 ms |
340 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 |
0 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
2 ms |
468 KB |
Output is correct |
14 |
Correct |
13 ms |
852 KB |
Output is correct |
15 |
Correct |
28 ms |
1512 KB |
Output is correct |
16 |
Correct |
42 ms |
2124 KB |
Output is correct |
17 |
Correct |
42 ms |
2024 KB |
Output is correct |
18 |
Correct |
42 ms |
2132 KB |
Output is correct |
19 |
Correct |
41 ms |
2124 KB |
Output is correct |
20 |
Correct |
40 ms |
2132 KB |
Output is correct |
21 |
Correct |
41 ms |
2148 KB |
Output is correct |
22 |
Correct |
44 ms |
2132 KB |
Output is correct |
23 |
Correct |
53 ms |
2048 KB |
Output is correct |
24 |
Correct |
44 ms |
2060 KB |
Output is correct |
25 |
Correct |
40 ms |
2148 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 |
352 KB |
Output is correct |
29 |
Correct |
16 ms |
1012 KB |
Output is correct |
30 |
Correct |
28 ms |
1556 KB |
Output is correct |
31 |
Correct |
42 ms |
2320 KB |
Output is correct |
32 |
Correct |
50 ms |
2160 KB |
Output is correct |
33 |
Correct |
46 ms |
2184 KB |
Output is correct |
34 |
Correct |
42 ms |
2188 KB |
Output is correct |
35 |
Correct |
41 ms |
2252 KB |
Output is correct |
36 |
Correct |
42 ms |
2244 KB |
Output is correct |
37 |
Correct |
46 ms |
2276 KB |
Output is correct |
38 |
Correct |
40 ms |
2132 KB |
Output is correct |
39 |
Correct |
41 ms |
2260 KB |
Output is correct |
40 |
Correct |
45 ms |
2260 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 |
2 ms |
352 KB |
Output is correct |
45 |
Correct |
2 ms |
352 KB |
Output is correct |
46 |
Correct |
1 ms |
340 KB |
Output is correct |
47 |
Correct |
6 ms |
724 KB |
Output is correct |
48 |
Correct |
5 ms |
752 KB |
Output is correct |
49 |
Correct |
13 ms |
1108 KB |
Output is correct |
50 |
Correct |
20 ms |
1872 KB |
Output is correct |
51 |
Correct |
33 ms |
2484 KB |
Output is correct |
52 |
Correct |
33 ms |
2540 KB |
Output is correct |
53 |
Correct |
35 ms |
2548 KB |
Output is correct |
54 |
Correct |
35 ms |
2444 KB |
Output is correct |
55 |
Correct |
33 ms |
2540 KB |
Output is correct |
56 |
Correct |
32 ms |
2548 KB |
Output is correct |
57 |
Correct |
35 ms |
2548 KB |
Output is correct |
58 |
Correct |
33 ms |
2556 KB |
Output is correct |
59 |
Correct |
34 ms |
2520 KB |
Output is correct |
60 |
Correct |
32 ms |
2516 KB |
Output is correct |
61 |
Correct |
35 ms |
2668 KB |
Output is correct |
62 |
Correct |
32 ms |
2508 KB |
Output is correct |
63 |
Correct |
36 ms |
2648 KB |
Output is correct |
64 |
Correct |
35 ms |
2604 KB |
Output is correct |
65 |
Correct |
33 ms |
2680 KB |
Output is correct |
66 |
Correct |
33 ms |
2680 KB |
Output is correct |
67 |
Correct |
31 ms |
2576 KB |
Output is correct |
68 |
Correct |
32 ms |
2636 KB |
Output is correct |
69 |
Correct |
33 ms |
2628 KB |
Output is correct |
70 |
Correct |
33 ms |
2612 KB |
Output is correct |
71 |
Correct |
5 ms |
724 KB |
Output is correct |
72 |
Correct |
6 ms |
724 KB |
Output is correct |
73 |
Correct |
6 ms |
724 KB |
Output is correct |
74 |
Correct |
5 ms |
724 KB |
Output is correct |
75 |
Correct |
6 ms |
852 KB |
Output is correct |
76 |
Correct |
10 ms |
1224 KB |
Output is correct |
77 |
Correct |
11 ms |
1184 KB |
Output is correct |
78 |
Correct |
13 ms |
1184 KB |
Output is correct |
79 |
Correct |
10 ms |
1184 KB |
Output is correct |
80 |
Correct |
10 ms |
1236 KB |
Output is correct |
81 |
Correct |
20 ms |
2124 KB |
Output is correct |
82 |
Correct |
24 ms |
2052 KB |
Output is correct |
83 |
Correct |
19 ms |
2124 KB |
Output is correct |
84 |
Correct |
20 ms |
2032 KB |
Output is correct |
85 |
Correct |
20 ms |
2132 KB |
Output is correct |
86 |
Correct |
21 ms |
2140 KB |
Output is correct |
87 |
Correct |
23 ms |
2184 KB |
Output is correct |
88 |
Correct |
21 ms |
2288 KB |
Output is correct |
89 |
Correct |
21 ms |
2252 KB |
Output is correct |
90 |
Correct |
22 ms |
2256 KB |
Output is correct |
91 |
Correct |
32 ms |
3076 KB |
Output is correct |
92 |
Correct |
33 ms |
3160 KB |
Output is correct |
93 |
Correct |
33 ms |
3132 KB |
Output is correct |
94 |
Correct |
32 ms |
3120 KB |
Output is correct |
95 |
Correct |
40 ms |
3132 KB |
Output is correct |
96 |
Correct |
36 ms |
3504 KB |
Output is correct |
97 |
Correct |
36 ms |
3660 KB |
Output is correct |
98 |
Correct |
35 ms |
3640 KB |
Output is correct |
99 |
Correct |
38 ms |
3660 KB |
Output is correct |
100 |
Correct |
44 ms |
3576 KB |
Output is correct |
101 |
Correct |
36 ms |
3660 KB |
Output is correct |
102 |
Correct |
42 ms |
3660 KB |
Output is correct |
103 |
Correct |
35 ms |
3632 KB |
Output is correct |
104 |
Correct |
35 ms |
3640 KB |
Output is correct |
105 |
Correct |
36 ms |
3668 KB |
Output is correct |
106 |
Correct |
47 ms |
3844 KB |
Output is correct |
107 |
Correct |
36 ms |
3796 KB |
Output is correct |
108 |
Correct |
39 ms |
3824 KB |
Output is correct |
109 |
Correct |
36 ms |
3784 KB |
Output is correct |
110 |
Correct |
38 ms |
3896 KB |
Output is correct |
111 |
Correct |
39 ms |
3952 KB |
Output is correct |
112 |
Correct |
36 ms |
3992 KB |
Output is correct |
113 |
Correct |
41 ms |
4012 KB |
Output is correct |
114 |
Correct |
39 ms |
3904 KB |
Output is correct |
115 |
Correct |
36 ms |
4012 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 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 |
344 KB |
Output is correct |
7 |
Correct |
1 ms |
340 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 |
0 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
2 ms |
468 KB |
Output is correct |
14 |
Correct |
13 ms |
852 KB |
Output is correct |
15 |
Correct |
28 ms |
1512 KB |
Output is correct |
16 |
Correct |
42 ms |
2124 KB |
Output is correct |
17 |
Correct |
42 ms |
2024 KB |
Output is correct |
18 |
Correct |
42 ms |
2132 KB |
Output is correct |
19 |
Correct |
41 ms |
2124 KB |
Output is correct |
20 |
Correct |
40 ms |
2132 KB |
Output is correct |
21 |
Correct |
41 ms |
2148 KB |
Output is correct |
22 |
Correct |
44 ms |
2132 KB |
Output is correct |
23 |
Correct |
53 ms |
2048 KB |
Output is correct |
24 |
Correct |
44 ms |
2060 KB |
Output is correct |
25 |
Correct |
40 ms |
2148 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 |
352 KB |
Output is correct |
29 |
Correct |
16 ms |
1012 KB |
Output is correct |
30 |
Correct |
28 ms |
1556 KB |
Output is correct |
31 |
Correct |
42 ms |
2320 KB |
Output is correct |
32 |
Correct |
50 ms |
2160 KB |
Output is correct |
33 |
Correct |
46 ms |
2184 KB |
Output is correct |
34 |
Correct |
42 ms |
2188 KB |
Output is correct |
35 |
Correct |
41 ms |
2252 KB |
Output is correct |
36 |
Correct |
42 ms |
2244 KB |
Output is correct |
37 |
Correct |
46 ms |
2276 KB |
Output is correct |
38 |
Correct |
40 ms |
2132 KB |
Output is correct |
39 |
Correct |
41 ms |
2260 KB |
Output is correct |
40 |
Correct |
45 ms |
2260 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 |
2 ms |
352 KB |
Output is correct |
45 |
Correct |
2 ms |
352 KB |
Output is correct |
46 |
Correct |
1 ms |
340 KB |
Output is correct |
47 |
Correct |
6 ms |
724 KB |
Output is correct |
48 |
Correct |
5 ms |
752 KB |
Output is correct |
49 |
Correct |
13 ms |
1108 KB |
Output is correct |
50 |
Correct |
20 ms |
1872 KB |
Output is correct |
51 |
Correct |
33 ms |
2484 KB |
Output is correct |
52 |
Correct |
33 ms |
2540 KB |
Output is correct |
53 |
Correct |
35 ms |
2548 KB |
Output is correct |
54 |
Correct |
35 ms |
2444 KB |
Output is correct |
55 |
Correct |
33 ms |
2540 KB |
Output is correct |
56 |
Correct |
32 ms |
2548 KB |
Output is correct |
57 |
Correct |
35 ms |
2548 KB |
Output is correct |
58 |
Correct |
33 ms |
2556 KB |
Output is correct |
59 |
Correct |
34 ms |
2520 KB |
Output is correct |
60 |
Correct |
32 ms |
2516 KB |
Output is correct |
61 |
Correct |
35 ms |
2668 KB |
Output is correct |
62 |
Correct |
32 ms |
2508 KB |
Output is correct |
63 |
Correct |
36 ms |
2648 KB |
Output is correct |
64 |
Correct |
35 ms |
2604 KB |
Output is correct |
65 |
Correct |
33 ms |
2680 KB |
Output is correct |
66 |
Correct |
33 ms |
2680 KB |
Output is correct |
67 |
Correct |
31 ms |
2576 KB |
Output is correct |
68 |
Correct |
32 ms |
2636 KB |
Output is correct |
69 |
Correct |
33 ms |
2628 KB |
Output is correct |
70 |
Correct |
33 ms |
2612 KB |
Output is correct |
71 |
Correct |
5 ms |
724 KB |
Output is correct |
72 |
Correct |
6 ms |
724 KB |
Output is correct |
73 |
Correct |
6 ms |
724 KB |
Output is correct |
74 |
Correct |
5 ms |
724 KB |
Output is correct |
75 |
Correct |
6 ms |
852 KB |
Output is correct |
76 |
Correct |
10 ms |
1224 KB |
Output is correct |
77 |
Correct |
11 ms |
1184 KB |
Output is correct |
78 |
Correct |
13 ms |
1184 KB |
Output is correct |
79 |
Correct |
10 ms |
1184 KB |
Output is correct |
80 |
Correct |
10 ms |
1236 KB |
Output is correct |
81 |
Correct |
20 ms |
2124 KB |
Output is correct |
82 |
Correct |
24 ms |
2052 KB |
Output is correct |
83 |
Correct |
19 ms |
2124 KB |
Output is correct |
84 |
Correct |
20 ms |
2032 KB |
Output is correct |
85 |
Correct |
20 ms |
2132 KB |
Output is correct |
86 |
Correct |
21 ms |
2140 KB |
Output is correct |
87 |
Correct |
23 ms |
2184 KB |
Output is correct |
88 |
Correct |
21 ms |
2288 KB |
Output is correct |
89 |
Correct |
21 ms |
2252 KB |
Output is correct |
90 |
Correct |
22 ms |
2256 KB |
Output is correct |
91 |
Correct |
32 ms |
3076 KB |
Output is correct |
92 |
Correct |
33 ms |
3160 KB |
Output is correct |
93 |
Correct |
33 ms |
3132 KB |
Output is correct |
94 |
Correct |
32 ms |
3120 KB |
Output is correct |
95 |
Correct |
40 ms |
3132 KB |
Output is correct |
96 |
Correct |
36 ms |
3504 KB |
Output is correct |
97 |
Correct |
36 ms |
3660 KB |
Output is correct |
98 |
Correct |
35 ms |
3640 KB |
Output is correct |
99 |
Correct |
38 ms |
3660 KB |
Output is correct |
100 |
Correct |
44 ms |
3576 KB |
Output is correct |
101 |
Correct |
36 ms |
3660 KB |
Output is correct |
102 |
Correct |
42 ms |
3660 KB |
Output is correct |
103 |
Correct |
35 ms |
3632 KB |
Output is correct |
104 |
Correct |
35 ms |
3640 KB |
Output is correct |
105 |
Correct |
36 ms |
3668 KB |
Output is correct |
106 |
Correct |
47 ms |
3844 KB |
Output is correct |
107 |
Correct |
36 ms |
3796 KB |
Output is correct |
108 |
Correct |
39 ms |
3824 KB |
Output is correct |
109 |
Correct |
36 ms |
3784 KB |
Output is correct |
110 |
Correct |
38 ms |
3896 KB |
Output is correct |
111 |
Correct |
39 ms |
3952 KB |
Output is correct |
112 |
Correct |
36 ms |
3992 KB |
Output is correct |
113 |
Correct |
41 ms |
4012 KB |
Output is correct |
114 |
Correct |
39 ms |
3904 KB |
Output is correct |
115 |
Correct |
36 ms |
4012 KB |
Output is correct |
116 |
Correct |
347 ms |
2240 KB |
Output is correct |
117 |
Correct |
325 ms |
2236 KB |
Output is correct |
118 |
Correct |
1267 ms |
2724 KB |
Output is correct |
119 |
Correct |
890 ms |
2776 KB |
Output is correct |
120 |
Correct |
704 ms |
2888 KB |
Output is correct |
121 |
Correct |
1421 ms |
3192 KB |
Output is correct |
122 |
Correct |
1164 ms |
3236 KB |
Output is correct |
123 |
Correct |
2984 ms |
3780 KB |
Output is correct |
124 |
Correct |
1988 ms |
3784 KB |
Output is correct |
125 |
Correct |
1842 ms |
3804 KB |
Output is correct |
126 |
Correct |
6070 ms |
4024 KB |
Output is correct |
127 |
Correct |
6065 ms |
4732 KB |
Output is correct |
128 |
Correct |
6089 ms |
4788 KB |
Output is correct |
129 |
Correct |
6219 ms |
4728 KB |
Output is correct |
130 |
Correct |
6456 ms |
4728 KB |
Output is correct |
131 |
Correct |
6093 ms |
4896 KB |
Output is correct |
132 |
Correct |
6225 ms |
4908 KB |
Output is correct |
133 |
Correct |
6162 ms |
4888 KB |
Output is correct |
134 |
Correct |
5799 ms |
4904 KB |
Output is correct |
135 |
Correct |
5777 ms |
4900 KB |
Output is correct |
136 |
Correct |
5671 ms |
4896 KB |
Output is correct |
137 |
Correct |
5821 ms |
4908 KB |
Output is correct |
138 |
Correct |
5657 ms |
4896 KB |
Output is correct |
139 |
Correct |
5891 ms |
4892 KB |
Output is correct |
140 |
Correct |
6056 ms |
4896 KB |
Output is correct |
141 |
Correct |
4804 ms |
4948 KB |
Output is correct |
142 |
Correct |
4749 ms |
4944 KB |
Output is correct |
143 |
Correct |
4487 ms |
4940 KB |
Output is correct |
144 |
Correct |
4645 ms |
4952 KB |
Output is correct |
145 |
Correct |
4718 ms |
4944 KB |
Output is correct |
146 |
Correct |
2890 ms |
5204 KB |
Output is correct |
147 |
Correct |
2925 ms |
5208 KB |
Output is correct |
148 |
Correct |
2898 ms |
5204 KB |
Output is correct |
149 |
Correct |
2885 ms |
5204 KB |
Output is correct |
150 |
Correct |
2877 ms |
5208 KB |
Output is correct |
151 |
Correct |
2735 ms |
5252 KB |
Output is correct |
152 |
Correct |
2756 ms |
5312 KB |
Output is correct |
153 |
Correct |
2747 ms |
5248 KB |
Output is correct |
154 |
Correct |
2740 ms |
5252 KB |
Output is correct |
155 |
Correct |
2719 ms |
5248 KB |
Output is correct |
156 |
Correct |
4243 ms |
5708 KB |
Output is correct |
157 |
Correct |
4224 ms |
5700 KB |
Output is correct |
158 |
Correct |
4237 ms |
5704 KB |
Output is correct |
159 |
Correct |
4169 ms |
5700 KB |
Output is correct |
160 |
Correct |
4209 ms |
5704 KB |
Output is correct |
161 |
Correct |
4328 ms |
5704 KB |
Output is correct |
162 |
Correct |
4317 ms |
5700 KB |
Output is correct |
163 |
Correct |
4499 ms |
5700 KB |
Output is correct |
164 |
Correct |
4303 ms |
5776 KB |
Output is correct |
165 |
Correct |
4262 ms |
5700 KB |
Output is correct |
166 |
Correct |
5167 ms |
5396 KB |
Output is correct |
167 |
Correct |
5235 ms |
5396 KB |
Output is correct |
168 |
Correct |
5190 ms |
5396 KB |
Output is correct |
169 |
Correct |
5254 ms |
5396 KB |
Output is correct |
170 |
Correct |
5439 ms |
5396 KB |
Output is correct |
171 |
Correct |
6381 ms |
5324 KB |
Output is correct |
172 |
Correct |
5963 ms |
5336 KB |
Output is correct |
173 |
Correct |
5978 ms |
5328 KB |
Output is correct |
174 |
Correct |
5970 ms |
5332 KB |
Output is correct |
175 |
Correct |
6400 ms |
5340 KB |
Output is correct |