#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fi first
#define se second
#define pb push_back
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<ii, ii> iiii;
const int N = 4e5 + 5;
const int oo = 1e18 + 7, mod = 1e9 + 7;
int n, q, a[N];
int cnt[N];
int cntt[N];
int S = 500;
bool cmp(iii a, iii b){
if(a.fi.fi / S != b.fi.fi / S) return (a.fi.fi / S < b.fi.fi / S);
else{
if(!((a.fi.fi / S) & 1)) return (a.fi.se < b.fi.se);
else return (a.fi.se > b.fi.se);
}
}
vector<iii> queries;
vector<int> big;
set<int> se;
void ins(int pos){
cntt[cnt[a[pos]]]--;
cnt[a[pos]]++;
//cout << a[pos] << " " << cnt[a[pos]] << "\n";
cntt[cnt[a[pos]]]++;
}
void er(int pos){
cntt[cnt[a[pos]]]--;
cnt[a[pos]]--;
//cout << a[pos] << " " << cnt[a[pos]] << "\n";
cntt[cnt[a[pos]]]++;
}
int answer[N];
void process(){
cin >> n >> q;
for(int i = 1; i <= n; i++){
cin >> a[i];
cnt[a[i]]++;
//cnt[a[i]].fi++;
}
for(int i = 1; i <= 300000; i++) if(cnt[i] >= S) big.pb(i);
for(int i = 1; i <= 300000; i++) cnt[i] = 0;
for(int i = 1; i <= q; i++){
int l, r;
cin >> l >> r;
queries.pb({{l, r}, i});
}
sort(queries.begin(), queries.end(), cmp);
int lstl = 0, lstr = 0;
bool ck = 1;
for(int i = 0; i < q; i++){
//sort(cnt + 1, cnt + 300000 + 1, greater<ii>());
while(lstr < queries[i].fi.se){
//ins(a[lstr]);
lstr++;
ins(lstr);
}
while(lstl > queries[i].fi.fi){
lstl--;
ins(lstl);
}
while(lstl < queries[i].fi.fi){
if(lstl) er(lstl);
lstl++;
}
while(lstr > queries[i].fi.se){
er(lstr);
lstr--;
}
if(!ck) continue;
//cout << lstl << " " << lstr << "\n";
vector<ii> vc1, vc2;
int total = 0;
for(int it = 1; it < S; it++){
if(!cntt[it]) continue;
int temp1 = (cntt[it] + 1) / 2, temp2 = cntt[it] / 2;
if(!(total & 1)){
if(temp1) vc1.pb({it, temp1});
if(temp2) vc2.pb({it, temp2});
}
else{
if(temp2) vc1.pb({it, temp2});
if(temp1) vc2.pb({it, temp1});
}
total += cntt[it];
}
set<int> uos;
for(auto it : big){
if(cnt[it] < S) continue;
//if(uos.find(cnt[it]) != uos.end()) continue;
uos.insert(cnt[it]);
}
for(auto it : uos){
int temp1 = (cntt[it] + 1) / 2, temp2 = cntt[it] / 2;
if(!(total & 1)){
if(temp1) vc1.pb({it, temp1});
if(temp2) vc2.pb({it, temp2});
}
else{
if(temp2) vc1.pb({it, temp2});
if(temp1) vc2.pb({it, temp1});
}
total += cntt[it];
}
//sort(vc1.begin(), vc1.end()), sort(vc2.begin(), vc2.end());
//for(int j = 1; j <= 5; j++) cout << j << " " << cnt[j] << "\n";
for(int j = vc2.size() - 1; j >= 0; j--) vc1.pb(vc2[j]);
//for(auto it : vc1) if(lstl == 1 && lstr == 8) cout << it.fi << " " << it.se << "\n";
int tol = 0, tol2 = 0, toll = 1;
for(auto it : vc1){
//cout << lstl << " " << lstr << " " << it.fi << " " << it.se << "\n";
int temp = ((it.se * (it.se + 1) * (2 * it.se + 1)) / 6 + (it.se * (it.se + 1)) / 2) / 2 - it.se;
temp = temp * it.fi * it.fi + toll * it.fi * it.se;
temp += it.se * (it.fi * (it.fi - 1) / 2);
temp += tol * ((it.se * (it.se - 1)) / 2) * it.fi;
toll += ((it.se * (it.se + 1)) / 2) * it.fi + tol * (it.se - 1);
tol += it.fi * it.se;
toll += tol;
tol2 += temp;
}
answer[queries[i].se] = tol2;
//if(!(i % 1000) && (long double)clock() / (long double)CLOCKS_PER_SEC >= 3.0) ck = 0;
}
for(int i = 1; i <= q; i++) cout << answer[i] << "\n";
}
signed main(){
ios_base::sync_with_stdio(0);
//freopen("diverse.inp", "r", stdin);
//freopen("diverse.out", "w", stdout);
process();
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
2636 KB |
Output is correct |
2 |
Correct |
3 ms |
2640 KB |
Output is correct |
3 |
Correct |
3 ms |
2644 KB |
Output is correct |
4 |
Correct |
2 ms |
2644 KB |
Output is correct |
5 |
Correct |
3 ms |
2644 KB |
Output is correct |
6 |
Correct |
2 ms |
2644 KB |
Output is correct |
7 |
Correct |
2 ms |
2644 KB |
Output is correct |
8 |
Correct |
3 ms |
2644 KB |
Output is correct |
9 |
Correct |
2 ms |
2644 KB |
Output is correct |
10 |
Correct |
3 ms |
2644 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
2644 KB |
Output is correct |
2 |
Correct |
3 ms |
2644 KB |
Output is correct |
3 |
Correct |
4 ms |
2772 KB |
Output is correct |
4 |
Correct |
8 ms |
3804 KB |
Output is correct |
5 |
Correct |
15 ms |
5128 KB |
Output is correct |
6 |
Correct |
23 ms |
6048 KB |
Output is correct |
7 |
Correct |
21 ms |
6880 KB |
Output is correct |
8 |
Correct |
21 ms |
5988 KB |
Output is correct |
9 |
Correct |
21 ms |
6224 KB |
Output is correct |
10 |
Correct |
21 ms |
6432 KB |
Output is correct |
11 |
Correct |
21 ms |
6232 KB |
Output is correct |
12 |
Correct |
24 ms |
6056 KB |
Output is correct |
13 |
Correct |
21 ms |
5964 KB |
Output is correct |
14 |
Correct |
21 ms |
6188 KB |
Output is correct |
15 |
Correct |
21 ms |
6100 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
2644 KB |
Output is correct |
2 |
Correct |
3 ms |
2644 KB |
Output is correct |
3 |
Correct |
4 ms |
2772 KB |
Output is correct |
4 |
Correct |
8 ms |
3804 KB |
Output is correct |
5 |
Correct |
15 ms |
5128 KB |
Output is correct |
6 |
Correct |
23 ms |
6048 KB |
Output is correct |
7 |
Correct |
21 ms |
6880 KB |
Output is correct |
8 |
Correct |
21 ms |
5988 KB |
Output is correct |
9 |
Correct |
21 ms |
6224 KB |
Output is correct |
10 |
Correct |
21 ms |
6432 KB |
Output is correct |
11 |
Correct |
21 ms |
6232 KB |
Output is correct |
12 |
Correct |
24 ms |
6056 KB |
Output is correct |
13 |
Correct |
21 ms |
5964 KB |
Output is correct |
14 |
Correct |
21 ms |
6188 KB |
Output is correct |
15 |
Correct |
21 ms |
6100 KB |
Output is correct |
16 |
Correct |
3 ms |
2644 KB |
Output is correct |
17 |
Correct |
3 ms |
2644 KB |
Output is correct |
18 |
Correct |
4 ms |
2772 KB |
Output is correct |
19 |
Correct |
10 ms |
3796 KB |
Output is correct |
20 |
Correct |
18 ms |
4992 KB |
Output is correct |
21 |
Correct |
24 ms |
6296 KB |
Output is correct |
22 |
Correct |
25 ms |
6100 KB |
Output is correct |
23 |
Correct |
22 ms |
6240 KB |
Output is correct |
24 |
Correct |
23 ms |
6000 KB |
Output is correct |
25 |
Correct |
24 ms |
6144 KB |
Output is correct |
26 |
Correct |
23 ms |
6080 KB |
Output is correct |
27 |
Correct |
22 ms |
6092 KB |
Output is correct |
28 |
Correct |
22 ms |
6348 KB |
Output is correct |
29 |
Correct |
21 ms |
6088 KB |
Output is correct |
30 |
Correct |
22 ms |
6076 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
2644 KB |
Output is correct |
2 |
Correct |
3 ms |
2644 KB |
Output is correct |
3 |
Correct |
4 ms |
2772 KB |
Output is correct |
4 |
Correct |
8 ms |
3804 KB |
Output is correct |
5 |
Correct |
15 ms |
5128 KB |
Output is correct |
6 |
Correct |
23 ms |
6048 KB |
Output is correct |
7 |
Correct |
21 ms |
6880 KB |
Output is correct |
8 |
Correct |
21 ms |
5988 KB |
Output is correct |
9 |
Correct |
21 ms |
6224 KB |
Output is correct |
10 |
Correct |
21 ms |
6432 KB |
Output is correct |
11 |
Correct |
21 ms |
6232 KB |
Output is correct |
12 |
Correct |
24 ms |
6056 KB |
Output is correct |
13 |
Correct |
21 ms |
5964 KB |
Output is correct |
14 |
Correct |
21 ms |
6188 KB |
Output is correct |
15 |
Correct |
21 ms |
6100 KB |
Output is correct |
16 |
Correct |
3 ms |
2644 KB |
Output is correct |
17 |
Correct |
3 ms |
2644 KB |
Output is correct |
18 |
Correct |
4 ms |
2772 KB |
Output is correct |
19 |
Correct |
10 ms |
3796 KB |
Output is correct |
20 |
Correct |
18 ms |
4992 KB |
Output is correct |
21 |
Correct |
24 ms |
6296 KB |
Output is correct |
22 |
Correct |
25 ms |
6100 KB |
Output is correct |
23 |
Correct |
22 ms |
6240 KB |
Output is correct |
24 |
Correct |
23 ms |
6000 KB |
Output is correct |
25 |
Correct |
24 ms |
6144 KB |
Output is correct |
26 |
Correct |
23 ms |
6080 KB |
Output is correct |
27 |
Correct |
22 ms |
6092 KB |
Output is correct |
28 |
Correct |
22 ms |
6348 KB |
Output is correct |
29 |
Correct |
21 ms |
6088 KB |
Output is correct |
30 |
Correct |
22 ms |
6076 KB |
Output is correct |
31 |
Correct |
3 ms |
2644 KB |
Output is correct |
32 |
Correct |
3 ms |
2644 KB |
Output is correct |
33 |
Correct |
3 ms |
2644 KB |
Output is correct |
34 |
Correct |
3 ms |
2772 KB |
Output is correct |
35 |
Correct |
3 ms |
2772 KB |
Output is correct |
36 |
Correct |
5 ms |
2772 KB |
Output is correct |
37 |
Correct |
7 ms |
3284 KB |
Output is correct |
38 |
Correct |
7 ms |
3284 KB |
Output is correct |
39 |
Correct |
10 ms |
3796 KB |
Output is correct |
40 |
Correct |
17 ms |
5040 KB |
Output is correct |
41 |
Correct |
23 ms |
6180 KB |
Output is correct |
42 |
Correct |
23 ms |
6228 KB |
Output is correct |
43 |
Correct |
24 ms |
6192 KB |
Output is correct |
44 |
Correct |
24 ms |
6216 KB |
Output is correct |
45 |
Correct |
24 ms |
6220 KB |
Output is correct |
46 |
Correct |
24 ms |
6176 KB |
Output is correct |
47 |
Correct |
26 ms |
6156 KB |
Output is correct |
48 |
Correct |
24 ms |
6168 KB |
Output is correct |
49 |
Correct |
24 ms |
6228 KB |
Output is correct |
50 |
Correct |
24 ms |
6132 KB |
Output is correct |
51 |
Correct |
23 ms |
6220 KB |
Output is correct |
52 |
Correct |
24 ms |
6116 KB |
Output is correct |
53 |
Correct |
25 ms |
6220 KB |
Output is correct |
54 |
Correct |
24 ms |
6200 KB |
Output is correct |
55 |
Correct |
23 ms |
6192 KB |
Output is correct |
56 |
Correct |
24 ms |
6220 KB |
Output is correct |
57 |
Correct |
23 ms |
6116 KB |
Output is correct |
58 |
Correct |
23 ms |
6176 KB |
Output is correct |
59 |
Correct |
25 ms |
6160 KB |
Output is correct |
60 |
Correct |
24 ms |
6196 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
2636 KB |
Output is correct |
2 |
Correct |
3 ms |
2640 KB |
Output is correct |
3 |
Correct |
3 ms |
2644 KB |
Output is correct |
4 |
Correct |
2 ms |
2644 KB |
Output is correct |
5 |
Correct |
3 ms |
2644 KB |
Output is correct |
6 |
Correct |
2 ms |
2644 KB |
Output is correct |
7 |
Correct |
2 ms |
2644 KB |
Output is correct |
8 |
Correct |
3 ms |
2644 KB |
Output is correct |
9 |
Correct |
2 ms |
2644 KB |
Output is correct |
10 |
Correct |
3 ms |
2644 KB |
Output is correct |
11 |
Correct |
3 ms |
2644 KB |
Output is correct |
12 |
Correct |
3 ms |
2644 KB |
Output is correct |
13 |
Correct |
4 ms |
2772 KB |
Output is correct |
14 |
Correct |
8 ms |
3804 KB |
Output is correct |
15 |
Correct |
15 ms |
5128 KB |
Output is correct |
16 |
Correct |
23 ms |
6048 KB |
Output is correct |
17 |
Correct |
21 ms |
6880 KB |
Output is correct |
18 |
Correct |
21 ms |
5988 KB |
Output is correct |
19 |
Correct |
21 ms |
6224 KB |
Output is correct |
20 |
Correct |
21 ms |
6432 KB |
Output is correct |
21 |
Correct |
21 ms |
6232 KB |
Output is correct |
22 |
Correct |
24 ms |
6056 KB |
Output is correct |
23 |
Correct |
21 ms |
5964 KB |
Output is correct |
24 |
Correct |
21 ms |
6188 KB |
Output is correct |
25 |
Correct |
21 ms |
6100 KB |
Output is correct |
26 |
Correct |
3 ms |
2644 KB |
Output is correct |
27 |
Correct |
3 ms |
2644 KB |
Output is correct |
28 |
Correct |
4 ms |
2772 KB |
Output is correct |
29 |
Correct |
10 ms |
3796 KB |
Output is correct |
30 |
Correct |
18 ms |
4992 KB |
Output is correct |
31 |
Correct |
24 ms |
6296 KB |
Output is correct |
32 |
Correct |
25 ms |
6100 KB |
Output is correct |
33 |
Correct |
22 ms |
6240 KB |
Output is correct |
34 |
Correct |
23 ms |
6000 KB |
Output is correct |
35 |
Correct |
24 ms |
6144 KB |
Output is correct |
36 |
Correct |
23 ms |
6080 KB |
Output is correct |
37 |
Correct |
22 ms |
6092 KB |
Output is correct |
38 |
Correct |
22 ms |
6348 KB |
Output is correct |
39 |
Correct |
21 ms |
6088 KB |
Output is correct |
40 |
Correct |
22 ms |
6076 KB |
Output is correct |
41 |
Correct |
3 ms |
2644 KB |
Output is correct |
42 |
Correct |
3 ms |
2644 KB |
Output is correct |
43 |
Correct |
3 ms |
2644 KB |
Output is correct |
44 |
Correct |
3 ms |
2772 KB |
Output is correct |
45 |
Correct |
3 ms |
2772 KB |
Output is correct |
46 |
Correct |
5 ms |
2772 KB |
Output is correct |
47 |
Correct |
7 ms |
3284 KB |
Output is correct |
48 |
Correct |
7 ms |
3284 KB |
Output is correct |
49 |
Correct |
10 ms |
3796 KB |
Output is correct |
50 |
Correct |
17 ms |
5040 KB |
Output is correct |
51 |
Correct |
23 ms |
6180 KB |
Output is correct |
52 |
Correct |
23 ms |
6228 KB |
Output is correct |
53 |
Correct |
24 ms |
6192 KB |
Output is correct |
54 |
Correct |
24 ms |
6216 KB |
Output is correct |
55 |
Correct |
24 ms |
6220 KB |
Output is correct |
56 |
Correct |
24 ms |
6176 KB |
Output is correct |
57 |
Correct |
26 ms |
6156 KB |
Output is correct |
58 |
Correct |
24 ms |
6168 KB |
Output is correct |
59 |
Correct |
24 ms |
6228 KB |
Output is correct |
60 |
Correct |
24 ms |
6132 KB |
Output is correct |
61 |
Correct |
23 ms |
6220 KB |
Output is correct |
62 |
Correct |
24 ms |
6116 KB |
Output is correct |
63 |
Correct |
25 ms |
6220 KB |
Output is correct |
64 |
Correct |
24 ms |
6200 KB |
Output is correct |
65 |
Correct |
23 ms |
6192 KB |
Output is correct |
66 |
Correct |
24 ms |
6220 KB |
Output is correct |
67 |
Correct |
23 ms |
6116 KB |
Output is correct |
68 |
Correct |
23 ms |
6176 KB |
Output is correct |
69 |
Correct |
25 ms |
6160 KB |
Output is correct |
70 |
Correct |
24 ms |
6196 KB |
Output is correct |
71 |
Correct |
7 ms |
3304 KB |
Output is correct |
72 |
Correct |
7 ms |
3284 KB |
Output is correct |
73 |
Correct |
7 ms |
3200 KB |
Output is correct |
74 |
Correct |
6 ms |
3292 KB |
Output is correct |
75 |
Correct |
7 ms |
3320 KB |
Output is correct |
76 |
Correct |
14 ms |
3844 KB |
Output is correct |
77 |
Correct |
12 ms |
3932 KB |
Output is correct |
78 |
Correct |
15 ms |
3940 KB |
Output is correct |
79 |
Correct |
11 ms |
3944 KB |
Output is correct |
80 |
Correct |
12 ms |
3860 KB |
Output is correct |
81 |
Correct |
20 ms |
5196 KB |
Output is correct |
82 |
Correct |
18 ms |
5104 KB |
Output is correct |
83 |
Correct |
19 ms |
5220 KB |
Output is correct |
84 |
Correct |
20 ms |
5196 KB |
Output is correct |
85 |
Correct |
19 ms |
5212 KB |
Output is correct |
86 |
Correct |
21 ms |
5336 KB |
Output is correct |
87 |
Correct |
21 ms |
5252 KB |
Output is correct |
88 |
Correct |
20 ms |
5332 KB |
Output is correct |
89 |
Correct |
22 ms |
5312 KB |
Output is correct |
90 |
Correct |
21 ms |
5208 KB |
Output is correct |
91 |
Correct |
32 ms |
6748 KB |
Output is correct |
92 |
Correct |
32 ms |
6732 KB |
Output is correct |
93 |
Correct |
31 ms |
6656 KB |
Output is correct |
94 |
Correct |
34 ms |
6672 KB |
Output is correct |
95 |
Correct |
31 ms |
6672 KB |
Output is correct |
96 |
Correct |
36 ms |
6852 KB |
Output is correct |
97 |
Correct |
34 ms |
6884 KB |
Output is correct |
98 |
Correct |
36 ms |
6912 KB |
Output is correct |
99 |
Correct |
36 ms |
6848 KB |
Output is correct |
100 |
Correct |
37 ms |
6868 KB |
Output is correct |
101 |
Correct |
34 ms |
6836 KB |
Output is correct |
102 |
Correct |
40 ms |
6796 KB |
Output is correct |
103 |
Correct |
36 ms |
6976 KB |
Output is correct |
104 |
Correct |
38 ms |
6916 KB |
Output is correct |
105 |
Correct |
35 ms |
6868 KB |
Output is correct |
106 |
Correct |
44 ms |
6860 KB |
Output is correct |
107 |
Correct |
45 ms |
6872 KB |
Output is correct |
108 |
Correct |
39 ms |
6932 KB |
Output is correct |
109 |
Correct |
36 ms |
6864 KB |
Output is correct |
110 |
Correct |
39 ms |
6952 KB |
Output is correct |
111 |
Correct |
37 ms |
7008 KB |
Output is correct |
112 |
Correct |
38 ms |
6916 KB |
Output is correct |
113 |
Correct |
34 ms |
6884 KB |
Output is correct |
114 |
Correct |
34 ms |
6860 KB |
Output is correct |
115 |
Correct |
35 ms |
6952 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
2636 KB |
Output is correct |
2 |
Correct |
3 ms |
2640 KB |
Output is correct |
3 |
Correct |
3 ms |
2644 KB |
Output is correct |
4 |
Correct |
2 ms |
2644 KB |
Output is correct |
5 |
Correct |
3 ms |
2644 KB |
Output is correct |
6 |
Correct |
2 ms |
2644 KB |
Output is correct |
7 |
Correct |
2 ms |
2644 KB |
Output is correct |
8 |
Correct |
3 ms |
2644 KB |
Output is correct |
9 |
Correct |
2 ms |
2644 KB |
Output is correct |
10 |
Correct |
3 ms |
2644 KB |
Output is correct |
11 |
Correct |
3 ms |
2644 KB |
Output is correct |
12 |
Correct |
3 ms |
2644 KB |
Output is correct |
13 |
Correct |
4 ms |
2772 KB |
Output is correct |
14 |
Correct |
8 ms |
3804 KB |
Output is correct |
15 |
Correct |
15 ms |
5128 KB |
Output is correct |
16 |
Correct |
23 ms |
6048 KB |
Output is correct |
17 |
Correct |
21 ms |
6880 KB |
Output is correct |
18 |
Correct |
21 ms |
5988 KB |
Output is correct |
19 |
Correct |
21 ms |
6224 KB |
Output is correct |
20 |
Correct |
21 ms |
6432 KB |
Output is correct |
21 |
Correct |
21 ms |
6232 KB |
Output is correct |
22 |
Correct |
24 ms |
6056 KB |
Output is correct |
23 |
Correct |
21 ms |
5964 KB |
Output is correct |
24 |
Correct |
21 ms |
6188 KB |
Output is correct |
25 |
Correct |
21 ms |
6100 KB |
Output is correct |
26 |
Correct |
3 ms |
2644 KB |
Output is correct |
27 |
Correct |
3 ms |
2644 KB |
Output is correct |
28 |
Correct |
4 ms |
2772 KB |
Output is correct |
29 |
Correct |
10 ms |
3796 KB |
Output is correct |
30 |
Correct |
18 ms |
4992 KB |
Output is correct |
31 |
Correct |
24 ms |
6296 KB |
Output is correct |
32 |
Correct |
25 ms |
6100 KB |
Output is correct |
33 |
Correct |
22 ms |
6240 KB |
Output is correct |
34 |
Correct |
23 ms |
6000 KB |
Output is correct |
35 |
Correct |
24 ms |
6144 KB |
Output is correct |
36 |
Correct |
23 ms |
6080 KB |
Output is correct |
37 |
Correct |
22 ms |
6092 KB |
Output is correct |
38 |
Correct |
22 ms |
6348 KB |
Output is correct |
39 |
Correct |
21 ms |
6088 KB |
Output is correct |
40 |
Correct |
22 ms |
6076 KB |
Output is correct |
41 |
Correct |
3 ms |
2644 KB |
Output is correct |
42 |
Correct |
3 ms |
2644 KB |
Output is correct |
43 |
Correct |
3 ms |
2644 KB |
Output is correct |
44 |
Correct |
3 ms |
2772 KB |
Output is correct |
45 |
Correct |
3 ms |
2772 KB |
Output is correct |
46 |
Correct |
5 ms |
2772 KB |
Output is correct |
47 |
Correct |
7 ms |
3284 KB |
Output is correct |
48 |
Correct |
7 ms |
3284 KB |
Output is correct |
49 |
Correct |
10 ms |
3796 KB |
Output is correct |
50 |
Correct |
17 ms |
5040 KB |
Output is correct |
51 |
Correct |
23 ms |
6180 KB |
Output is correct |
52 |
Correct |
23 ms |
6228 KB |
Output is correct |
53 |
Correct |
24 ms |
6192 KB |
Output is correct |
54 |
Correct |
24 ms |
6216 KB |
Output is correct |
55 |
Correct |
24 ms |
6220 KB |
Output is correct |
56 |
Correct |
24 ms |
6176 KB |
Output is correct |
57 |
Correct |
26 ms |
6156 KB |
Output is correct |
58 |
Correct |
24 ms |
6168 KB |
Output is correct |
59 |
Correct |
24 ms |
6228 KB |
Output is correct |
60 |
Correct |
24 ms |
6132 KB |
Output is correct |
61 |
Correct |
23 ms |
6220 KB |
Output is correct |
62 |
Correct |
24 ms |
6116 KB |
Output is correct |
63 |
Correct |
25 ms |
6220 KB |
Output is correct |
64 |
Correct |
24 ms |
6200 KB |
Output is correct |
65 |
Correct |
23 ms |
6192 KB |
Output is correct |
66 |
Correct |
24 ms |
6220 KB |
Output is correct |
67 |
Correct |
23 ms |
6116 KB |
Output is correct |
68 |
Correct |
23 ms |
6176 KB |
Output is correct |
69 |
Correct |
25 ms |
6160 KB |
Output is correct |
70 |
Correct |
24 ms |
6196 KB |
Output is correct |
71 |
Correct |
7 ms |
3304 KB |
Output is correct |
72 |
Correct |
7 ms |
3284 KB |
Output is correct |
73 |
Correct |
7 ms |
3200 KB |
Output is correct |
74 |
Correct |
6 ms |
3292 KB |
Output is correct |
75 |
Correct |
7 ms |
3320 KB |
Output is correct |
76 |
Correct |
14 ms |
3844 KB |
Output is correct |
77 |
Correct |
12 ms |
3932 KB |
Output is correct |
78 |
Correct |
15 ms |
3940 KB |
Output is correct |
79 |
Correct |
11 ms |
3944 KB |
Output is correct |
80 |
Correct |
12 ms |
3860 KB |
Output is correct |
81 |
Correct |
20 ms |
5196 KB |
Output is correct |
82 |
Correct |
18 ms |
5104 KB |
Output is correct |
83 |
Correct |
19 ms |
5220 KB |
Output is correct |
84 |
Correct |
20 ms |
5196 KB |
Output is correct |
85 |
Correct |
19 ms |
5212 KB |
Output is correct |
86 |
Correct |
21 ms |
5336 KB |
Output is correct |
87 |
Correct |
21 ms |
5252 KB |
Output is correct |
88 |
Correct |
20 ms |
5332 KB |
Output is correct |
89 |
Correct |
22 ms |
5312 KB |
Output is correct |
90 |
Correct |
21 ms |
5208 KB |
Output is correct |
91 |
Correct |
32 ms |
6748 KB |
Output is correct |
92 |
Correct |
32 ms |
6732 KB |
Output is correct |
93 |
Correct |
31 ms |
6656 KB |
Output is correct |
94 |
Correct |
34 ms |
6672 KB |
Output is correct |
95 |
Correct |
31 ms |
6672 KB |
Output is correct |
96 |
Correct |
36 ms |
6852 KB |
Output is correct |
97 |
Correct |
34 ms |
6884 KB |
Output is correct |
98 |
Correct |
36 ms |
6912 KB |
Output is correct |
99 |
Correct |
36 ms |
6848 KB |
Output is correct |
100 |
Correct |
37 ms |
6868 KB |
Output is correct |
101 |
Correct |
34 ms |
6836 KB |
Output is correct |
102 |
Correct |
40 ms |
6796 KB |
Output is correct |
103 |
Correct |
36 ms |
6976 KB |
Output is correct |
104 |
Correct |
38 ms |
6916 KB |
Output is correct |
105 |
Correct |
35 ms |
6868 KB |
Output is correct |
106 |
Correct |
44 ms |
6860 KB |
Output is correct |
107 |
Correct |
45 ms |
6872 KB |
Output is correct |
108 |
Correct |
39 ms |
6932 KB |
Output is correct |
109 |
Correct |
36 ms |
6864 KB |
Output is correct |
110 |
Correct |
39 ms |
6952 KB |
Output is correct |
111 |
Correct |
37 ms |
7008 KB |
Output is correct |
112 |
Correct |
38 ms |
6916 KB |
Output is correct |
113 |
Correct |
34 ms |
6884 KB |
Output is correct |
114 |
Correct |
34 ms |
6860 KB |
Output is correct |
115 |
Correct |
35 ms |
6952 KB |
Output is correct |
116 |
Correct |
150 ms |
5356 KB |
Output is correct |
117 |
Correct |
174 ms |
5356 KB |
Output is correct |
118 |
Correct |
248 ms |
6020 KB |
Output is correct |
119 |
Correct |
272 ms |
6076 KB |
Output is correct |
120 |
Correct |
234 ms |
6176 KB |
Output is correct |
121 |
Correct |
362 ms |
6652 KB |
Output is correct |
122 |
Correct |
316 ms |
6820 KB |
Output is correct |
123 |
Correct |
695 ms |
7976 KB |
Output is correct |
124 |
Correct |
560 ms |
8164 KB |
Output is correct |
125 |
Correct |
548 ms |
8304 KB |
Output is correct |
126 |
Correct |
1216 ms |
9040 KB |
Output is correct |
127 |
Correct |
1231 ms |
9172 KB |
Output is correct |
128 |
Correct |
1230 ms |
9048 KB |
Output is correct |
129 |
Correct |
1223 ms |
9032 KB |
Output is correct |
130 |
Correct |
1230 ms |
9152 KB |
Output is correct |
131 |
Correct |
1272 ms |
9172 KB |
Output is correct |
132 |
Correct |
1234 ms |
9272 KB |
Output is correct |
133 |
Correct |
1247 ms |
9168 KB |
Output is correct |
134 |
Correct |
1244 ms |
9296 KB |
Output is correct |
135 |
Correct |
1242 ms |
9236 KB |
Output is correct |
136 |
Correct |
1219 ms |
9196 KB |
Output is correct |
137 |
Correct |
1234 ms |
9196 KB |
Output is correct |
138 |
Correct |
1225 ms |
9216 KB |
Output is correct |
139 |
Correct |
1259 ms |
9168 KB |
Output is correct |
140 |
Correct |
1227 ms |
9276 KB |
Output is correct |
141 |
Correct |
1111 ms |
9312 KB |
Output is correct |
142 |
Correct |
1132 ms |
9208 KB |
Output is correct |
143 |
Correct |
1107 ms |
9440 KB |
Output is correct |
144 |
Correct |
1109 ms |
9320 KB |
Output is correct |
145 |
Correct |
1101 ms |
9148 KB |
Output is correct |
146 |
Correct |
928 ms |
9440 KB |
Output is correct |
147 |
Correct |
933 ms |
9660 KB |
Output is correct |
148 |
Correct |
931 ms |
9432 KB |
Output is correct |
149 |
Correct |
930 ms |
9444 KB |
Output is correct |
150 |
Correct |
935 ms |
9444 KB |
Output is correct |
151 |
Correct |
965 ms |
9604 KB |
Output is correct |
152 |
Correct |
947 ms |
9468 KB |
Output is correct |
153 |
Correct |
968 ms |
9588 KB |
Output is correct |
154 |
Correct |
951 ms |
9532 KB |
Output is correct |
155 |
Correct |
948 ms |
9584 KB |
Output is correct |
156 |
Correct |
1159 ms |
9968 KB |
Output is correct |
157 |
Correct |
1165 ms |
10052 KB |
Output is correct |
158 |
Correct |
1159 ms |
9924 KB |
Output is correct |
159 |
Correct |
1151 ms |
9920 KB |
Output is correct |
160 |
Correct |
1160 ms |
9888 KB |
Output is correct |
161 |
Correct |
894 ms |
10232 KB |
Output is correct |
162 |
Correct |
880 ms |
10132 KB |
Output is correct |
163 |
Correct |
886 ms |
10132 KB |
Output is correct |
164 |
Correct |
882 ms |
10172 KB |
Output is correct |
165 |
Correct |
881 ms |
10024 KB |
Output is correct |
166 |
Correct |
1008 ms |
9884 KB |
Output is correct |
167 |
Correct |
1016 ms |
9792 KB |
Output is correct |
168 |
Correct |
1008 ms |
9796 KB |
Output is correct |
169 |
Correct |
1006 ms |
9788 KB |
Output is correct |
170 |
Correct |
1022 ms |
9748 KB |
Output is correct |
171 |
Correct |
1054 ms |
9688 KB |
Output is correct |
172 |
Correct |
1026 ms |
9688 KB |
Output is correct |
173 |
Correct |
1030 ms |
9692 KB |
Output is correct |
174 |
Correct |
1012 ms |
9776 KB |
Output is correct |
175 |
Correct |
1051 ms |
9748 KB |
Output is correct |