#include <iostream>
#include <cassert>
#include <iomanip>
#include <algorithm>
#include <string>
#include <bitset>
#include <vector>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <set>
#ifndef LOCAL
#include <bits/stdc++.h>
#define cerr if(false)cerr
#endif
using namespace std;
using ll = long long;
const int N = 3e5 + 66;
ll a[N], n;
ll pref[N];
/*
summa(a[i]*(a[i]+1)/2 + a[i]*pref[i-1]*(i+1) - a[i]*(pref[n-1]-pref[i])*i)
summa((a[i]^2+a[i])/2 + a[i]*pref[i-1]*i+a[i]*pref[i-1] - a[i]*(pref[n-1]-pref[i])*i)
summa((a[i]^2+a[i])/2 + a[i]*pref[i]*i-a[i]^2*i + a[i]*pref[i-1] - a[i]*(pref[n-1]-pref[i])*i)
summa((a[i]^2+a[i])/2 + a[i]*pref[i]*i-a[i]^2*i + a[i]*pref[i]-a[i]^2 - a[i]*(pref[n-1]-pref[i])*i)
summa((a[i]^2+a[i])/2 + a[i]*pref[i]*i-a[i]^2*i + a[i]*pref[i]-a[i]^2 - a[i]*pref[n-1]*i - a[i]*pref[i]*i)
summa((a[i]^2+a[i])/2 + a[i]*pref[i]*i - a[i]^2*i + a[i]*pref[i]-a[i]^2 - a[i]*pref[n-1]*i - a[i]*pref[i]*i)
summa(a[i]/2 + a[i]*pref[i]*(i+1) - a[i]^2*i - a[i]^2/2 - a[i]*pref[n-1]*i - a[i]*pref[i]*i)
summa(a[i]/2 + a[i]*pref[i] - a[i]^2*i - a[i]^2/2 - a[i]*pref[n-1]*i)
summa(a[i]/2 + a[i]*pref[i] - a[i]^2*i - a[i]^2/2 - a[i]*pref[n-1]*i)
*/
ll f(ll s) { return s * (s + 1) / 2; }
//summa(f(pref[i - 1]) + f(pref[n - 1] - pref[i]))
ll solve() {
ll ans = 0;
for (int i = 0 ; i < n ; ++ i) {
pref[i] = a[i];
if (i) pref[i] += pref[i - 1];
}
for (int i = 0 ; i < n ; ++ i) {
if (i) ans += f(pref[i - 1]);
ans += f(pref[n - 1] - pref[i]);
}
ll C = n * f(pref[n-1]);
// C = len * f(sum)
return C-ans;
}
vector<int>vec;
int used[N];
int comp[N], freq[N];
void del(int v) {
v = a[v];
cerr << "del " << v << endl;
comp[freq[v]]--;
freq[v]--;
if (freq[v] > 0 && !comp[freq[v]] && !used[freq[v]]) {
used[freq[v]] = 1;
vec.emplace_back(freq[v]);
}
comp[freq[v]]++;
}
void add(int v) {
v = a[v];
cerr << "add " << v << endl;
comp[freq[v]]--;
freq[v]++;
if (freq[v] > 0 && !comp[freq[v]] && !used[freq[v]]) {
used[freq[v]] = 1;
vec.emplace_back(freq[v]);
}
comp[freq[v]]++;
}
deque<ll>d;
int L, R;
ll sq(ll x) { return x*x; }
ll get() {
for (int i = 0 ; i < (int)vec.size() ; ++ i) {
if (!comp[vec[i]]) {
used[vec[i]] = 0;
swap(vec[i], vec.back());
vec.pop_back();
--i;
}
}
sort(vec.rbegin(), vec.rend());
ll q = 0;
d.clear();
for (int i : vec) {
for (int _ = 0 ; _ < comp[i] ; ++ _) {
if ((int)d.size() & 1) d.push_back(i);
else d.push_front(i);
}
}
int m = d.size(); ll pref = 0;
cerr << "m ";
for (int i = 0 ; i < m ; ++ i) cerr << d[i] << " ";
cerr << endl;
for (int i = 0 ; i < m ; ++ i) {
q -= sq(pref) + sq(R-L+1 - pref - d[i]);
pref += d[i];
}
q = (ll)m * f(R-L+1) - ((ll)m * (R-L+1) - (R-L+1) - q) / 2;
cerr << "get " << q << endl;
return q;
}
ll ans[N];
int ql[N], qr[N];
vector<tuple<int,int,int>>MO;
const int K = 400;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int q;
cin >> n >> q;
for (int i = 0 ; i < n ; ++ i) cin >> a[i];
for (int i = 0 ; i < q ; ++ i) {
cin >> ql[i] >> qr[i];
ql[i]--, qr[i]--;
MO.emplace_back(ql[i]/K, qr[i], i);
}
sort(MO.begin(), MO.end());
L = 1, R = 0;
for (int $ = 0 ; $ < q ; ++ $) {
int i = get<2>(MO[$]);
int l = ql[i], r = qr[i];
while (L > l) add(--L);
while (R < r) add(++R);
while (L < l) del(L++);
while (R > r) del(R--);
ans[i] = get();
}
for (int i = 0 ; i < q ; ++ i) {
cout << ans[i] << "\n";
}
return 0;
map<int,int>mp;
for (int i = 0 ; i < n ; ++ i) mp[a[i]]++;
vector<int>freq;
for (auto [f, s] : mp) freq.emplace_back(s);
sort(freq.rbegin(), freq.rend());
deque<int>p;
for (int i : freq) {
if ((int)p.size() & 1) p.push_back(i);
else p.push_front(i);
}
n = p.size();
for (int i = 0 ; i < n ; ++ i) a[i] = p[i];
cout << solve();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
468 KB |
Output is correct |
3 |
Correct |
0 ms |
340 KB |
Output is correct |
4 |
Correct |
0 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 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 |
0 ms |
340 KB |
Output is correct |
10 |
Correct |
0 ms |
356 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
468 KB |
Output is correct |
4 |
Correct |
7 ms |
1748 KB |
Output is correct |
5 |
Correct |
13 ms |
3468 KB |
Output is correct |
6 |
Correct |
19 ms |
4200 KB |
Output is correct |
7 |
Correct |
20 ms |
5440 KB |
Output is correct |
8 |
Correct |
18 ms |
4044 KB |
Output is correct |
9 |
Correct |
19 ms |
4040 KB |
Output is correct |
10 |
Correct |
25 ms |
4564 KB |
Output is correct |
11 |
Correct |
19 ms |
4484 KB |
Output is correct |
12 |
Correct |
24 ms |
4044 KB |
Output is correct |
13 |
Correct |
22 ms |
4072 KB |
Output is correct |
14 |
Correct |
25 ms |
4456 KB |
Output is correct |
15 |
Correct |
23 ms |
4372 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
468 KB |
Output is correct |
4 |
Correct |
7 ms |
1748 KB |
Output is correct |
5 |
Correct |
13 ms |
3468 KB |
Output is correct |
6 |
Correct |
19 ms |
4200 KB |
Output is correct |
7 |
Correct |
20 ms |
5440 KB |
Output is correct |
8 |
Correct |
18 ms |
4044 KB |
Output is correct |
9 |
Correct |
19 ms |
4040 KB |
Output is correct |
10 |
Correct |
25 ms |
4564 KB |
Output is correct |
11 |
Correct |
19 ms |
4484 KB |
Output is correct |
12 |
Correct |
24 ms |
4044 KB |
Output is correct |
13 |
Correct |
22 ms |
4072 KB |
Output is correct |
14 |
Correct |
25 ms |
4456 KB |
Output is correct |
15 |
Correct |
23 ms |
4372 KB |
Output is correct |
16 |
Correct |
0 ms |
340 KB |
Output is correct |
17 |
Correct |
0 ms |
340 KB |
Output is correct |
18 |
Correct |
1 ms |
488 KB |
Output is correct |
19 |
Correct |
7 ms |
1692 KB |
Output is correct |
20 |
Correct |
14 ms |
2908 KB |
Output is correct |
21 |
Correct |
20 ms |
4268 KB |
Output is correct |
22 |
Correct |
20 ms |
4108 KB |
Output is correct |
23 |
Correct |
21 ms |
4192 KB |
Output is correct |
24 |
Correct |
20 ms |
4076 KB |
Output is correct |
25 |
Correct |
21 ms |
4224 KB |
Output is correct |
26 |
Correct |
20 ms |
4068 KB |
Output is correct |
27 |
Correct |
23 ms |
4048 KB |
Output is correct |
28 |
Correct |
21 ms |
4572 KB |
Output is correct |
29 |
Correct |
20 ms |
4084 KB |
Output is correct |
30 |
Correct |
20 ms |
4048 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
468 KB |
Output is correct |
4 |
Correct |
7 ms |
1748 KB |
Output is correct |
5 |
Correct |
13 ms |
3468 KB |
Output is correct |
6 |
Correct |
19 ms |
4200 KB |
Output is correct |
7 |
Correct |
20 ms |
5440 KB |
Output is correct |
8 |
Correct |
18 ms |
4044 KB |
Output is correct |
9 |
Correct |
19 ms |
4040 KB |
Output is correct |
10 |
Correct |
25 ms |
4564 KB |
Output is correct |
11 |
Correct |
19 ms |
4484 KB |
Output is correct |
12 |
Correct |
24 ms |
4044 KB |
Output is correct |
13 |
Correct |
22 ms |
4072 KB |
Output is correct |
14 |
Correct |
25 ms |
4456 KB |
Output is correct |
15 |
Correct |
23 ms |
4372 KB |
Output is correct |
16 |
Correct |
0 ms |
340 KB |
Output is correct |
17 |
Correct |
0 ms |
340 KB |
Output is correct |
18 |
Correct |
1 ms |
488 KB |
Output is correct |
19 |
Correct |
7 ms |
1692 KB |
Output is correct |
20 |
Correct |
14 ms |
2908 KB |
Output is correct |
21 |
Correct |
20 ms |
4268 KB |
Output is correct |
22 |
Correct |
20 ms |
4108 KB |
Output is correct |
23 |
Correct |
21 ms |
4192 KB |
Output is correct |
24 |
Correct |
20 ms |
4076 KB |
Output is correct |
25 |
Correct |
21 ms |
4224 KB |
Output is correct |
26 |
Correct |
20 ms |
4068 KB |
Output is correct |
27 |
Correct |
23 ms |
4048 KB |
Output is correct |
28 |
Correct |
21 ms |
4572 KB |
Output is correct |
29 |
Correct |
20 ms |
4084 KB |
Output is correct |
30 |
Correct |
20 ms |
4048 KB |
Output is correct |
31 |
Correct |
0 ms |
340 KB |
Output is correct |
32 |
Correct |
1 ms |
348 KB |
Output is correct |
33 |
Correct |
1 ms |
340 KB |
Output is correct |
34 |
Correct |
1 ms |
468 KB |
Output is correct |
35 |
Correct |
1 ms |
468 KB |
Output is correct |
36 |
Correct |
1 ms |
468 KB |
Output is correct |
37 |
Correct |
4 ms |
872 KB |
Output is correct |
38 |
Correct |
4 ms |
980 KB |
Output is correct |
39 |
Correct |
7 ms |
1552 KB |
Output is correct |
40 |
Correct |
16 ms |
2640 KB |
Output is correct |
41 |
Correct |
24 ms |
3796 KB |
Output is correct |
42 |
Correct |
23 ms |
3896 KB |
Output is correct |
43 |
Correct |
21 ms |
3808 KB |
Output is correct |
44 |
Correct |
21 ms |
3876 KB |
Output is correct |
45 |
Correct |
21 ms |
3788 KB |
Output is correct |
46 |
Correct |
22 ms |
3892 KB |
Output is correct |
47 |
Correct |
21 ms |
3772 KB |
Output is correct |
48 |
Correct |
22 ms |
3804 KB |
Output is correct |
49 |
Correct |
22 ms |
3796 KB |
Output is correct |
50 |
Correct |
22 ms |
3860 KB |
Output is correct |
51 |
Correct |
22 ms |
3828 KB |
Output is correct |
52 |
Correct |
22 ms |
3788 KB |
Output is correct |
53 |
Correct |
22 ms |
3808 KB |
Output is correct |
54 |
Correct |
22 ms |
3796 KB |
Output is correct |
55 |
Correct |
21 ms |
3888 KB |
Output is correct |
56 |
Correct |
21 ms |
3792 KB |
Output is correct |
57 |
Correct |
21 ms |
3904 KB |
Output is correct |
58 |
Correct |
22 ms |
3876 KB |
Output is correct |
59 |
Correct |
23 ms |
3840 KB |
Output is correct |
60 |
Correct |
22 ms |
3792 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
468 KB |
Output is correct |
3 |
Correct |
0 ms |
340 KB |
Output is correct |
4 |
Correct |
0 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 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 |
0 ms |
340 KB |
Output is correct |
10 |
Correct |
0 ms |
356 KB |
Output is correct |
11 |
Correct |
0 ms |
340 KB |
Output is correct |
12 |
Correct |
0 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
468 KB |
Output is correct |
14 |
Correct |
7 ms |
1748 KB |
Output is correct |
15 |
Correct |
13 ms |
3468 KB |
Output is correct |
16 |
Correct |
19 ms |
4200 KB |
Output is correct |
17 |
Correct |
20 ms |
5440 KB |
Output is correct |
18 |
Correct |
18 ms |
4044 KB |
Output is correct |
19 |
Correct |
19 ms |
4040 KB |
Output is correct |
20 |
Correct |
25 ms |
4564 KB |
Output is correct |
21 |
Correct |
19 ms |
4484 KB |
Output is correct |
22 |
Correct |
24 ms |
4044 KB |
Output is correct |
23 |
Correct |
22 ms |
4072 KB |
Output is correct |
24 |
Correct |
25 ms |
4456 KB |
Output is correct |
25 |
Correct |
23 ms |
4372 KB |
Output is correct |
26 |
Correct |
0 ms |
340 KB |
Output is correct |
27 |
Correct |
0 ms |
340 KB |
Output is correct |
28 |
Correct |
1 ms |
488 KB |
Output is correct |
29 |
Correct |
7 ms |
1692 KB |
Output is correct |
30 |
Correct |
14 ms |
2908 KB |
Output is correct |
31 |
Correct |
20 ms |
4268 KB |
Output is correct |
32 |
Correct |
20 ms |
4108 KB |
Output is correct |
33 |
Correct |
21 ms |
4192 KB |
Output is correct |
34 |
Correct |
20 ms |
4076 KB |
Output is correct |
35 |
Correct |
21 ms |
4224 KB |
Output is correct |
36 |
Correct |
20 ms |
4068 KB |
Output is correct |
37 |
Correct |
23 ms |
4048 KB |
Output is correct |
38 |
Correct |
21 ms |
4572 KB |
Output is correct |
39 |
Correct |
20 ms |
4084 KB |
Output is correct |
40 |
Correct |
20 ms |
4048 KB |
Output is correct |
41 |
Correct |
0 ms |
340 KB |
Output is correct |
42 |
Correct |
1 ms |
348 KB |
Output is correct |
43 |
Correct |
1 ms |
340 KB |
Output is correct |
44 |
Correct |
1 ms |
468 KB |
Output is correct |
45 |
Correct |
1 ms |
468 KB |
Output is correct |
46 |
Correct |
1 ms |
468 KB |
Output is correct |
47 |
Correct |
4 ms |
872 KB |
Output is correct |
48 |
Correct |
4 ms |
980 KB |
Output is correct |
49 |
Correct |
7 ms |
1552 KB |
Output is correct |
50 |
Correct |
16 ms |
2640 KB |
Output is correct |
51 |
Correct |
24 ms |
3796 KB |
Output is correct |
52 |
Correct |
23 ms |
3896 KB |
Output is correct |
53 |
Correct |
21 ms |
3808 KB |
Output is correct |
54 |
Correct |
21 ms |
3876 KB |
Output is correct |
55 |
Correct |
21 ms |
3788 KB |
Output is correct |
56 |
Correct |
22 ms |
3892 KB |
Output is correct |
57 |
Correct |
21 ms |
3772 KB |
Output is correct |
58 |
Correct |
22 ms |
3804 KB |
Output is correct |
59 |
Correct |
22 ms |
3796 KB |
Output is correct |
60 |
Correct |
22 ms |
3860 KB |
Output is correct |
61 |
Correct |
22 ms |
3828 KB |
Output is correct |
62 |
Correct |
22 ms |
3788 KB |
Output is correct |
63 |
Correct |
22 ms |
3808 KB |
Output is correct |
64 |
Correct |
22 ms |
3796 KB |
Output is correct |
65 |
Correct |
21 ms |
3888 KB |
Output is correct |
66 |
Correct |
21 ms |
3792 KB |
Output is correct |
67 |
Correct |
21 ms |
3904 KB |
Output is correct |
68 |
Correct |
22 ms |
3876 KB |
Output is correct |
69 |
Correct |
23 ms |
3840 KB |
Output is correct |
70 |
Correct |
22 ms |
3792 KB |
Output is correct |
71 |
Correct |
4 ms |
996 KB |
Output is correct |
72 |
Correct |
5 ms |
1008 KB |
Output is correct |
73 |
Correct |
5 ms |
1000 KB |
Output is correct |
74 |
Correct |
5 ms |
1004 KB |
Output is correct |
75 |
Correct |
4 ms |
996 KB |
Output is correct |
76 |
Correct |
8 ms |
1620 KB |
Output is correct |
77 |
Correct |
12 ms |
1640 KB |
Output is correct |
78 |
Correct |
8 ms |
1668 KB |
Output is correct |
79 |
Correct |
8 ms |
1620 KB |
Output is correct |
80 |
Correct |
8 ms |
1636 KB |
Output is correct |
81 |
Correct |
16 ms |
2980 KB |
Output is correct |
82 |
Correct |
16 ms |
2936 KB |
Output is correct |
83 |
Correct |
16 ms |
2900 KB |
Output is correct |
84 |
Correct |
16 ms |
3008 KB |
Output is correct |
85 |
Correct |
15 ms |
3036 KB |
Output is correct |
86 |
Correct |
18 ms |
3200 KB |
Output is correct |
87 |
Correct |
17 ms |
3156 KB |
Output is correct |
88 |
Correct |
21 ms |
3200 KB |
Output is correct |
89 |
Correct |
18 ms |
3252 KB |
Output is correct |
90 |
Correct |
18 ms |
3140 KB |
Output is correct |
91 |
Correct |
28 ms |
5568 KB |
Output is correct |
92 |
Correct |
28 ms |
5708 KB |
Output is correct |
93 |
Correct |
26 ms |
5644 KB |
Output is correct |
94 |
Correct |
26 ms |
5596 KB |
Output is correct |
95 |
Correct |
26 ms |
5564 KB |
Output is correct |
96 |
Correct |
35 ms |
6860 KB |
Output is correct |
97 |
Correct |
31 ms |
6920 KB |
Output is correct |
98 |
Correct |
31 ms |
6876 KB |
Output is correct |
99 |
Correct |
33 ms |
6988 KB |
Output is correct |
100 |
Correct |
31 ms |
6868 KB |
Output is correct |
101 |
Correct |
33 ms |
6920 KB |
Output is correct |
102 |
Correct |
34 ms |
6932 KB |
Output is correct |
103 |
Correct |
31 ms |
6860 KB |
Output is correct |
104 |
Correct |
32 ms |
6920 KB |
Output is correct |
105 |
Correct |
32 ms |
6796 KB |
Output is correct |
106 |
Correct |
33 ms |
7496 KB |
Output is correct |
107 |
Correct |
32 ms |
7504 KB |
Output is correct |
108 |
Correct |
34 ms |
7488 KB |
Output is correct |
109 |
Correct |
31 ms |
7528 KB |
Output is correct |
110 |
Correct |
36 ms |
7516 KB |
Output is correct |
111 |
Correct |
40 ms |
7628 KB |
Output is correct |
112 |
Correct |
31 ms |
7556 KB |
Output is correct |
113 |
Correct |
32 ms |
7556 KB |
Output is correct |
114 |
Correct |
32 ms |
7556 KB |
Output is correct |
115 |
Correct |
31 ms |
7628 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
468 KB |
Output is correct |
3 |
Correct |
0 ms |
340 KB |
Output is correct |
4 |
Correct |
0 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 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 |
0 ms |
340 KB |
Output is correct |
10 |
Correct |
0 ms |
356 KB |
Output is correct |
11 |
Correct |
0 ms |
340 KB |
Output is correct |
12 |
Correct |
0 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
468 KB |
Output is correct |
14 |
Correct |
7 ms |
1748 KB |
Output is correct |
15 |
Correct |
13 ms |
3468 KB |
Output is correct |
16 |
Correct |
19 ms |
4200 KB |
Output is correct |
17 |
Correct |
20 ms |
5440 KB |
Output is correct |
18 |
Correct |
18 ms |
4044 KB |
Output is correct |
19 |
Correct |
19 ms |
4040 KB |
Output is correct |
20 |
Correct |
25 ms |
4564 KB |
Output is correct |
21 |
Correct |
19 ms |
4484 KB |
Output is correct |
22 |
Correct |
24 ms |
4044 KB |
Output is correct |
23 |
Correct |
22 ms |
4072 KB |
Output is correct |
24 |
Correct |
25 ms |
4456 KB |
Output is correct |
25 |
Correct |
23 ms |
4372 KB |
Output is correct |
26 |
Correct |
0 ms |
340 KB |
Output is correct |
27 |
Correct |
0 ms |
340 KB |
Output is correct |
28 |
Correct |
1 ms |
488 KB |
Output is correct |
29 |
Correct |
7 ms |
1692 KB |
Output is correct |
30 |
Correct |
14 ms |
2908 KB |
Output is correct |
31 |
Correct |
20 ms |
4268 KB |
Output is correct |
32 |
Correct |
20 ms |
4108 KB |
Output is correct |
33 |
Correct |
21 ms |
4192 KB |
Output is correct |
34 |
Correct |
20 ms |
4076 KB |
Output is correct |
35 |
Correct |
21 ms |
4224 KB |
Output is correct |
36 |
Correct |
20 ms |
4068 KB |
Output is correct |
37 |
Correct |
23 ms |
4048 KB |
Output is correct |
38 |
Correct |
21 ms |
4572 KB |
Output is correct |
39 |
Correct |
20 ms |
4084 KB |
Output is correct |
40 |
Correct |
20 ms |
4048 KB |
Output is correct |
41 |
Correct |
0 ms |
340 KB |
Output is correct |
42 |
Correct |
1 ms |
348 KB |
Output is correct |
43 |
Correct |
1 ms |
340 KB |
Output is correct |
44 |
Correct |
1 ms |
468 KB |
Output is correct |
45 |
Correct |
1 ms |
468 KB |
Output is correct |
46 |
Correct |
1 ms |
468 KB |
Output is correct |
47 |
Correct |
4 ms |
872 KB |
Output is correct |
48 |
Correct |
4 ms |
980 KB |
Output is correct |
49 |
Correct |
7 ms |
1552 KB |
Output is correct |
50 |
Correct |
16 ms |
2640 KB |
Output is correct |
51 |
Correct |
24 ms |
3796 KB |
Output is correct |
52 |
Correct |
23 ms |
3896 KB |
Output is correct |
53 |
Correct |
21 ms |
3808 KB |
Output is correct |
54 |
Correct |
21 ms |
3876 KB |
Output is correct |
55 |
Correct |
21 ms |
3788 KB |
Output is correct |
56 |
Correct |
22 ms |
3892 KB |
Output is correct |
57 |
Correct |
21 ms |
3772 KB |
Output is correct |
58 |
Correct |
22 ms |
3804 KB |
Output is correct |
59 |
Correct |
22 ms |
3796 KB |
Output is correct |
60 |
Correct |
22 ms |
3860 KB |
Output is correct |
61 |
Correct |
22 ms |
3828 KB |
Output is correct |
62 |
Correct |
22 ms |
3788 KB |
Output is correct |
63 |
Correct |
22 ms |
3808 KB |
Output is correct |
64 |
Correct |
22 ms |
3796 KB |
Output is correct |
65 |
Correct |
21 ms |
3888 KB |
Output is correct |
66 |
Correct |
21 ms |
3792 KB |
Output is correct |
67 |
Correct |
21 ms |
3904 KB |
Output is correct |
68 |
Correct |
22 ms |
3876 KB |
Output is correct |
69 |
Correct |
23 ms |
3840 KB |
Output is correct |
70 |
Correct |
22 ms |
3792 KB |
Output is correct |
71 |
Correct |
4 ms |
996 KB |
Output is correct |
72 |
Correct |
5 ms |
1008 KB |
Output is correct |
73 |
Correct |
5 ms |
1000 KB |
Output is correct |
74 |
Correct |
5 ms |
1004 KB |
Output is correct |
75 |
Correct |
4 ms |
996 KB |
Output is correct |
76 |
Correct |
8 ms |
1620 KB |
Output is correct |
77 |
Correct |
12 ms |
1640 KB |
Output is correct |
78 |
Correct |
8 ms |
1668 KB |
Output is correct |
79 |
Correct |
8 ms |
1620 KB |
Output is correct |
80 |
Correct |
8 ms |
1636 KB |
Output is correct |
81 |
Correct |
16 ms |
2980 KB |
Output is correct |
82 |
Correct |
16 ms |
2936 KB |
Output is correct |
83 |
Correct |
16 ms |
2900 KB |
Output is correct |
84 |
Correct |
16 ms |
3008 KB |
Output is correct |
85 |
Correct |
15 ms |
3036 KB |
Output is correct |
86 |
Correct |
18 ms |
3200 KB |
Output is correct |
87 |
Correct |
17 ms |
3156 KB |
Output is correct |
88 |
Correct |
21 ms |
3200 KB |
Output is correct |
89 |
Correct |
18 ms |
3252 KB |
Output is correct |
90 |
Correct |
18 ms |
3140 KB |
Output is correct |
91 |
Correct |
28 ms |
5568 KB |
Output is correct |
92 |
Correct |
28 ms |
5708 KB |
Output is correct |
93 |
Correct |
26 ms |
5644 KB |
Output is correct |
94 |
Correct |
26 ms |
5596 KB |
Output is correct |
95 |
Correct |
26 ms |
5564 KB |
Output is correct |
96 |
Correct |
35 ms |
6860 KB |
Output is correct |
97 |
Correct |
31 ms |
6920 KB |
Output is correct |
98 |
Correct |
31 ms |
6876 KB |
Output is correct |
99 |
Correct |
33 ms |
6988 KB |
Output is correct |
100 |
Correct |
31 ms |
6868 KB |
Output is correct |
101 |
Correct |
33 ms |
6920 KB |
Output is correct |
102 |
Correct |
34 ms |
6932 KB |
Output is correct |
103 |
Correct |
31 ms |
6860 KB |
Output is correct |
104 |
Correct |
32 ms |
6920 KB |
Output is correct |
105 |
Correct |
32 ms |
6796 KB |
Output is correct |
106 |
Correct |
33 ms |
7496 KB |
Output is correct |
107 |
Correct |
32 ms |
7504 KB |
Output is correct |
108 |
Correct |
34 ms |
7488 KB |
Output is correct |
109 |
Correct |
31 ms |
7528 KB |
Output is correct |
110 |
Correct |
36 ms |
7516 KB |
Output is correct |
111 |
Correct |
40 ms |
7628 KB |
Output is correct |
112 |
Correct |
31 ms |
7556 KB |
Output is correct |
113 |
Correct |
32 ms |
7556 KB |
Output is correct |
114 |
Correct |
32 ms |
7556 KB |
Output is correct |
115 |
Correct |
31 ms |
7628 KB |
Output is correct |
116 |
Correct |
203 ms |
2856 KB |
Output is correct |
117 |
Correct |
223 ms |
2864 KB |
Output is correct |
118 |
Correct |
365 ms |
3528 KB |
Output is correct |
119 |
Correct |
438 ms |
3656 KB |
Output is correct |
120 |
Correct |
462 ms |
3548 KB |
Output is correct |
121 |
Correct |
797 ms |
4132 KB |
Output is correct |
122 |
Correct |
936 ms |
4204 KB |
Output is correct |
123 |
Correct |
1773 ms |
5608 KB |
Output is correct |
124 |
Correct |
2338 ms |
5668 KB |
Output is correct |
125 |
Correct |
3171 ms |
5708 KB |
Output is correct |
126 |
Correct |
3360 ms |
6520 KB |
Output is correct |
127 |
Correct |
3335 ms |
6504 KB |
Output is correct |
128 |
Correct |
3353 ms |
6512 KB |
Output is correct |
129 |
Correct |
3287 ms |
6600 KB |
Output is correct |
130 |
Correct |
3308 ms |
6528 KB |
Output is correct |
131 |
Correct |
3381 ms |
6640 KB |
Output is correct |
132 |
Correct |
3432 ms |
6656 KB |
Output is correct |
133 |
Correct |
3398 ms |
6640 KB |
Output is correct |
134 |
Correct |
3445 ms |
6648 KB |
Output is correct |
135 |
Correct |
3433 ms |
6668 KB |
Output is correct |
136 |
Correct |
3461 ms |
6668 KB |
Output is correct |
137 |
Correct |
3442 ms |
6668 KB |
Output is correct |
138 |
Correct |
3493 ms |
6600 KB |
Output is correct |
139 |
Correct |
3439 ms |
6728 KB |
Output is correct |
140 |
Correct |
3527 ms |
6656 KB |
Output is correct |
141 |
Correct |
3202 ms |
6668 KB |
Output is correct |
142 |
Correct |
3267 ms |
6664 KB |
Output is correct |
143 |
Correct |
3267 ms |
6724 KB |
Output is correct |
144 |
Correct |
3261 ms |
6672 KB |
Output is correct |
145 |
Correct |
3227 ms |
6664 KB |
Output is correct |
146 |
Correct |
3419 ms |
6932 KB |
Output is correct |
147 |
Correct |
3386 ms |
6932 KB |
Output is correct |
148 |
Correct |
3487 ms |
6940 KB |
Output is correct |
149 |
Correct |
3414 ms |
6932 KB |
Output is correct |
150 |
Correct |
3438 ms |
6932 KB |
Output is correct |
151 |
Correct |
4426 ms |
6944 KB |
Output is correct |
152 |
Correct |
4453 ms |
6940 KB |
Output is correct |
153 |
Correct |
4484 ms |
6956 KB |
Output is correct |
154 |
Correct |
4447 ms |
6944 KB |
Output is correct |
155 |
Correct |
4450 ms |
6948 KB |
Output is correct |
156 |
Execution timed out |
7049 ms |
7196 KB |
Time limit exceeded |
157 |
Halted |
0 ms |
0 KB |
- |