#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 = ceil(sqrt(n));
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++) {
while(l > qry[i].first.first) {
l--;
ff[freq[arr[l]]]--;
if(ff[freq[arr[l]]] == 0) all.erase(freq[arr[l]]);
freq[arr[l]]++;
ff[freq[arr[l]]]++;
if(ff[freq[arr[l]]] == 1) all.insert(freq[arr[l]]);
}
while(r > qry[i].first.second) {
ff[freq[arr[r]]]--;
if(ff[freq[arr[r]]] == 0) all.erase(freq[arr[r]]);
freq[arr[r]]--;
ff[freq[arr[r]]]++;
if(ff[freq[arr[r]]] == 1) all.insert(freq[arr[r]]);
r--;
}
while(r < qry[i].first.second) {
r++;
ff[freq[arr[r]]]--;
if(ff[freq[arr[r]]] == 0) all.erase(freq[arr[r]]);
freq[arr[r]]++;
ff[freq[arr[r]]]++;
if(ff[freq[arr[r]]] == 1) all.insert(freq[arr[r]]);
}
while(l < qry[i].first.first) {
ff[freq[arr[l]]]--;
if(ff[freq[arr[l]]] == 0) all.erase(freq[arr[l]]);
freq[arr[l]]--;
ff[freq[arr[l]]]++;
if(ff[freq[arr[l]]] == 1) all.insert(freq[arr[l]]);
l++;
}
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 ps2=0;
int bruh=0;
for(int j=0; j<i; j++) {
for(int k=0; k<b[i].second; k++) {
for(int l=0; l<b[j].second; l++) {
bruh += b[i].first * b[j].first * (ps+k+1 - ps2-(l+1) + 1);
}
}
ps2+=b[j].second;
}
ans +=bruh;
ps+=b[i].second;
continue;
*/
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;
for(int j=2; j<=b[i].second; j++) ans += (b[i].second-j+1) * b[i].first * b[i].first * j;
}
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 |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
340 KB |
Output is correct |
7 |
Correct |
0 ms |
340 KB |
Output is correct |
8 |
Correct |
0 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
0 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
2 ms |
340 KB |
Output is correct |
4 |
Correct |
13 ms |
1236 KB |
Output is correct |
5 |
Correct |
27 ms |
2400 KB |
Output is correct |
6 |
Correct |
48 ms |
3108 KB |
Output is correct |
7 |
Correct |
36 ms |
3848 KB |
Output is correct |
8 |
Correct |
40 ms |
3056 KB |
Output is correct |
9 |
Correct |
41 ms |
3044 KB |
Output is correct |
10 |
Correct |
41 ms |
3404 KB |
Output is correct |
11 |
Correct |
40 ms |
3156 KB |
Output is correct |
12 |
Correct |
42 ms |
2992 KB |
Output is correct |
13 |
Correct |
50 ms |
3052 KB |
Output is correct |
14 |
Correct |
44 ms |
3208 KB |
Output is correct |
15 |
Correct |
42 ms |
3308 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
2 ms |
340 KB |
Output is correct |
4 |
Correct |
13 ms |
1236 KB |
Output is correct |
5 |
Correct |
27 ms |
2400 KB |
Output is correct |
6 |
Correct |
48 ms |
3108 KB |
Output is correct |
7 |
Correct |
36 ms |
3848 KB |
Output is correct |
8 |
Correct |
40 ms |
3056 KB |
Output is correct |
9 |
Correct |
41 ms |
3044 KB |
Output is correct |
10 |
Correct |
41 ms |
3404 KB |
Output is correct |
11 |
Correct |
40 ms |
3156 KB |
Output is correct |
12 |
Correct |
42 ms |
2992 KB |
Output is correct |
13 |
Correct |
50 ms |
3052 KB |
Output is correct |
14 |
Correct |
44 ms |
3208 KB |
Output is correct |
15 |
Correct |
42 ms |
3308 KB |
Output is correct |
16 |
Correct |
0 ms |
212 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Correct |
2 ms |
340 KB |
Output is correct |
19 |
Correct |
16 ms |
1240 KB |
Output is correct |
20 |
Correct |
32 ms |
2152 KB |
Output is correct |
21 |
Correct |
46 ms |
3064 KB |
Output is correct |
22 |
Correct |
46 ms |
2892 KB |
Output is correct |
23 |
Correct |
56 ms |
2972 KB |
Output is correct |
24 |
Correct |
46 ms |
2892 KB |
Output is correct |
25 |
Correct |
50 ms |
2892 KB |
Output is correct |
26 |
Correct |
49 ms |
2984 KB |
Output is correct |
27 |
Correct |
46 ms |
2952 KB |
Output is correct |
28 |
Correct |
46 ms |
3184 KB |
Output is correct |
29 |
Correct |
47 ms |
2932 KB |
Output is correct |
30 |
Correct |
48 ms |
2920 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
2 ms |
340 KB |
Output is correct |
4 |
Correct |
13 ms |
1236 KB |
Output is correct |
5 |
Correct |
27 ms |
2400 KB |
Output is correct |
6 |
Correct |
48 ms |
3108 KB |
Output is correct |
7 |
Correct |
36 ms |
3848 KB |
Output is correct |
8 |
Correct |
40 ms |
3056 KB |
Output is correct |
9 |
Correct |
41 ms |
3044 KB |
Output is correct |
10 |
Correct |
41 ms |
3404 KB |
Output is correct |
11 |
Correct |
40 ms |
3156 KB |
Output is correct |
12 |
Correct |
42 ms |
2992 KB |
Output is correct |
13 |
Correct |
50 ms |
3052 KB |
Output is correct |
14 |
Correct |
44 ms |
3208 KB |
Output is correct |
15 |
Correct |
42 ms |
3308 KB |
Output is correct |
16 |
Correct |
0 ms |
212 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Correct |
2 ms |
340 KB |
Output is correct |
19 |
Correct |
16 ms |
1240 KB |
Output is correct |
20 |
Correct |
32 ms |
2152 KB |
Output is correct |
21 |
Correct |
46 ms |
3064 KB |
Output is correct |
22 |
Correct |
46 ms |
2892 KB |
Output is correct |
23 |
Correct |
56 ms |
2972 KB |
Output is correct |
24 |
Correct |
46 ms |
2892 KB |
Output is correct |
25 |
Correct |
50 ms |
2892 KB |
Output is correct |
26 |
Correct |
49 ms |
2984 KB |
Output is correct |
27 |
Correct |
46 ms |
2952 KB |
Output is correct |
28 |
Correct |
46 ms |
3184 KB |
Output is correct |
29 |
Correct |
47 ms |
2932 KB |
Output is correct |
30 |
Correct |
48 ms |
2920 KB |
Output is correct |
31 |
Correct |
1 ms |
340 KB |
Output is correct |
32 |
Correct |
0 ms |
340 KB |
Output is correct |
33 |
Correct |
1 ms |
340 KB |
Output is correct |
34 |
Correct |
2 ms |
340 KB |
Output is correct |
35 |
Correct |
1 ms |
340 KB |
Output is correct |
36 |
Correct |
1 ms |
340 KB |
Output is correct |
37 |
Correct |
7 ms |
852 KB |
Output is correct |
38 |
Correct |
5 ms |
960 KB |
Output is correct |
39 |
Correct |
14 ms |
1564 KB |
Output is correct |
40 |
Correct |
23 ms |
2684 KB |
Output is correct |
41 |
Correct |
43 ms |
3788 KB |
Output is correct |
42 |
Correct |
38 ms |
3808 KB |
Output is correct |
43 |
Correct |
39 ms |
3796 KB |
Output is correct |
44 |
Correct |
38 ms |
3796 KB |
Output is correct |
45 |
Correct |
39 ms |
3848 KB |
Output is correct |
46 |
Correct |
37 ms |
3796 KB |
Output is correct |
47 |
Correct |
37 ms |
3796 KB |
Output is correct |
48 |
Correct |
39 ms |
3812 KB |
Output is correct |
49 |
Correct |
39 ms |
3848 KB |
Output is correct |
50 |
Correct |
40 ms |
3792 KB |
Output is correct |
51 |
Correct |
38 ms |
3804 KB |
Output is correct |
52 |
Correct |
37 ms |
3792 KB |
Output is correct |
53 |
Correct |
39 ms |
3788 KB |
Output is correct |
54 |
Correct |
41 ms |
3812 KB |
Output is correct |
55 |
Correct |
38 ms |
3804 KB |
Output is correct |
56 |
Correct |
38 ms |
3860 KB |
Output is correct |
57 |
Correct |
39 ms |
3808 KB |
Output is correct |
58 |
Correct |
38 ms |
3800 KB |
Output is correct |
59 |
Correct |
38 ms |
3864 KB |
Output is correct |
60 |
Correct |
43 ms |
3852 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 |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
340 KB |
Output is correct |
7 |
Correct |
0 ms |
340 KB |
Output is correct |
8 |
Correct |
0 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
0 ms |
340 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
2 ms |
340 KB |
Output is correct |
14 |
Correct |
13 ms |
1236 KB |
Output is correct |
15 |
Correct |
27 ms |
2400 KB |
Output is correct |
16 |
Correct |
48 ms |
3108 KB |
Output is correct |
17 |
Correct |
36 ms |
3848 KB |
Output is correct |
18 |
Correct |
40 ms |
3056 KB |
Output is correct |
19 |
Correct |
41 ms |
3044 KB |
Output is correct |
20 |
Correct |
41 ms |
3404 KB |
Output is correct |
21 |
Correct |
40 ms |
3156 KB |
Output is correct |
22 |
Correct |
42 ms |
2992 KB |
Output is correct |
23 |
Correct |
50 ms |
3052 KB |
Output is correct |
24 |
Correct |
44 ms |
3208 KB |
Output is correct |
25 |
Correct |
42 ms |
3308 KB |
Output is correct |
26 |
Correct |
0 ms |
212 KB |
Output is correct |
27 |
Correct |
1 ms |
340 KB |
Output is correct |
28 |
Correct |
2 ms |
340 KB |
Output is correct |
29 |
Correct |
16 ms |
1240 KB |
Output is correct |
30 |
Correct |
32 ms |
2152 KB |
Output is correct |
31 |
Correct |
46 ms |
3064 KB |
Output is correct |
32 |
Correct |
46 ms |
2892 KB |
Output is correct |
33 |
Correct |
56 ms |
2972 KB |
Output is correct |
34 |
Correct |
46 ms |
2892 KB |
Output is correct |
35 |
Correct |
50 ms |
2892 KB |
Output is correct |
36 |
Correct |
49 ms |
2984 KB |
Output is correct |
37 |
Correct |
46 ms |
2952 KB |
Output is correct |
38 |
Correct |
46 ms |
3184 KB |
Output is correct |
39 |
Correct |
47 ms |
2932 KB |
Output is correct |
40 |
Correct |
48 ms |
2920 KB |
Output is correct |
41 |
Correct |
1 ms |
340 KB |
Output is correct |
42 |
Correct |
0 ms |
340 KB |
Output is correct |
43 |
Correct |
1 ms |
340 KB |
Output is correct |
44 |
Correct |
2 ms |
340 KB |
Output is correct |
45 |
Correct |
1 ms |
340 KB |
Output is correct |
46 |
Correct |
1 ms |
340 KB |
Output is correct |
47 |
Correct |
7 ms |
852 KB |
Output is correct |
48 |
Correct |
5 ms |
960 KB |
Output is correct |
49 |
Correct |
14 ms |
1564 KB |
Output is correct |
50 |
Correct |
23 ms |
2684 KB |
Output is correct |
51 |
Correct |
43 ms |
3788 KB |
Output is correct |
52 |
Correct |
38 ms |
3808 KB |
Output is correct |
53 |
Correct |
39 ms |
3796 KB |
Output is correct |
54 |
Correct |
38 ms |
3796 KB |
Output is correct |
55 |
Correct |
39 ms |
3848 KB |
Output is correct |
56 |
Correct |
37 ms |
3796 KB |
Output is correct |
57 |
Correct |
37 ms |
3796 KB |
Output is correct |
58 |
Correct |
39 ms |
3812 KB |
Output is correct |
59 |
Correct |
39 ms |
3848 KB |
Output is correct |
60 |
Correct |
40 ms |
3792 KB |
Output is correct |
61 |
Correct |
38 ms |
3804 KB |
Output is correct |
62 |
Correct |
37 ms |
3792 KB |
Output is correct |
63 |
Correct |
39 ms |
3788 KB |
Output is correct |
64 |
Correct |
41 ms |
3812 KB |
Output is correct |
65 |
Correct |
38 ms |
3804 KB |
Output is correct |
66 |
Correct |
38 ms |
3860 KB |
Output is correct |
67 |
Correct |
39 ms |
3808 KB |
Output is correct |
68 |
Correct |
38 ms |
3800 KB |
Output is correct |
69 |
Correct |
38 ms |
3864 KB |
Output is correct |
70 |
Correct |
43 ms |
3852 KB |
Output is correct |
71 |
Correct |
5 ms |
852 KB |
Output is correct |
72 |
Correct |
8 ms |
980 KB |
Output is correct |
73 |
Correct |
5 ms |
852 KB |
Output is correct |
74 |
Correct |
5 ms |
952 KB |
Output is correct |
75 |
Correct |
5 ms |
852 KB |
Output is correct |
76 |
Correct |
9 ms |
1612 KB |
Output is correct |
77 |
Correct |
8 ms |
1620 KB |
Output is correct |
78 |
Correct |
8 ms |
1604 KB |
Output is correct |
79 |
Correct |
8 ms |
1620 KB |
Output is correct |
80 |
Correct |
8 ms |
1620 KB |
Output is correct |
81 |
Correct |
17 ms |
2900 KB |
Output is correct |
82 |
Correct |
16 ms |
2904 KB |
Output is correct |
83 |
Correct |
17 ms |
2832 KB |
Output is correct |
84 |
Correct |
17 ms |
2904 KB |
Output is correct |
85 |
Correct |
17 ms |
2892 KB |
Output is correct |
86 |
Correct |
19 ms |
3012 KB |
Output is correct |
87 |
Correct |
17 ms |
3028 KB |
Output is correct |
88 |
Correct |
18 ms |
3020 KB |
Output is correct |
89 |
Correct |
18 ms |
3028 KB |
Output is correct |
90 |
Correct |
17 ms |
3020 KB |
Output is correct |
91 |
Correct |
27 ms |
5084 KB |
Output is correct |
92 |
Correct |
28 ms |
5068 KB |
Output is correct |
93 |
Correct |
28 ms |
5080 KB |
Output is correct |
94 |
Correct |
28 ms |
5076 KB |
Output is correct |
95 |
Correct |
28 ms |
5080 KB |
Output is correct |
96 |
Correct |
32 ms |
6120 KB |
Output is correct |
97 |
Correct |
31 ms |
6080 KB |
Output is correct |
98 |
Correct |
31 ms |
6096 KB |
Output is correct |
99 |
Correct |
31 ms |
6116 KB |
Output is correct |
100 |
Correct |
30 ms |
6088 KB |
Output is correct |
101 |
Correct |
33 ms |
6104 KB |
Output is correct |
102 |
Correct |
32 ms |
6112 KB |
Output is correct |
103 |
Correct |
32 ms |
6104 KB |
Output is correct |
104 |
Correct |
33 ms |
6108 KB |
Output is correct |
105 |
Correct |
32 ms |
6120 KB |
Output is correct |
106 |
Correct |
31 ms |
6476 KB |
Output is correct |
107 |
Correct |
31 ms |
6496 KB |
Output is correct |
108 |
Correct |
34 ms |
6476 KB |
Output is correct |
109 |
Correct |
32 ms |
6492 KB |
Output is correct |
110 |
Correct |
35 ms |
6504 KB |
Output is correct |
111 |
Correct |
38 ms |
6488 KB |
Output is correct |
112 |
Correct |
32 ms |
6492 KB |
Output is correct |
113 |
Correct |
33 ms |
6476 KB |
Output is correct |
114 |
Correct |
31 ms |
6536 KB |
Output is correct |
115 |
Correct |
32 ms |
6480 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 |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
340 KB |
Output is correct |
7 |
Correct |
0 ms |
340 KB |
Output is correct |
8 |
Correct |
0 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
0 ms |
340 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
2 ms |
340 KB |
Output is correct |
14 |
Correct |
13 ms |
1236 KB |
Output is correct |
15 |
Correct |
27 ms |
2400 KB |
Output is correct |
16 |
Correct |
48 ms |
3108 KB |
Output is correct |
17 |
Correct |
36 ms |
3848 KB |
Output is correct |
18 |
Correct |
40 ms |
3056 KB |
Output is correct |
19 |
Correct |
41 ms |
3044 KB |
Output is correct |
20 |
Correct |
41 ms |
3404 KB |
Output is correct |
21 |
Correct |
40 ms |
3156 KB |
Output is correct |
22 |
Correct |
42 ms |
2992 KB |
Output is correct |
23 |
Correct |
50 ms |
3052 KB |
Output is correct |
24 |
Correct |
44 ms |
3208 KB |
Output is correct |
25 |
Correct |
42 ms |
3308 KB |
Output is correct |
26 |
Correct |
0 ms |
212 KB |
Output is correct |
27 |
Correct |
1 ms |
340 KB |
Output is correct |
28 |
Correct |
2 ms |
340 KB |
Output is correct |
29 |
Correct |
16 ms |
1240 KB |
Output is correct |
30 |
Correct |
32 ms |
2152 KB |
Output is correct |
31 |
Correct |
46 ms |
3064 KB |
Output is correct |
32 |
Correct |
46 ms |
2892 KB |
Output is correct |
33 |
Correct |
56 ms |
2972 KB |
Output is correct |
34 |
Correct |
46 ms |
2892 KB |
Output is correct |
35 |
Correct |
50 ms |
2892 KB |
Output is correct |
36 |
Correct |
49 ms |
2984 KB |
Output is correct |
37 |
Correct |
46 ms |
2952 KB |
Output is correct |
38 |
Correct |
46 ms |
3184 KB |
Output is correct |
39 |
Correct |
47 ms |
2932 KB |
Output is correct |
40 |
Correct |
48 ms |
2920 KB |
Output is correct |
41 |
Correct |
1 ms |
340 KB |
Output is correct |
42 |
Correct |
0 ms |
340 KB |
Output is correct |
43 |
Correct |
1 ms |
340 KB |
Output is correct |
44 |
Correct |
2 ms |
340 KB |
Output is correct |
45 |
Correct |
1 ms |
340 KB |
Output is correct |
46 |
Correct |
1 ms |
340 KB |
Output is correct |
47 |
Correct |
7 ms |
852 KB |
Output is correct |
48 |
Correct |
5 ms |
960 KB |
Output is correct |
49 |
Correct |
14 ms |
1564 KB |
Output is correct |
50 |
Correct |
23 ms |
2684 KB |
Output is correct |
51 |
Correct |
43 ms |
3788 KB |
Output is correct |
52 |
Correct |
38 ms |
3808 KB |
Output is correct |
53 |
Correct |
39 ms |
3796 KB |
Output is correct |
54 |
Correct |
38 ms |
3796 KB |
Output is correct |
55 |
Correct |
39 ms |
3848 KB |
Output is correct |
56 |
Correct |
37 ms |
3796 KB |
Output is correct |
57 |
Correct |
37 ms |
3796 KB |
Output is correct |
58 |
Correct |
39 ms |
3812 KB |
Output is correct |
59 |
Correct |
39 ms |
3848 KB |
Output is correct |
60 |
Correct |
40 ms |
3792 KB |
Output is correct |
61 |
Correct |
38 ms |
3804 KB |
Output is correct |
62 |
Correct |
37 ms |
3792 KB |
Output is correct |
63 |
Correct |
39 ms |
3788 KB |
Output is correct |
64 |
Correct |
41 ms |
3812 KB |
Output is correct |
65 |
Correct |
38 ms |
3804 KB |
Output is correct |
66 |
Correct |
38 ms |
3860 KB |
Output is correct |
67 |
Correct |
39 ms |
3808 KB |
Output is correct |
68 |
Correct |
38 ms |
3800 KB |
Output is correct |
69 |
Correct |
38 ms |
3864 KB |
Output is correct |
70 |
Correct |
43 ms |
3852 KB |
Output is correct |
71 |
Correct |
5 ms |
852 KB |
Output is correct |
72 |
Correct |
8 ms |
980 KB |
Output is correct |
73 |
Correct |
5 ms |
852 KB |
Output is correct |
74 |
Correct |
5 ms |
952 KB |
Output is correct |
75 |
Correct |
5 ms |
852 KB |
Output is correct |
76 |
Correct |
9 ms |
1612 KB |
Output is correct |
77 |
Correct |
8 ms |
1620 KB |
Output is correct |
78 |
Correct |
8 ms |
1604 KB |
Output is correct |
79 |
Correct |
8 ms |
1620 KB |
Output is correct |
80 |
Correct |
8 ms |
1620 KB |
Output is correct |
81 |
Correct |
17 ms |
2900 KB |
Output is correct |
82 |
Correct |
16 ms |
2904 KB |
Output is correct |
83 |
Correct |
17 ms |
2832 KB |
Output is correct |
84 |
Correct |
17 ms |
2904 KB |
Output is correct |
85 |
Correct |
17 ms |
2892 KB |
Output is correct |
86 |
Correct |
19 ms |
3012 KB |
Output is correct |
87 |
Correct |
17 ms |
3028 KB |
Output is correct |
88 |
Correct |
18 ms |
3020 KB |
Output is correct |
89 |
Correct |
18 ms |
3028 KB |
Output is correct |
90 |
Correct |
17 ms |
3020 KB |
Output is correct |
91 |
Correct |
27 ms |
5084 KB |
Output is correct |
92 |
Correct |
28 ms |
5068 KB |
Output is correct |
93 |
Correct |
28 ms |
5080 KB |
Output is correct |
94 |
Correct |
28 ms |
5076 KB |
Output is correct |
95 |
Correct |
28 ms |
5080 KB |
Output is correct |
96 |
Correct |
32 ms |
6120 KB |
Output is correct |
97 |
Correct |
31 ms |
6080 KB |
Output is correct |
98 |
Correct |
31 ms |
6096 KB |
Output is correct |
99 |
Correct |
31 ms |
6116 KB |
Output is correct |
100 |
Correct |
30 ms |
6088 KB |
Output is correct |
101 |
Correct |
33 ms |
6104 KB |
Output is correct |
102 |
Correct |
32 ms |
6112 KB |
Output is correct |
103 |
Correct |
32 ms |
6104 KB |
Output is correct |
104 |
Correct |
33 ms |
6108 KB |
Output is correct |
105 |
Correct |
32 ms |
6120 KB |
Output is correct |
106 |
Correct |
31 ms |
6476 KB |
Output is correct |
107 |
Correct |
31 ms |
6496 KB |
Output is correct |
108 |
Correct |
34 ms |
6476 KB |
Output is correct |
109 |
Correct |
32 ms |
6492 KB |
Output is correct |
110 |
Correct |
35 ms |
6504 KB |
Output is correct |
111 |
Correct |
38 ms |
6488 KB |
Output is correct |
112 |
Correct |
32 ms |
6492 KB |
Output is correct |
113 |
Correct |
33 ms |
6476 KB |
Output is correct |
114 |
Correct |
31 ms |
6536 KB |
Output is correct |
115 |
Correct |
32 ms |
6480 KB |
Output is correct |
116 |
Correct |
343 ms |
2956 KB |
Output is correct |
117 |
Correct |
305 ms |
2840 KB |
Output is correct |
118 |
Correct |
1785 ms |
3520 KB |
Output is correct |
119 |
Correct |
883 ms |
3572 KB |
Output is correct |
120 |
Correct |
576 ms |
3532 KB |
Output is correct |
121 |
Correct |
1544 ms |
4180 KB |
Output is correct |
122 |
Correct |
965 ms |
4232 KB |
Output is correct |
123 |
Correct |
4761 ms |
5548 KB |
Output is correct |
124 |
Correct |
1688 ms |
5724 KB |
Output is correct |
125 |
Correct |
1548 ms |
5772 KB |
Output is correct |
126 |
Execution timed out |
7057 ms |
5988 KB |
Time limit exceeded |
127 |
Halted |
0 ms |
0 KB |
- |