#include<bits/stdc++.h>
using namespace std;
const long long inf = (long long) 1e18 + 10;
const int inf1 = (int) 1e9 + 10;
#define int long long
#define dbl long double
#define endl '\n'
#define sc second
#define fr first
#define mp make_pair
#define pb push_back
#define all(x) x.begin(), x.end()
const int maxn = 3e5+10;
int n, q, a[maxn], ansq[maxn], pre[maxn], fq[maxn];
int cost(vector<int> v) {
int ans = 0;
int sum_all = 0;
for(auto x : v) sum_all+= x;
int sr = sum_all;
int sl = 0;
for(int i = 0; i < v.size(); i++) {
sr-= v[i];
ans+= sl*sr + v[i]*(sum_all-v[i]) + v[i]*(v[i]+1)/2;
sl+= v[i];
}
return ans;
}
vector<pair<int,int>> vtof(vector<int> v) {
vector<pair<int,int>> ans;
if(v.size() == 0) return ans;
ans.pb(mp(v[0],1));
for(int i = 1; i < v.size(); i++) {
if(v[i] == v[i-1]) {
ans.back().sc++;
}
else {
ans.pb(mp(v[i],1));
}
}
return ans;
}
// val, freq
int costf(deque<pair<int,int>> v) {
int ans = 0;
int sum_all = 0;
for(auto x : v) sum_all+= x.fr*x.sc;
int sr = sum_all;
int sl = 0;
for(int i = 0; i < v.size(); i++) {
int val = v[i].fr;
int frq = v[i].sc;
sr-= val*frq;
ans+= sl*sr*frq + (frq*(frq+1)/2)*val*(sl+sr) + frq*(val*(val+1)/2);
if(frq >= 2) {
ans+= val*val*(frq-1)*(frq);
ans+= val*val*frq*(frq-2)*(frq-1)/2;
ans-= pre[frq-2]*val*val;
// for(int j = 1; j <= frq-2; j++) {
// ans-= val*val*j*(j+1);
// }
}
sl+= val*frq;
}
return ans;
}
const int B = 1300;
vector<pair<pair<int,int>,int>> bls[maxn];
void solve() {
// vector<pair<int,int>> wtf = {{2,3}};
// // vector<pair<int,int>> wtf = {{2,1},{2,1},{2,1}};
// cout << costf(wtf) << endl;
// exit(0);
cin >> n >> q;
vector<int> cc;
for(int i = 1; i <= n; i++) {
pre[i] = pre[i-1]+i*(i+1);
cin >> a[i];
cc.pb(a[i]);
}
sort(all(cc));
cc.erase(unique(all(cc)),cc.end());
for(int i = 1; i <= n; i++) a[i] = upper_bound(all(cc),a[i])-cc.begin();
for(int i = 1; i <= q; i++) {
int l,r; cin >> l >> r;
bls[l/B].pb(mp(mp(r,l),i));
}
for(int b = 0; b*B <= n; b++) {
sort(all(bls[b]));
int l = b*B;
int r = b*B-1;
map<int,int> fq1;
for(auto X : bls[b]) {
int l1 = X.fr.sc;
int r1 = X.fr.fr;
while(r < r1) {
fq1[fq[a[r+1]]]--;
if(fq1[fq[a[r+1]]] == 0) fq1.erase(fq[a[r+1]]);
fq[a[r+1]]++;
fq1[fq[a[r+1]]]++;
r++;
}
while(l < l1) {
fq1[fq[a[l]]]--;
if(fq1[fq[a[l]]] == 0) fq1.erase(fq[a[l]]);
fq[a[l]]--;
fq1[fq[a[l]]]++;
l++;
}
while(l > l1) {
fq1[fq[a[l-1]]]--;
if(fq1[fq[a[l-1]]] == 0) fq1.erase(fq[a[l-1]]);
fq[a[l-1]]++;
fq1[fq[a[l-1]]]++;
l--;
}
vector<pair<int,int>> v1;
deque<pair<int,int>> v;
for(auto x : fq1) {
if(x.fr != 0) v1.pb(x);
}
int cnt = 0;
for(int i = (int) v1.size()-1; i >= 0; i--) {
int x1 = v1[i].sc/2;
int x2 = v1[i].sc-x1;
if(x1 != x2) {
if(cnt == 0 && x1 > x2) swap(x1,x2);
else if(cnt == 1 && x1 < x2) swap(x1,x2);
cnt^=1;
}
v.pb(mp(v1[i].fr,x1));
v.push_front(mp(v1[i].fr,x2));
}
ansq[X.sc] = costf(v);
}
while(l <= r) {
fq[a[l]]--;
l++;
}
}
for(int i = 1; i <= q; i++) {
cout << ansq[i] << endl;
}
}
int32_t main() {
ios::sync_with_stdio(false); cin.tie(0);
// freopen("in.in", "r", stdin);
// freopen("out.out", "w", stdout);
int tt = 1;
// cin >> tt;
while(tt--) {
solve();
}
}
Compilation message
diversity.cpp: In function 'long long int cost(std::vector<long long int>)':
diversity.cpp:23:22: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
23 | for(int i = 0; i < v.size(); i++) {
| ~~^~~~~~~~~~
diversity.cpp: In function 'std::vector<std::pair<long long int, long long int> > vtof(std::vector<long long int>)':
diversity.cpp:35:22: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
35 | for(int i = 1; i < v.size(); i++) {
| ~~^~~~~~~~~~
diversity.cpp: In function 'long long int costf(std::deque<std::pair<long long int, long long int> >)':
diversity.cpp:53:22: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::deque<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
53 | for(int i = 0; i < v.size(); i++) {
| ~~^~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
7312 KB |
Output is correct |
2 |
Correct |
4 ms |
7380 KB |
Output is correct |
3 |
Correct |
4 ms |
7380 KB |
Output is correct |
4 |
Correct |
3 ms |
7380 KB |
Output is correct |
5 |
Correct |
3 ms |
7380 KB |
Output is correct |
6 |
Correct |
3 ms |
7380 KB |
Output is correct |
7 |
Correct |
3 ms |
7380 KB |
Output is correct |
8 |
Correct |
3 ms |
7380 KB |
Output is correct |
9 |
Correct |
3 ms |
7380 KB |
Output is correct |
10 |
Correct |
3 ms |
7380 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
7380 KB |
Output is correct |
2 |
Correct |
4 ms |
7380 KB |
Output is correct |
3 |
Correct |
5 ms |
7760 KB |
Output is correct |
4 |
Correct |
21 ms |
9780 KB |
Output is correct |
5 |
Correct |
37 ms |
12316 KB |
Output is correct |
6 |
Correct |
58 ms |
15728 KB |
Output is correct |
7 |
Correct |
52 ms |
15624 KB |
Output is correct |
8 |
Correct |
58 ms |
15692 KB |
Output is correct |
9 |
Correct |
58 ms |
15760 KB |
Output is correct |
10 |
Correct |
56 ms |
15692 KB |
Output is correct |
11 |
Correct |
57 ms |
15692 KB |
Output is correct |
12 |
Correct |
60 ms |
15692 KB |
Output is correct |
13 |
Correct |
63 ms |
15652 KB |
Output is correct |
14 |
Correct |
59 ms |
15704 KB |
Output is correct |
15 |
Correct |
56 ms |
15684 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
7380 KB |
Output is correct |
2 |
Correct |
4 ms |
7380 KB |
Output is correct |
3 |
Correct |
5 ms |
7760 KB |
Output is correct |
4 |
Correct |
21 ms |
9780 KB |
Output is correct |
5 |
Correct |
37 ms |
12316 KB |
Output is correct |
6 |
Correct |
58 ms |
15728 KB |
Output is correct |
7 |
Correct |
52 ms |
15624 KB |
Output is correct |
8 |
Correct |
58 ms |
15692 KB |
Output is correct |
9 |
Correct |
58 ms |
15760 KB |
Output is correct |
10 |
Correct |
56 ms |
15692 KB |
Output is correct |
11 |
Correct |
57 ms |
15692 KB |
Output is correct |
12 |
Correct |
60 ms |
15692 KB |
Output is correct |
13 |
Correct |
63 ms |
15652 KB |
Output is correct |
14 |
Correct |
59 ms |
15704 KB |
Output is correct |
15 |
Correct |
56 ms |
15684 KB |
Output is correct |
16 |
Correct |
3 ms |
7380 KB |
Output is correct |
17 |
Correct |
3 ms |
7380 KB |
Output is correct |
18 |
Correct |
5 ms |
7764 KB |
Output is correct |
19 |
Correct |
28 ms |
9884 KB |
Output is correct |
20 |
Correct |
47 ms |
12208 KB |
Output is correct |
21 |
Correct |
66 ms |
15640 KB |
Output is correct |
22 |
Correct |
72 ms |
15876 KB |
Output is correct |
23 |
Correct |
68 ms |
15700 KB |
Output is correct |
24 |
Correct |
66 ms |
15740 KB |
Output is correct |
25 |
Correct |
67 ms |
15648 KB |
Output is correct |
26 |
Correct |
68 ms |
15696 KB |
Output is correct |
27 |
Correct |
66 ms |
15628 KB |
Output is correct |
28 |
Correct |
71 ms |
15692 KB |
Output is correct |
29 |
Correct |
67 ms |
15656 KB |
Output is correct |
30 |
Correct |
67 ms |
15692 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
7380 KB |
Output is correct |
2 |
Correct |
4 ms |
7380 KB |
Output is correct |
3 |
Correct |
5 ms |
7760 KB |
Output is correct |
4 |
Correct |
21 ms |
9780 KB |
Output is correct |
5 |
Correct |
37 ms |
12316 KB |
Output is correct |
6 |
Correct |
58 ms |
15728 KB |
Output is correct |
7 |
Correct |
52 ms |
15624 KB |
Output is correct |
8 |
Correct |
58 ms |
15692 KB |
Output is correct |
9 |
Correct |
58 ms |
15760 KB |
Output is correct |
10 |
Correct |
56 ms |
15692 KB |
Output is correct |
11 |
Correct |
57 ms |
15692 KB |
Output is correct |
12 |
Correct |
60 ms |
15692 KB |
Output is correct |
13 |
Correct |
63 ms |
15652 KB |
Output is correct |
14 |
Correct |
59 ms |
15704 KB |
Output is correct |
15 |
Correct |
56 ms |
15684 KB |
Output is correct |
16 |
Correct |
3 ms |
7380 KB |
Output is correct |
17 |
Correct |
3 ms |
7380 KB |
Output is correct |
18 |
Correct |
5 ms |
7764 KB |
Output is correct |
19 |
Correct |
28 ms |
9884 KB |
Output is correct |
20 |
Correct |
47 ms |
12208 KB |
Output is correct |
21 |
Correct |
66 ms |
15640 KB |
Output is correct |
22 |
Correct |
72 ms |
15876 KB |
Output is correct |
23 |
Correct |
68 ms |
15700 KB |
Output is correct |
24 |
Correct |
66 ms |
15740 KB |
Output is correct |
25 |
Correct |
67 ms |
15648 KB |
Output is correct |
26 |
Correct |
68 ms |
15696 KB |
Output is correct |
27 |
Correct |
66 ms |
15628 KB |
Output is correct |
28 |
Correct |
71 ms |
15692 KB |
Output is correct |
29 |
Correct |
67 ms |
15656 KB |
Output is correct |
30 |
Correct |
67 ms |
15692 KB |
Output is correct |
31 |
Correct |
3 ms |
7380 KB |
Output is correct |
32 |
Correct |
3 ms |
7380 KB |
Output is correct |
33 |
Correct |
4 ms |
7380 KB |
Output is correct |
34 |
Correct |
6 ms |
7696 KB |
Output is correct |
35 |
Correct |
6 ms |
7764 KB |
Output is correct |
36 |
Correct |
5 ms |
7764 KB |
Output is correct |
37 |
Correct |
17 ms |
8672 KB |
Output is correct |
38 |
Correct |
17 ms |
8672 KB |
Output is correct |
39 |
Correct |
31 ms |
9868 KB |
Output is correct |
40 |
Correct |
70 ms |
12156 KB |
Output is correct |
41 |
Correct |
98 ms |
15692 KB |
Output is correct |
42 |
Correct |
98 ms |
15636 KB |
Output is correct |
43 |
Correct |
101 ms |
15628 KB |
Output is correct |
44 |
Correct |
98 ms |
15688 KB |
Output is correct |
45 |
Correct |
99 ms |
15720 KB |
Output is correct |
46 |
Correct |
97 ms |
15692 KB |
Output is correct |
47 |
Correct |
97 ms |
15700 KB |
Output is correct |
48 |
Correct |
98 ms |
15744 KB |
Output is correct |
49 |
Correct |
97 ms |
15636 KB |
Output is correct |
50 |
Correct |
96 ms |
15692 KB |
Output is correct |
51 |
Correct |
97 ms |
15648 KB |
Output is correct |
52 |
Correct |
96 ms |
15672 KB |
Output is correct |
53 |
Correct |
98 ms |
15692 KB |
Output is correct |
54 |
Correct |
100 ms |
15716 KB |
Output is correct |
55 |
Correct |
98 ms |
15684 KB |
Output is correct |
56 |
Correct |
102 ms |
15688 KB |
Output is correct |
57 |
Correct |
103 ms |
15636 KB |
Output is correct |
58 |
Correct |
98 ms |
15736 KB |
Output is correct |
59 |
Correct |
97 ms |
15712 KB |
Output is correct |
60 |
Correct |
98 ms |
15692 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
7312 KB |
Output is correct |
2 |
Correct |
4 ms |
7380 KB |
Output is correct |
3 |
Correct |
4 ms |
7380 KB |
Output is correct |
4 |
Correct |
3 ms |
7380 KB |
Output is correct |
5 |
Correct |
3 ms |
7380 KB |
Output is correct |
6 |
Correct |
3 ms |
7380 KB |
Output is correct |
7 |
Correct |
3 ms |
7380 KB |
Output is correct |
8 |
Correct |
3 ms |
7380 KB |
Output is correct |
9 |
Correct |
3 ms |
7380 KB |
Output is correct |
10 |
Correct |
3 ms |
7380 KB |
Output is correct |
11 |
Correct |
3 ms |
7380 KB |
Output is correct |
12 |
Correct |
4 ms |
7380 KB |
Output is correct |
13 |
Correct |
5 ms |
7760 KB |
Output is correct |
14 |
Correct |
21 ms |
9780 KB |
Output is correct |
15 |
Correct |
37 ms |
12316 KB |
Output is correct |
16 |
Correct |
58 ms |
15728 KB |
Output is correct |
17 |
Correct |
52 ms |
15624 KB |
Output is correct |
18 |
Correct |
58 ms |
15692 KB |
Output is correct |
19 |
Correct |
58 ms |
15760 KB |
Output is correct |
20 |
Correct |
56 ms |
15692 KB |
Output is correct |
21 |
Correct |
57 ms |
15692 KB |
Output is correct |
22 |
Correct |
60 ms |
15692 KB |
Output is correct |
23 |
Correct |
63 ms |
15652 KB |
Output is correct |
24 |
Correct |
59 ms |
15704 KB |
Output is correct |
25 |
Correct |
56 ms |
15684 KB |
Output is correct |
26 |
Correct |
3 ms |
7380 KB |
Output is correct |
27 |
Correct |
3 ms |
7380 KB |
Output is correct |
28 |
Correct |
5 ms |
7764 KB |
Output is correct |
29 |
Correct |
28 ms |
9884 KB |
Output is correct |
30 |
Correct |
47 ms |
12208 KB |
Output is correct |
31 |
Correct |
66 ms |
15640 KB |
Output is correct |
32 |
Correct |
72 ms |
15876 KB |
Output is correct |
33 |
Correct |
68 ms |
15700 KB |
Output is correct |
34 |
Correct |
66 ms |
15740 KB |
Output is correct |
35 |
Correct |
67 ms |
15648 KB |
Output is correct |
36 |
Correct |
68 ms |
15696 KB |
Output is correct |
37 |
Correct |
66 ms |
15628 KB |
Output is correct |
38 |
Correct |
71 ms |
15692 KB |
Output is correct |
39 |
Correct |
67 ms |
15656 KB |
Output is correct |
40 |
Correct |
67 ms |
15692 KB |
Output is correct |
41 |
Correct |
3 ms |
7380 KB |
Output is correct |
42 |
Correct |
3 ms |
7380 KB |
Output is correct |
43 |
Correct |
4 ms |
7380 KB |
Output is correct |
44 |
Correct |
6 ms |
7696 KB |
Output is correct |
45 |
Correct |
6 ms |
7764 KB |
Output is correct |
46 |
Correct |
5 ms |
7764 KB |
Output is correct |
47 |
Correct |
17 ms |
8672 KB |
Output is correct |
48 |
Correct |
17 ms |
8672 KB |
Output is correct |
49 |
Correct |
31 ms |
9868 KB |
Output is correct |
50 |
Correct |
70 ms |
12156 KB |
Output is correct |
51 |
Correct |
98 ms |
15692 KB |
Output is correct |
52 |
Correct |
98 ms |
15636 KB |
Output is correct |
53 |
Correct |
101 ms |
15628 KB |
Output is correct |
54 |
Correct |
98 ms |
15688 KB |
Output is correct |
55 |
Correct |
99 ms |
15720 KB |
Output is correct |
56 |
Correct |
97 ms |
15692 KB |
Output is correct |
57 |
Correct |
97 ms |
15700 KB |
Output is correct |
58 |
Correct |
98 ms |
15744 KB |
Output is correct |
59 |
Correct |
97 ms |
15636 KB |
Output is correct |
60 |
Correct |
96 ms |
15692 KB |
Output is correct |
61 |
Correct |
97 ms |
15648 KB |
Output is correct |
62 |
Correct |
96 ms |
15672 KB |
Output is correct |
63 |
Correct |
98 ms |
15692 KB |
Output is correct |
64 |
Correct |
100 ms |
15716 KB |
Output is correct |
65 |
Correct |
98 ms |
15684 KB |
Output is correct |
66 |
Correct |
102 ms |
15688 KB |
Output is correct |
67 |
Correct |
103 ms |
15636 KB |
Output is correct |
68 |
Correct |
98 ms |
15736 KB |
Output is correct |
69 |
Correct |
97 ms |
15712 KB |
Output is correct |
70 |
Correct |
98 ms |
15692 KB |
Output is correct |
71 |
Correct |
15 ms |
8616 KB |
Output is correct |
72 |
Correct |
15 ms |
8708 KB |
Output is correct |
73 |
Correct |
16 ms |
8704 KB |
Output is correct |
74 |
Correct |
14 ms |
8660 KB |
Output is correct |
75 |
Correct |
16 ms |
8708 KB |
Output is correct |
76 |
Correct |
28 ms |
9808 KB |
Output is correct |
77 |
Correct |
28 ms |
9880 KB |
Output is correct |
78 |
Correct |
27 ms |
9912 KB |
Output is correct |
79 |
Correct |
27 ms |
9884 KB |
Output is correct |
80 |
Correct |
28 ms |
9808 KB |
Output is correct |
81 |
Correct |
52 ms |
12284 KB |
Output is correct |
82 |
Correct |
52 ms |
12204 KB |
Output is correct |
83 |
Correct |
54 ms |
12292 KB |
Output is correct |
84 |
Correct |
54 ms |
12208 KB |
Output is correct |
85 |
Correct |
55 ms |
12224 KB |
Output is correct |
86 |
Correct |
54 ms |
12324 KB |
Output is correct |
87 |
Correct |
64 ms |
12336 KB |
Output is correct |
88 |
Correct |
54 ms |
12248 KB |
Output is correct |
89 |
Correct |
55 ms |
12480 KB |
Output is correct |
90 |
Correct |
56 ms |
12332 KB |
Output is correct |
91 |
Correct |
85 ms |
15632 KB |
Output is correct |
92 |
Correct |
85 ms |
15624 KB |
Output is correct |
93 |
Correct |
85 ms |
15684 KB |
Output is correct |
94 |
Correct |
89 ms |
15684 KB |
Output is correct |
95 |
Correct |
94 ms |
15740 KB |
Output is correct |
96 |
Correct |
89 ms |
16096 KB |
Output is correct |
97 |
Correct |
91 ms |
16100 KB |
Output is correct |
98 |
Correct |
96 ms |
16092 KB |
Output is correct |
99 |
Correct |
105 ms |
16084 KB |
Output is correct |
100 |
Correct |
105 ms |
16088 KB |
Output is correct |
101 |
Correct |
88 ms |
16092 KB |
Output is correct |
102 |
Correct |
97 ms |
16024 KB |
Output is correct |
103 |
Correct |
91 ms |
16092 KB |
Output is correct |
104 |
Correct |
90 ms |
16092 KB |
Output is correct |
105 |
Correct |
91 ms |
16044 KB |
Output is correct |
106 |
Correct |
90 ms |
16472 KB |
Output is correct |
107 |
Correct |
92 ms |
16480 KB |
Output is correct |
108 |
Correct |
89 ms |
16440 KB |
Output is correct |
109 |
Correct |
90 ms |
16484 KB |
Output is correct |
110 |
Correct |
95 ms |
16492 KB |
Output is correct |
111 |
Correct |
91 ms |
16476 KB |
Output is correct |
112 |
Correct |
91 ms |
16476 KB |
Output is correct |
113 |
Correct |
89 ms |
16472 KB |
Output is correct |
114 |
Correct |
92 ms |
16476 KB |
Output is correct |
115 |
Correct |
90 ms |
16476 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
7312 KB |
Output is correct |
2 |
Correct |
4 ms |
7380 KB |
Output is correct |
3 |
Correct |
4 ms |
7380 KB |
Output is correct |
4 |
Correct |
3 ms |
7380 KB |
Output is correct |
5 |
Correct |
3 ms |
7380 KB |
Output is correct |
6 |
Correct |
3 ms |
7380 KB |
Output is correct |
7 |
Correct |
3 ms |
7380 KB |
Output is correct |
8 |
Correct |
3 ms |
7380 KB |
Output is correct |
9 |
Correct |
3 ms |
7380 KB |
Output is correct |
10 |
Correct |
3 ms |
7380 KB |
Output is correct |
11 |
Correct |
3 ms |
7380 KB |
Output is correct |
12 |
Correct |
4 ms |
7380 KB |
Output is correct |
13 |
Correct |
5 ms |
7760 KB |
Output is correct |
14 |
Correct |
21 ms |
9780 KB |
Output is correct |
15 |
Correct |
37 ms |
12316 KB |
Output is correct |
16 |
Correct |
58 ms |
15728 KB |
Output is correct |
17 |
Correct |
52 ms |
15624 KB |
Output is correct |
18 |
Correct |
58 ms |
15692 KB |
Output is correct |
19 |
Correct |
58 ms |
15760 KB |
Output is correct |
20 |
Correct |
56 ms |
15692 KB |
Output is correct |
21 |
Correct |
57 ms |
15692 KB |
Output is correct |
22 |
Correct |
60 ms |
15692 KB |
Output is correct |
23 |
Correct |
63 ms |
15652 KB |
Output is correct |
24 |
Correct |
59 ms |
15704 KB |
Output is correct |
25 |
Correct |
56 ms |
15684 KB |
Output is correct |
26 |
Correct |
3 ms |
7380 KB |
Output is correct |
27 |
Correct |
3 ms |
7380 KB |
Output is correct |
28 |
Correct |
5 ms |
7764 KB |
Output is correct |
29 |
Correct |
28 ms |
9884 KB |
Output is correct |
30 |
Correct |
47 ms |
12208 KB |
Output is correct |
31 |
Correct |
66 ms |
15640 KB |
Output is correct |
32 |
Correct |
72 ms |
15876 KB |
Output is correct |
33 |
Correct |
68 ms |
15700 KB |
Output is correct |
34 |
Correct |
66 ms |
15740 KB |
Output is correct |
35 |
Correct |
67 ms |
15648 KB |
Output is correct |
36 |
Correct |
68 ms |
15696 KB |
Output is correct |
37 |
Correct |
66 ms |
15628 KB |
Output is correct |
38 |
Correct |
71 ms |
15692 KB |
Output is correct |
39 |
Correct |
67 ms |
15656 KB |
Output is correct |
40 |
Correct |
67 ms |
15692 KB |
Output is correct |
41 |
Correct |
3 ms |
7380 KB |
Output is correct |
42 |
Correct |
3 ms |
7380 KB |
Output is correct |
43 |
Correct |
4 ms |
7380 KB |
Output is correct |
44 |
Correct |
6 ms |
7696 KB |
Output is correct |
45 |
Correct |
6 ms |
7764 KB |
Output is correct |
46 |
Correct |
5 ms |
7764 KB |
Output is correct |
47 |
Correct |
17 ms |
8672 KB |
Output is correct |
48 |
Correct |
17 ms |
8672 KB |
Output is correct |
49 |
Correct |
31 ms |
9868 KB |
Output is correct |
50 |
Correct |
70 ms |
12156 KB |
Output is correct |
51 |
Correct |
98 ms |
15692 KB |
Output is correct |
52 |
Correct |
98 ms |
15636 KB |
Output is correct |
53 |
Correct |
101 ms |
15628 KB |
Output is correct |
54 |
Correct |
98 ms |
15688 KB |
Output is correct |
55 |
Correct |
99 ms |
15720 KB |
Output is correct |
56 |
Correct |
97 ms |
15692 KB |
Output is correct |
57 |
Correct |
97 ms |
15700 KB |
Output is correct |
58 |
Correct |
98 ms |
15744 KB |
Output is correct |
59 |
Correct |
97 ms |
15636 KB |
Output is correct |
60 |
Correct |
96 ms |
15692 KB |
Output is correct |
61 |
Correct |
97 ms |
15648 KB |
Output is correct |
62 |
Correct |
96 ms |
15672 KB |
Output is correct |
63 |
Correct |
98 ms |
15692 KB |
Output is correct |
64 |
Correct |
100 ms |
15716 KB |
Output is correct |
65 |
Correct |
98 ms |
15684 KB |
Output is correct |
66 |
Correct |
102 ms |
15688 KB |
Output is correct |
67 |
Correct |
103 ms |
15636 KB |
Output is correct |
68 |
Correct |
98 ms |
15736 KB |
Output is correct |
69 |
Correct |
97 ms |
15712 KB |
Output is correct |
70 |
Correct |
98 ms |
15692 KB |
Output is correct |
71 |
Correct |
15 ms |
8616 KB |
Output is correct |
72 |
Correct |
15 ms |
8708 KB |
Output is correct |
73 |
Correct |
16 ms |
8704 KB |
Output is correct |
74 |
Correct |
14 ms |
8660 KB |
Output is correct |
75 |
Correct |
16 ms |
8708 KB |
Output is correct |
76 |
Correct |
28 ms |
9808 KB |
Output is correct |
77 |
Correct |
28 ms |
9880 KB |
Output is correct |
78 |
Correct |
27 ms |
9912 KB |
Output is correct |
79 |
Correct |
27 ms |
9884 KB |
Output is correct |
80 |
Correct |
28 ms |
9808 KB |
Output is correct |
81 |
Correct |
52 ms |
12284 KB |
Output is correct |
82 |
Correct |
52 ms |
12204 KB |
Output is correct |
83 |
Correct |
54 ms |
12292 KB |
Output is correct |
84 |
Correct |
54 ms |
12208 KB |
Output is correct |
85 |
Correct |
55 ms |
12224 KB |
Output is correct |
86 |
Correct |
54 ms |
12324 KB |
Output is correct |
87 |
Correct |
64 ms |
12336 KB |
Output is correct |
88 |
Correct |
54 ms |
12248 KB |
Output is correct |
89 |
Correct |
55 ms |
12480 KB |
Output is correct |
90 |
Correct |
56 ms |
12332 KB |
Output is correct |
91 |
Correct |
85 ms |
15632 KB |
Output is correct |
92 |
Correct |
85 ms |
15624 KB |
Output is correct |
93 |
Correct |
85 ms |
15684 KB |
Output is correct |
94 |
Correct |
89 ms |
15684 KB |
Output is correct |
95 |
Correct |
94 ms |
15740 KB |
Output is correct |
96 |
Correct |
89 ms |
16096 KB |
Output is correct |
97 |
Correct |
91 ms |
16100 KB |
Output is correct |
98 |
Correct |
96 ms |
16092 KB |
Output is correct |
99 |
Correct |
105 ms |
16084 KB |
Output is correct |
100 |
Correct |
105 ms |
16088 KB |
Output is correct |
101 |
Correct |
88 ms |
16092 KB |
Output is correct |
102 |
Correct |
97 ms |
16024 KB |
Output is correct |
103 |
Correct |
91 ms |
16092 KB |
Output is correct |
104 |
Correct |
90 ms |
16092 KB |
Output is correct |
105 |
Correct |
91 ms |
16044 KB |
Output is correct |
106 |
Correct |
90 ms |
16472 KB |
Output is correct |
107 |
Correct |
92 ms |
16480 KB |
Output is correct |
108 |
Correct |
89 ms |
16440 KB |
Output is correct |
109 |
Correct |
90 ms |
16484 KB |
Output is correct |
110 |
Correct |
95 ms |
16492 KB |
Output is correct |
111 |
Correct |
91 ms |
16476 KB |
Output is correct |
112 |
Correct |
91 ms |
16476 KB |
Output is correct |
113 |
Correct |
89 ms |
16472 KB |
Output is correct |
114 |
Correct |
92 ms |
16476 KB |
Output is correct |
115 |
Correct |
90 ms |
16476 KB |
Output is correct |
116 |
Correct |
2376 ms |
9976 KB |
Output is correct |
117 |
Correct |
2168 ms |
10108 KB |
Output is correct |
118 |
Correct |
3307 ms |
11276 KB |
Output is correct |
119 |
Correct |
2234 ms |
11380 KB |
Output is correct |
120 |
Correct |
1465 ms |
11352 KB |
Output is correct |
121 |
Correct |
2611 ms |
12540 KB |
Output is correct |
122 |
Correct |
1724 ms |
12532 KB |
Output is correct |
123 |
Correct |
4961 ms |
15104 KB |
Output is correct |
124 |
Correct |
2267 ms |
16512 KB |
Output is correct |
125 |
Correct |
1609 ms |
16552 KB |
Output is correct |
126 |
Execution timed out |
7076 ms |
18376 KB |
Time limit exceeded |
127 |
Halted |
0 ms |
0 KB |
- |