#include <bits/stdc++.h>
using namespace std;
#define int long long
const int MAXN = 3e5 + 10;
const int MOD = 1e9 + 7;
mt19937_64 rng((int)std::chrono::steady_clock::now().time_since_epoch().count());
int rnd(int x, int y) {
int u = uniform_int_distribution<int>(x, y)(rng); return u;
}
int bm(int b, int p) {
if(p==0) return 1 % MOD;
int r = bm(b, p >> 1);
if(p&1) return (((r*r) % MOD) * b) % MOD;
return (r*r) % MOD;
}
int inv(int b) {
return bm(b, MOD-2);
}
int fastlog(int x) {
return (x == 0 ? -1 : 64 - __builtin_clzll(x) - 1);
}
void printcase(int i) { cout << "Case #" << i << ": "; }
int freq[MAXN], ff[MAXN], n;
int block;
bool modui(pair<pair<int,int>,int> a, pair<pair<int,int>,int> b) {
if(a.first.first / block != b.first.first / block) return a.first.first / block < b.first.first / block;
return a.first.second < b.first.second;
}
bool byfreq(int x, int y) {
return freq[x] < freq[y];
}
void solve(int tc) {
int q;
cin >> n >> q;
int c = 300000;
block = 1342;
int arr[n+1];
for(int i=1; i<=n; i++) {
cin >> arr[i];
}
pair<pair<int,int>,int> qry[q+1];
for(int i=1; i<=q; i++) {
cin >> qry[i].first.first >> qry[i].first.second;
qry[i].second = i;
}
sort(qry+1, qry+q+1, modui);
int res[q+1];
int l = qry[1].first.first, r = qry[1].first.first - 1;
vector<int> v;
// O(sqrt(n)) frequencies
set<int> all; // set of all frequencies
for(int i=1; i<=q; i++) {
vector<int> tmp;
while(l > qry[i].first.first) {
l--;
ff[freq[arr[l]]]--;
if(ff[freq[arr[l]]] == 0) tmp.push_back(freq[arr[l]]);
freq[arr[l]]++;
ff[freq[arr[l]]]++;
if(ff[freq[arr[l]]] == 1) tmp.push_back(freq[arr[l]]);
}
while(r > qry[i].first.second) {
ff[freq[arr[r]]]--;
if(ff[freq[arr[r]]] == 0) tmp.push_back(freq[arr[r]]);
freq[arr[r]]--;
ff[freq[arr[r]]]++;
if(ff[freq[arr[r]]] == 1) tmp.push_back(freq[arr[r]]);
r--;
}
while(r < qry[i].first.second) {
r++;
ff[freq[arr[r]]]--;
if(ff[freq[arr[r]]] == 0) tmp.push_back(freq[arr[r]]);
freq[arr[r]]++;
ff[freq[arr[r]]]++;
if(ff[freq[arr[r]]] == 1) tmp.push_back(freq[arr[r]]);
}
while(l < qry[i].first.first) {
ff[freq[arr[l]]]--;
if(ff[freq[arr[l]]] == 0) tmp.push_back(freq[arr[l]]);
freq[arr[l]]--;
ff[freq[arr[l]]]++;
if(ff[freq[arr[l]]] == 1) tmp.push_back(freq[arr[l]]);
l++;
}
for(int z: tmp) {
if(ff[z] > 0) all.insert(z);
else if(all.count(z)) all.erase(z);
}
queue<pair<int, int> > ln; stack<pair<int, int> > rn;
int m = 0;
for(int x: all) {
// {x, ff[x]}
if(ff[x] / 2 > 0) {
ln.push({x, ff[x] / 2});
rn.push({x, ff[x] / 2});
m += 2;
}
if(ff[x] % 2) {
if(ln.size() > rn.size()) rn.push({x, 1});
else ln.push({x, 1});
m++;
}
}
pair<int, int> b[m];
int it = 0;
while(ln.size()) {
b[it++] = ln.front(); ln.pop();
}
while(rn.size()) {
b[it++] = rn.top(); rn.pop();
}
int ans = 0;
int ws=0,wps=0,tps=0,ps=0;
for(int i=0; i<m; i++) {
int F = b[i].first;
int C = b[i].second;
int t1 = C * F * ps * ws;
int t2 = C * F * wps;
int t3 = F * C * (C+1) / 2 * ws - F * C * tps / 2 + F * C * ws;
ans += t1 - t2 + t3;
ws += C * F;
wps += C * F * ps;
tps += C * F * (C + 1);
ps += C;
}
for(int i=0; i<m; i++) {
ans += b[i].first * (b[i].first + 1) / 2 * b[i].second;
int totn = (b[i].second - 1) * b[i].second / 2 * (b[i].second + 1);
totn -= b[i].second * (b[i].second - 1) * (2 * b[i].second - 1) / 6;
ans += totn * b[i].first * b[i].first;
}
res[qry[i].second] = ans;
}
for(int i=1; i<=q; i++) cout << res[i] << "\n";
}
int32_t main() {
ios::sync_with_stdio(0); cin.tie(0);
int t = 1; //cin >> t;
for(int i=1; i<=t; i++) solve(i);
}
Compilation message
diversity.cpp: In function 'void solve(long long int)':
diversity.cpp:38:7: warning: unused variable 'c' [-Wunused-variable]
38 | int c = 300000;
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
264 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 |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 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 |
2 ms |
728 KB |
Output is correct |
4 |
Correct |
12 ms |
3408 KB |
Output is correct |
5 |
Correct |
18 ms |
6544 KB |
Output is correct |
6 |
Correct |
30 ms |
11380 KB |
Output is correct |
7 |
Correct |
29 ms |
12104 KB |
Output is correct |
8 |
Correct |
30 ms |
11360 KB |
Output is correct |
9 |
Correct |
30 ms |
11328 KB |
Output is correct |
10 |
Correct |
29 ms |
11708 KB |
Output is correct |
11 |
Correct |
32 ms |
11492 KB |
Output is correct |
12 |
Correct |
31 ms |
11400 KB |
Output is correct |
13 |
Correct |
28 ms |
11336 KB |
Output is correct |
14 |
Correct |
28 ms |
11464 KB |
Output is correct |
15 |
Correct |
29 ms |
11496 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 |
2 ms |
728 KB |
Output is correct |
4 |
Correct |
12 ms |
3408 KB |
Output is correct |
5 |
Correct |
18 ms |
6544 KB |
Output is correct |
6 |
Correct |
30 ms |
11380 KB |
Output is correct |
7 |
Correct |
29 ms |
12104 KB |
Output is correct |
8 |
Correct |
30 ms |
11360 KB |
Output is correct |
9 |
Correct |
30 ms |
11328 KB |
Output is correct |
10 |
Correct |
29 ms |
11708 KB |
Output is correct |
11 |
Correct |
32 ms |
11492 KB |
Output is correct |
12 |
Correct |
31 ms |
11400 KB |
Output is correct |
13 |
Correct |
28 ms |
11336 KB |
Output is correct |
14 |
Correct |
28 ms |
11464 KB |
Output is correct |
15 |
Correct |
29 ms |
11496 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Correct |
2 ms |
788 KB |
Output is correct |
19 |
Correct |
11 ms |
3408 KB |
Output is correct |
20 |
Correct |
21 ms |
6220 KB |
Output is correct |
21 |
Correct |
36 ms |
11392 KB |
Output is correct |
22 |
Correct |
34 ms |
11208 KB |
Output is correct |
23 |
Correct |
35 ms |
11336 KB |
Output is correct |
24 |
Correct |
33 ms |
11236 KB |
Output is correct |
25 |
Correct |
32 ms |
11240 KB |
Output is correct |
26 |
Correct |
32 ms |
11300 KB |
Output is correct |
27 |
Correct |
33 ms |
11232 KB |
Output is correct |
28 |
Correct |
35 ms |
11472 KB |
Output is correct |
29 |
Correct |
35 ms |
11200 KB |
Output is correct |
30 |
Correct |
38 ms |
11336 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 |
2 ms |
728 KB |
Output is correct |
4 |
Correct |
12 ms |
3408 KB |
Output is correct |
5 |
Correct |
18 ms |
6544 KB |
Output is correct |
6 |
Correct |
30 ms |
11380 KB |
Output is correct |
7 |
Correct |
29 ms |
12104 KB |
Output is correct |
8 |
Correct |
30 ms |
11360 KB |
Output is correct |
9 |
Correct |
30 ms |
11328 KB |
Output is correct |
10 |
Correct |
29 ms |
11708 KB |
Output is correct |
11 |
Correct |
32 ms |
11492 KB |
Output is correct |
12 |
Correct |
31 ms |
11400 KB |
Output is correct |
13 |
Correct |
28 ms |
11336 KB |
Output is correct |
14 |
Correct |
28 ms |
11464 KB |
Output is correct |
15 |
Correct |
29 ms |
11496 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Correct |
2 ms |
788 KB |
Output is correct |
19 |
Correct |
11 ms |
3408 KB |
Output is correct |
20 |
Correct |
21 ms |
6220 KB |
Output is correct |
21 |
Correct |
36 ms |
11392 KB |
Output is correct |
22 |
Correct |
34 ms |
11208 KB |
Output is correct |
23 |
Correct |
35 ms |
11336 KB |
Output is correct |
24 |
Correct |
33 ms |
11236 KB |
Output is correct |
25 |
Correct |
32 ms |
11240 KB |
Output is correct |
26 |
Correct |
32 ms |
11300 KB |
Output is correct |
27 |
Correct |
33 ms |
11232 KB |
Output is correct |
28 |
Correct |
35 ms |
11472 KB |
Output is correct |
29 |
Correct |
35 ms |
11200 KB |
Output is correct |
30 |
Correct |
38 ms |
11336 KB |
Output is correct |
31 |
Correct |
1 ms |
340 KB |
Output is correct |
32 |
Correct |
1 ms |
340 KB |
Output is correct |
33 |
Correct |
0 ms |
340 KB |
Output is correct |
34 |
Correct |
2 ms |
596 KB |
Output is correct |
35 |
Correct |
2 ms |
468 KB |
Output is correct |
36 |
Correct |
1 ms |
340 KB |
Output is correct |
37 |
Correct |
6 ms |
1100 KB |
Output is correct |
38 |
Correct |
7 ms |
980 KB |
Output is correct |
39 |
Correct |
10 ms |
1756 KB |
Output is correct |
40 |
Correct |
20 ms |
3048 KB |
Output is correct |
41 |
Correct |
34 ms |
4808 KB |
Output is correct |
42 |
Correct |
35 ms |
4840 KB |
Output is correct |
43 |
Correct |
35 ms |
4812 KB |
Output is correct |
44 |
Correct |
35 ms |
4844 KB |
Output is correct |
45 |
Correct |
34 ms |
4816 KB |
Output is correct |
46 |
Correct |
33 ms |
4852 KB |
Output is correct |
47 |
Correct |
32 ms |
4816 KB |
Output is correct |
48 |
Correct |
33 ms |
4848 KB |
Output is correct |
49 |
Correct |
32 ms |
4840 KB |
Output is correct |
50 |
Correct |
35 ms |
4844 KB |
Output is correct |
51 |
Correct |
34 ms |
4816 KB |
Output is correct |
52 |
Correct |
36 ms |
4816 KB |
Output is correct |
53 |
Correct |
33 ms |
4848 KB |
Output is correct |
54 |
Correct |
36 ms |
4816 KB |
Output is correct |
55 |
Correct |
33 ms |
4820 KB |
Output is correct |
56 |
Correct |
32 ms |
4828 KB |
Output is correct |
57 |
Correct |
32 ms |
4816 KB |
Output is correct |
58 |
Correct |
33 ms |
4844 KB |
Output is correct |
59 |
Correct |
32 ms |
4848 KB |
Output is correct |
60 |
Correct |
34 ms |
4852 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
264 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 |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
2 ms |
728 KB |
Output is correct |
14 |
Correct |
12 ms |
3408 KB |
Output is correct |
15 |
Correct |
18 ms |
6544 KB |
Output is correct |
16 |
Correct |
30 ms |
11380 KB |
Output is correct |
17 |
Correct |
29 ms |
12104 KB |
Output is correct |
18 |
Correct |
30 ms |
11360 KB |
Output is correct |
19 |
Correct |
30 ms |
11328 KB |
Output is correct |
20 |
Correct |
29 ms |
11708 KB |
Output is correct |
21 |
Correct |
32 ms |
11492 KB |
Output is correct |
22 |
Correct |
31 ms |
11400 KB |
Output is correct |
23 |
Correct |
28 ms |
11336 KB |
Output is correct |
24 |
Correct |
28 ms |
11464 KB |
Output is correct |
25 |
Correct |
29 ms |
11496 KB |
Output is correct |
26 |
Correct |
1 ms |
340 KB |
Output is correct |
27 |
Correct |
1 ms |
340 KB |
Output is correct |
28 |
Correct |
2 ms |
788 KB |
Output is correct |
29 |
Correct |
11 ms |
3408 KB |
Output is correct |
30 |
Correct |
21 ms |
6220 KB |
Output is correct |
31 |
Correct |
36 ms |
11392 KB |
Output is correct |
32 |
Correct |
34 ms |
11208 KB |
Output is correct |
33 |
Correct |
35 ms |
11336 KB |
Output is correct |
34 |
Correct |
33 ms |
11236 KB |
Output is correct |
35 |
Correct |
32 ms |
11240 KB |
Output is correct |
36 |
Correct |
32 ms |
11300 KB |
Output is correct |
37 |
Correct |
33 ms |
11232 KB |
Output is correct |
38 |
Correct |
35 ms |
11472 KB |
Output is correct |
39 |
Correct |
35 ms |
11200 KB |
Output is correct |
40 |
Correct |
38 ms |
11336 KB |
Output is correct |
41 |
Correct |
1 ms |
340 KB |
Output is correct |
42 |
Correct |
1 ms |
340 KB |
Output is correct |
43 |
Correct |
0 ms |
340 KB |
Output is correct |
44 |
Correct |
2 ms |
596 KB |
Output is correct |
45 |
Correct |
2 ms |
468 KB |
Output is correct |
46 |
Correct |
1 ms |
340 KB |
Output is correct |
47 |
Correct |
6 ms |
1100 KB |
Output is correct |
48 |
Correct |
7 ms |
980 KB |
Output is correct |
49 |
Correct |
10 ms |
1756 KB |
Output is correct |
50 |
Correct |
20 ms |
3048 KB |
Output is correct |
51 |
Correct |
34 ms |
4808 KB |
Output is correct |
52 |
Correct |
35 ms |
4840 KB |
Output is correct |
53 |
Correct |
35 ms |
4812 KB |
Output is correct |
54 |
Correct |
35 ms |
4844 KB |
Output is correct |
55 |
Correct |
34 ms |
4816 KB |
Output is correct |
56 |
Correct |
33 ms |
4852 KB |
Output is correct |
57 |
Correct |
32 ms |
4816 KB |
Output is correct |
58 |
Correct |
33 ms |
4848 KB |
Output is correct |
59 |
Correct |
32 ms |
4840 KB |
Output is correct |
60 |
Correct |
35 ms |
4844 KB |
Output is correct |
61 |
Correct |
34 ms |
4816 KB |
Output is correct |
62 |
Correct |
36 ms |
4816 KB |
Output is correct |
63 |
Correct |
33 ms |
4848 KB |
Output is correct |
64 |
Correct |
36 ms |
4816 KB |
Output is correct |
65 |
Correct |
33 ms |
4820 KB |
Output is correct |
66 |
Correct |
32 ms |
4828 KB |
Output is correct |
67 |
Correct |
32 ms |
4816 KB |
Output is correct |
68 |
Correct |
33 ms |
4844 KB |
Output is correct |
69 |
Correct |
32 ms |
4848 KB |
Output is correct |
70 |
Correct |
34 ms |
4852 KB |
Output is correct |
71 |
Correct |
5 ms |
724 KB |
Output is correct |
72 |
Correct |
5 ms |
720 KB |
Output is correct |
73 |
Correct |
5 ms |
716 KB |
Output is correct |
74 |
Correct |
4 ms |
724 KB |
Output is correct |
75 |
Correct |
5 ms |
724 KB |
Output is correct |
76 |
Correct |
8 ms |
1176 KB |
Output is correct |
77 |
Correct |
7 ms |
1108 KB |
Output is correct |
78 |
Correct |
8 ms |
1112 KB |
Output is correct |
79 |
Correct |
8 ms |
1116 KB |
Output is correct |
80 |
Correct |
8 ms |
1152 KB |
Output is correct |
81 |
Correct |
17 ms |
2004 KB |
Output is correct |
82 |
Correct |
15 ms |
1980 KB |
Output is correct |
83 |
Correct |
15 ms |
2020 KB |
Output is correct |
84 |
Correct |
16 ms |
2004 KB |
Output is correct |
85 |
Correct |
18 ms |
2004 KB |
Output is correct |
86 |
Correct |
17 ms |
2004 KB |
Output is correct |
87 |
Correct |
17 ms |
2004 KB |
Output is correct |
88 |
Correct |
17 ms |
2016 KB |
Output is correct |
89 |
Correct |
18 ms |
2024 KB |
Output is correct |
90 |
Correct |
18 ms |
2004 KB |
Output is correct |
91 |
Correct |
36 ms |
3432 KB |
Output is correct |
92 |
Correct |
25 ms |
3420 KB |
Output is correct |
93 |
Correct |
31 ms |
3436 KB |
Output is correct |
94 |
Correct |
27 ms |
3464 KB |
Output is correct |
95 |
Correct |
26 ms |
3444 KB |
Output is correct |
96 |
Correct |
29 ms |
4180 KB |
Output is correct |
97 |
Correct |
31 ms |
4212 KB |
Output is correct |
98 |
Correct |
33 ms |
4228 KB |
Output is correct |
99 |
Correct |
33 ms |
4208 KB |
Output is correct |
100 |
Correct |
31 ms |
4224 KB |
Output is correct |
101 |
Correct |
35 ms |
4208 KB |
Output is correct |
102 |
Correct |
29 ms |
4216 KB |
Output is correct |
103 |
Correct |
30 ms |
4244 KB |
Output is correct |
104 |
Correct |
29 ms |
4208 KB |
Output is correct |
105 |
Correct |
26 ms |
4192 KB |
Output is correct |
106 |
Correct |
31 ms |
4596 KB |
Output is correct |
107 |
Correct |
32 ms |
4596 KB |
Output is correct |
108 |
Correct |
31 ms |
4616 KB |
Output is correct |
109 |
Correct |
30 ms |
4556 KB |
Output is correct |
110 |
Correct |
30 ms |
4596 KB |
Output is correct |
111 |
Correct |
30 ms |
4500 KB |
Output is correct |
112 |
Correct |
30 ms |
4620 KB |
Output is correct |
113 |
Correct |
31 ms |
4588 KB |
Output is correct |
114 |
Correct |
31 ms |
4564 KB |
Output is correct |
115 |
Correct |
29 ms |
4584 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
264 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 |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
2 ms |
728 KB |
Output is correct |
14 |
Correct |
12 ms |
3408 KB |
Output is correct |
15 |
Correct |
18 ms |
6544 KB |
Output is correct |
16 |
Correct |
30 ms |
11380 KB |
Output is correct |
17 |
Correct |
29 ms |
12104 KB |
Output is correct |
18 |
Correct |
30 ms |
11360 KB |
Output is correct |
19 |
Correct |
30 ms |
11328 KB |
Output is correct |
20 |
Correct |
29 ms |
11708 KB |
Output is correct |
21 |
Correct |
32 ms |
11492 KB |
Output is correct |
22 |
Correct |
31 ms |
11400 KB |
Output is correct |
23 |
Correct |
28 ms |
11336 KB |
Output is correct |
24 |
Correct |
28 ms |
11464 KB |
Output is correct |
25 |
Correct |
29 ms |
11496 KB |
Output is correct |
26 |
Correct |
1 ms |
340 KB |
Output is correct |
27 |
Correct |
1 ms |
340 KB |
Output is correct |
28 |
Correct |
2 ms |
788 KB |
Output is correct |
29 |
Correct |
11 ms |
3408 KB |
Output is correct |
30 |
Correct |
21 ms |
6220 KB |
Output is correct |
31 |
Correct |
36 ms |
11392 KB |
Output is correct |
32 |
Correct |
34 ms |
11208 KB |
Output is correct |
33 |
Correct |
35 ms |
11336 KB |
Output is correct |
34 |
Correct |
33 ms |
11236 KB |
Output is correct |
35 |
Correct |
32 ms |
11240 KB |
Output is correct |
36 |
Correct |
32 ms |
11300 KB |
Output is correct |
37 |
Correct |
33 ms |
11232 KB |
Output is correct |
38 |
Correct |
35 ms |
11472 KB |
Output is correct |
39 |
Correct |
35 ms |
11200 KB |
Output is correct |
40 |
Correct |
38 ms |
11336 KB |
Output is correct |
41 |
Correct |
1 ms |
340 KB |
Output is correct |
42 |
Correct |
1 ms |
340 KB |
Output is correct |
43 |
Correct |
0 ms |
340 KB |
Output is correct |
44 |
Correct |
2 ms |
596 KB |
Output is correct |
45 |
Correct |
2 ms |
468 KB |
Output is correct |
46 |
Correct |
1 ms |
340 KB |
Output is correct |
47 |
Correct |
6 ms |
1100 KB |
Output is correct |
48 |
Correct |
7 ms |
980 KB |
Output is correct |
49 |
Correct |
10 ms |
1756 KB |
Output is correct |
50 |
Correct |
20 ms |
3048 KB |
Output is correct |
51 |
Correct |
34 ms |
4808 KB |
Output is correct |
52 |
Correct |
35 ms |
4840 KB |
Output is correct |
53 |
Correct |
35 ms |
4812 KB |
Output is correct |
54 |
Correct |
35 ms |
4844 KB |
Output is correct |
55 |
Correct |
34 ms |
4816 KB |
Output is correct |
56 |
Correct |
33 ms |
4852 KB |
Output is correct |
57 |
Correct |
32 ms |
4816 KB |
Output is correct |
58 |
Correct |
33 ms |
4848 KB |
Output is correct |
59 |
Correct |
32 ms |
4840 KB |
Output is correct |
60 |
Correct |
35 ms |
4844 KB |
Output is correct |
61 |
Correct |
34 ms |
4816 KB |
Output is correct |
62 |
Correct |
36 ms |
4816 KB |
Output is correct |
63 |
Correct |
33 ms |
4848 KB |
Output is correct |
64 |
Correct |
36 ms |
4816 KB |
Output is correct |
65 |
Correct |
33 ms |
4820 KB |
Output is correct |
66 |
Correct |
32 ms |
4828 KB |
Output is correct |
67 |
Correct |
32 ms |
4816 KB |
Output is correct |
68 |
Correct |
33 ms |
4844 KB |
Output is correct |
69 |
Correct |
32 ms |
4848 KB |
Output is correct |
70 |
Correct |
34 ms |
4852 KB |
Output is correct |
71 |
Correct |
5 ms |
724 KB |
Output is correct |
72 |
Correct |
5 ms |
720 KB |
Output is correct |
73 |
Correct |
5 ms |
716 KB |
Output is correct |
74 |
Correct |
4 ms |
724 KB |
Output is correct |
75 |
Correct |
5 ms |
724 KB |
Output is correct |
76 |
Correct |
8 ms |
1176 KB |
Output is correct |
77 |
Correct |
7 ms |
1108 KB |
Output is correct |
78 |
Correct |
8 ms |
1112 KB |
Output is correct |
79 |
Correct |
8 ms |
1116 KB |
Output is correct |
80 |
Correct |
8 ms |
1152 KB |
Output is correct |
81 |
Correct |
17 ms |
2004 KB |
Output is correct |
82 |
Correct |
15 ms |
1980 KB |
Output is correct |
83 |
Correct |
15 ms |
2020 KB |
Output is correct |
84 |
Correct |
16 ms |
2004 KB |
Output is correct |
85 |
Correct |
18 ms |
2004 KB |
Output is correct |
86 |
Correct |
17 ms |
2004 KB |
Output is correct |
87 |
Correct |
17 ms |
2004 KB |
Output is correct |
88 |
Correct |
17 ms |
2016 KB |
Output is correct |
89 |
Correct |
18 ms |
2024 KB |
Output is correct |
90 |
Correct |
18 ms |
2004 KB |
Output is correct |
91 |
Correct |
36 ms |
3432 KB |
Output is correct |
92 |
Correct |
25 ms |
3420 KB |
Output is correct |
93 |
Correct |
31 ms |
3436 KB |
Output is correct |
94 |
Correct |
27 ms |
3464 KB |
Output is correct |
95 |
Correct |
26 ms |
3444 KB |
Output is correct |
96 |
Correct |
29 ms |
4180 KB |
Output is correct |
97 |
Correct |
31 ms |
4212 KB |
Output is correct |
98 |
Correct |
33 ms |
4228 KB |
Output is correct |
99 |
Correct |
33 ms |
4208 KB |
Output is correct |
100 |
Correct |
31 ms |
4224 KB |
Output is correct |
101 |
Correct |
35 ms |
4208 KB |
Output is correct |
102 |
Correct |
29 ms |
4216 KB |
Output is correct |
103 |
Correct |
30 ms |
4244 KB |
Output is correct |
104 |
Correct |
29 ms |
4208 KB |
Output is correct |
105 |
Correct |
26 ms |
4192 KB |
Output is correct |
106 |
Correct |
31 ms |
4596 KB |
Output is correct |
107 |
Correct |
32 ms |
4596 KB |
Output is correct |
108 |
Correct |
31 ms |
4616 KB |
Output is correct |
109 |
Correct |
30 ms |
4556 KB |
Output is correct |
110 |
Correct |
30 ms |
4596 KB |
Output is correct |
111 |
Correct |
30 ms |
4500 KB |
Output is correct |
112 |
Correct |
30 ms |
4620 KB |
Output is correct |
113 |
Correct |
31 ms |
4588 KB |
Output is correct |
114 |
Correct |
31 ms |
4564 KB |
Output is correct |
115 |
Correct |
29 ms |
4584 KB |
Output is correct |
116 |
Correct |
1371 ms |
2548 KB |
Output is correct |
117 |
Correct |
1232 ms |
2560 KB |
Output is correct |
118 |
Correct |
1922 ms |
3916 KB |
Output is correct |
119 |
Correct |
1068 ms |
3072 KB |
Output is correct |
120 |
Correct |
664 ms |
2948 KB |
Output is correct |
121 |
Correct |
1129 ms |
3732 KB |
Output is correct |
122 |
Correct |
741 ms |
3352 KB |
Output is correct |
123 |
Correct |
2352 ms |
5316 KB |
Output is correct |
124 |
Correct |
959 ms |
4316 KB |
Output is correct |
125 |
Correct |
719 ms |
4212 KB |
Output is correct |
126 |
Correct |
6177 ms |
12200 KB |
Output is correct |
127 |
Correct |
6293 ms |
13800 KB |
Output is correct |
128 |
Correct |
6198 ms |
13852 KB |
Output is correct |
129 |
Correct |
6156 ms |
13796 KB |
Output is correct |
130 |
Correct |
6109 ms |
13740 KB |
Output is correct |
131 |
Correct |
5655 ms |
13064 KB |
Output is correct |
132 |
Correct |
5450 ms |
13164 KB |
Output is correct |
133 |
Correct |
5751 ms |
13216 KB |
Output is correct |
134 |
Correct |
5590 ms |
13088 KB |
Output is correct |
135 |
Correct |
5589 ms |
13096 KB |
Output is correct |
136 |
Correct |
5317 ms |
12956 KB |
Output is correct |
137 |
Correct |
5584 ms |
13172 KB |
Output is correct |
138 |
Correct |
5305 ms |
12968 KB |
Output is correct |
139 |
Correct |
5582 ms |
13120 KB |
Output is correct |
140 |
Correct |
5455 ms |
13088 KB |
Output is correct |
141 |
Correct |
3755 ms |
9604 KB |
Output is correct |
142 |
Correct |
3889 ms |
9696 KB |
Output is correct |
143 |
Correct |
3831 ms |
9688 KB |
Output is correct |
144 |
Correct |
3817 ms |
9660 KB |
Output is correct |
145 |
Correct |
3877 ms |
9684 KB |
Output is correct |
146 |
Correct |
1577 ms |
7256 KB |
Output is correct |
147 |
Correct |
1534 ms |
7264 KB |
Output is correct |
148 |
Correct |
1574 ms |
7304 KB |
Output is correct |
149 |
Correct |
1524 ms |
7256 KB |
Output is correct |
150 |
Correct |
1595 ms |
7256 KB |
Output is correct |
151 |
Correct |
1225 ms |
7160 KB |
Output is correct |
152 |
Correct |
1218 ms |
7168 KB |
Output is correct |
153 |
Correct |
1294 ms |
7180 KB |
Output is correct |
154 |
Correct |
1222 ms |
7168 KB |
Output is correct |
155 |
Correct |
1226 ms |
7160 KB |
Output is correct |
156 |
Correct |
3175 ms |
10684 KB |
Output is correct |
157 |
Correct |
3135 ms |
10684 KB |
Output is correct |
158 |
Correct |
3147 ms |
10596 KB |
Output is correct |
159 |
Correct |
3088 ms |
10580 KB |
Output is correct |
160 |
Correct |
3105 ms |
10532 KB |
Output is correct |
161 |
Correct |
2423 ms |
11220 KB |
Output is correct |
162 |
Correct |
2420 ms |
11108 KB |
Output is correct |
163 |
Correct |
2398 ms |
11020 KB |
Output is correct |
164 |
Correct |
2376 ms |
11124 KB |
Output is correct |
165 |
Correct |
2461 ms |
11008 KB |
Output is correct |
166 |
Correct |
4407 ms |
13504 KB |
Output is correct |
167 |
Correct |
4568 ms |
13408 KB |
Output is correct |
168 |
Correct |
4502 ms |
13336 KB |
Output is correct |
169 |
Correct |
4564 ms |
13468 KB |
Output is correct |
170 |
Correct |
4496 ms |
13476 KB |
Output is correct |
171 |
Correct |
5390 ms |
14504 KB |
Output is correct |
172 |
Correct |
5274 ms |
14540 KB |
Output is correct |
173 |
Correct |
5187 ms |
14560 KB |
Output is correct |
174 |
Correct |
5083 ms |
14484 KB |
Output is correct |
175 |
Correct |
5676 ms |
14580 KB |
Output is correct |