#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 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 -= f(pref) + f(R-L+1 - pref - d[i]);
pref += d[i];
}
q += m * f(R-L+1);
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 |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 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 |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
2 ms |
468 KB |
Output is correct |
4 |
Correct |
8 ms |
1752 KB |
Output is correct |
5 |
Correct |
13 ms |
3440 KB |
Output is correct |
6 |
Correct |
21 ms |
4120 KB |
Output is correct |
7 |
Correct |
23 ms |
5468 KB |
Output is correct |
8 |
Correct |
23 ms |
4064 KB |
Output is correct |
9 |
Correct |
23 ms |
4040 KB |
Output is correct |
10 |
Correct |
21 ms |
4560 KB |
Output is correct |
11 |
Correct |
26 ms |
4536 KB |
Output is correct |
12 |
Correct |
25 ms |
4040 KB |
Output is correct |
13 |
Correct |
21 ms |
3960 KB |
Output is correct |
14 |
Correct |
22 ms |
4396 KB |
Output is correct |
15 |
Correct |
22 ms |
4504 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
2 ms |
468 KB |
Output is correct |
4 |
Correct |
8 ms |
1752 KB |
Output is correct |
5 |
Correct |
13 ms |
3440 KB |
Output is correct |
6 |
Correct |
21 ms |
4120 KB |
Output is correct |
7 |
Correct |
23 ms |
5468 KB |
Output is correct |
8 |
Correct |
23 ms |
4064 KB |
Output is correct |
9 |
Correct |
23 ms |
4040 KB |
Output is correct |
10 |
Correct |
21 ms |
4560 KB |
Output is correct |
11 |
Correct |
26 ms |
4536 KB |
Output is correct |
12 |
Correct |
25 ms |
4040 KB |
Output is correct |
13 |
Correct |
21 ms |
3960 KB |
Output is correct |
14 |
Correct |
22 ms |
4396 KB |
Output is correct |
15 |
Correct |
22 ms |
4504 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Correct |
2 ms |
488 KB |
Output is correct |
19 |
Correct |
8 ms |
1696 KB |
Output is correct |
20 |
Correct |
13 ms |
2900 KB |
Output is correct |
21 |
Correct |
21 ms |
4300 KB |
Output is correct |
22 |
Correct |
24 ms |
4048 KB |
Output is correct |
23 |
Correct |
21 ms |
4220 KB |
Output is correct |
24 |
Correct |
22 ms |
4124 KB |
Output is correct |
25 |
Correct |
27 ms |
4048 KB |
Output is correct |
26 |
Correct |
27 ms |
4100 KB |
Output is correct |
27 |
Correct |
22 ms |
4100 KB |
Output is correct |
28 |
Correct |
21 ms |
4568 KB |
Output is correct |
29 |
Correct |
22 ms |
4056 KB |
Output is correct |
30 |
Correct |
20 ms |
4144 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
2 ms |
468 KB |
Output is correct |
4 |
Correct |
8 ms |
1752 KB |
Output is correct |
5 |
Correct |
13 ms |
3440 KB |
Output is correct |
6 |
Correct |
21 ms |
4120 KB |
Output is correct |
7 |
Correct |
23 ms |
5468 KB |
Output is correct |
8 |
Correct |
23 ms |
4064 KB |
Output is correct |
9 |
Correct |
23 ms |
4040 KB |
Output is correct |
10 |
Correct |
21 ms |
4560 KB |
Output is correct |
11 |
Correct |
26 ms |
4536 KB |
Output is correct |
12 |
Correct |
25 ms |
4040 KB |
Output is correct |
13 |
Correct |
21 ms |
3960 KB |
Output is correct |
14 |
Correct |
22 ms |
4396 KB |
Output is correct |
15 |
Correct |
22 ms |
4504 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Correct |
2 ms |
488 KB |
Output is correct |
19 |
Correct |
8 ms |
1696 KB |
Output is correct |
20 |
Correct |
13 ms |
2900 KB |
Output is correct |
21 |
Correct |
21 ms |
4300 KB |
Output is correct |
22 |
Correct |
24 ms |
4048 KB |
Output is correct |
23 |
Correct |
21 ms |
4220 KB |
Output is correct |
24 |
Correct |
22 ms |
4124 KB |
Output is correct |
25 |
Correct |
27 ms |
4048 KB |
Output is correct |
26 |
Correct |
27 ms |
4100 KB |
Output is correct |
27 |
Correct |
22 ms |
4100 KB |
Output is correct |
28 |
Correct |
21 ms |
4568 KB |
Output is correct |
29 |
Correct |
22 ms |
4056 KB |
Output is correct |
30 |
Correct |
20 ms |
4144 KB |
Output is correct |
31 |
Correct |
1 ms |
340 KB |
Output is correct |
32 |
Correct |
1 ms |
340 KB |
Output is correct |
33 |
Correct |
1 ms |
348 KB |
Output is correct |
34 |
Correct |
1 ms |
468 KB |
Output is correct |
35 |
Correct |
2 ms |
468 KB |
Output is correct |
36 |
Correct |
1 ms |
468 KB |
Output is correct |
37 |
Correct |
5 ms |
868 KB |
Output is correct |
38 |
Correct |
4 ms |
872 KB |
Output is correct |
39 |
Correct |
8 ms |
1492 KB |
Output is correct |
40 |
Correct |
15 ms |
2700 KB |
Output is correct |
41 |
Correct |
22 ms |
3876 KB |
Output is correct |
42 |
Correct |
23 ms |
3788 KB |
Output is correct |
43 |
Correct |
21 ms |
3892 KB |
Output is correct |
44 |
Correct |
24 ms |
3812 KB |
Output is correct |
45 |
Correct |
22 ms |
3856 KB |
Output is correct |
46 |
Correct |
21 ms |
3804 KB |
Output is correct |
47 |
Correct |
23 ms |
3760 KB |
Output is correct |
48 |
Correct |
21 ms |
3896 KB |
Output is correct |
49 |
Correct |
21 ms |
3856 KB |
Output is correct |
50 |
Correct |
21 ms |
3880 KB |
Output is correct |
51 |
Correct |
22 ms |
3884 KB |
Output is correct |
52 |
Correct |
21 ms |
3772 KB |
Output is correct |
53 |
Correct |
25 ms |
3900 KB |
Output is correct |
54 |
Correct |
21 ms |
3924 KB |
Output is correct |
55 |
Correct |
23 ms |
3912 KB |
Output is correct |
56 |
Correct |
21 ms |
3868 KB |
Output is correct |
57 |
Correct |
21 ms |
3888 KB |
Output is correct |
58 |
Correct |
23 ms |
3784 KB |
Output is correct |
59 |
Correct |
21 ms |
3876 KB |
Output is correct |
60 |
Correct |
22 ms |
3788 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 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 |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
0 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
2 ms |
468 KB |
Output is correct |
14 |
Correct |
8 ms |
1752 KB |
Output is correct |
15 |
Correct |
13 ms |
3440 KB |
Output is correct |
16 |
Correct |
21 ms |
4120 KB |
Output is correct |
17 |
Correct |
23 ms |
5468 KB |
Output is correct |
18 |
Correct |
23 ms |
4064 KB |
Output is correct |
19 |
Correct |
23 ms |
4040 KB |
Output is correct |
20 |
Correct |
21 ms |
4560 KB |
Output is correct |
21 |
Correct |
26 ms |
4536 KB |
Output is correct |
22 |
Correct |
25 ms |
4040 KB |
Output is correct |
23 |
Correct |
21 ms |
3960 KB |
Output is correct |
24 |
Correct |
22 ms |
4396 KB |
Output is correct |
25 |
Correct |
22 ms |
4504 KB |
Output is correct |
26 |
Correct |
1 ms |
340 KB |
Output is correct |
27 |
Correct |
1 ms |
340 KB |
Output is correct |
28 |
Correct |
2 ms |
488 KB |
Output is correct |
29 |
Correct |
8 ms |
1696 KB |
Output is correct |
30 |
Correct |
13 ms |
2900 KB |
Output is correct |
31 |
Correct |
21 ms |
4300 KB |
Output is correct |
32 |
Correct |
24 ms |
4048 KB |
Output is correct |
33 |
Correct |
21 ms |
4220 KB |
Output is correct |
34 |
Correct |
22 ms |
4124 KB |
Output is correct |
35 |
Correct |
27 ms |
4048 KB |
Output is correct |
36 |
Correct |
27 ms |
4100 KB |
Output is correct |
37 |
Correct |
22 ms |
4100 KB |
Output is correct |
38 |
Correct |
21 ms |
4568 KB |
Output is correct |
39 |
Correct |
22 ms |
4056 KB |
Output is correct |
40 |
Correct |
20 ms |
4144 KB |
Output is correct |
41 |
Correct |
1 ms |
340 KB |
Output is correct |
42 |
Correct |
1 ms |
340 KB |
Output is correct |
43 |
Correct |
1 ms |
348 KB |
Output is correct |
44 |
Correct |
1 ms |
468 KB |
Output is correct |
45 |
Correct |
2 ms |
468 KB |
Output is correct |
46 |
Correct |
1 ms |
468 KB |
Output is correct |
47 |
Correct |
5 ms |
868 KB |
Output is correct |
48 |
Correct |
4 ms |
872 KB |
Output is correct |
49 |
Correct |
8 ms |
1492 KB |
Output is correct |
50 |
Correct |
15 ms |
2700 KB |
Output is correct |
51 |
Correct |
22 ms |
3876 KB |
Output is correct |
52 |
Correct |
23 ms |
3788 KB |
Output is correct |
53 |
Correct |
21 ms |
3892 KB |
Output is correct |
54 |
Correct |
24 ms |
3812 KB |
Output is correct |
55 |
Correct |
22 ms |
3856 KB |
Output is correct |
56 |
Correct |
21 ms |
3804 KB |
Output is correct |
57 |
Correct |
23 ms |
3760 KB |
Output is correct |
58 |
Correct |
21 ms |
3896 KB |
Output is correct |
59 |
Correct |
21 ms |
3856 KB |
Output is correct |
60 |
Correct |
21 ms |
3880 KB |
Output is correct |
61 |
Correct |
22 ms |
3884 KB |
Output is correct |
62 |
Correct |
21 ms |
3772 KB |
Output is correct |
63 |
Correct |
25 ms |
3900 KB |
Output is correct |
64 |
Correct |
21 ms |
3924 KB |
Output is correct |
65 |
Correct |
23 ms |
3912 KB |
Output is correct |
66 |
Correct |
21 ms |
3868 KB |
Output is correct |
67 |
Correct |
21 ms |
3888 KB |
Output is correct |
68 |
Correct |
23 ms |
3784 KB |
Output is correct |
69 |
Correct |
21 ms |
3876 KB |
Output is correct |
70 |
Correct |
22 ms |
3788 KB |
Output is correct |
71 |
Correct |
4 ms |
980 KB |
Output is correct |
72 |
Correct |
4 ms |
1020 KB |
Output is correct |
73 |
Correct |
4 ms |
1000 KB |
Output is correct |
74 |
Correct |
4 ms |
1000 KB |
Output is correct |
75 |
Correct |
4 ms |
980 KB |
Output is correct |
76 |
Correct |
8 ms |
1668 KB |
Output is correct |
77 |
Correct |
7 ms |
1620 KB |
Output is correct |
78 |
Correct |
8 ms |
1656 KB |
Output is correct |
79 |
Correct |
9 ms |
1620 KB |
Output is correct |
80 |
Correct |
8 ms |
1636 KB |
Output is correct |
81 |
Correct |
15 ms |
2900 KB |
Output is correct |
82 |
Correct |
16 ms |
2908 KB |
Output is correct |
83 |
Correct |
15 ms |
2916 KB |
Output is correct |
84 |
Correct |
15 ms |
3008 KB |
Output is correct |
85 |
Correct |
15 ms |
3028 KB |
Output is correct |
86 |
Correct |
19 ms |
3156 KB |
Output is correct |
87 |
Correct |
17 ms |
3172 KB |
Output is correct |
88 |
Correct |
18 ms |
3156 KB |
Output is correct |
89 |
Correct |
18 ms |
3228 KB |
Output is correct |
90 |
Correct |
18 ms |
3176 KB |
Output is correct |
91 |
Correct |
33 ms |
5664 KB |
Output is correct |
92 |
Correct |
26 ms |
5652 KB |
Output is correct |
93 |
Correct |
27 ms |
5584 KB |
Output is correct |
94 |
Correct |
26 ms |
5576 KB |
Output is correct |
95 |
Correct |
28 ms |
5624 KB |
Output is correct |
96 |
Correct |
33 ms |
6900 KB |
Output is correct |
97 |
Correct |
33 ms |
6924 KB |
Output is correct |
98 |
Correct |
31 ms |
6968 KB |
Output is correct |
99 |
Correct |
31 ms |
6916 KB |
Output is correct |
100 |
Correct |
37 ms |
7052 KB |
Output is correct |
101 |
Correct |
31 ms |
6988 KB |
Output is correct |
102 |
Correct |
32 ms |
6948 KB |
Output is correct |
103 |
Correct |
32 ms |
6956 KB |
Output is correct |
104 |
Correct |
33 ms |
7008 KB |
Output is correct |
105 |
Correct |
30 ms |
6988 KB |
Output is correct |
106 |
Correct |
32 ms |
7620 KB |
Output is correct |
107 |
Correct |
33 ms |
7656 KB |
Output is correct |
108 |
Correct |
32 ms |
7656 KB |
Output is correct |
109 |
Correct |
31 ms |
7568 KB |
Output is correct |
110 |
Correct |
36 ms |
7628 KB |
Output is correct |
111 |
Correct |
32 ms |
7652 KB |
Output is correct |
112 |
Correct |
31 ms |
7572 KB |
Output is correct |
113 |
Correct |
35 ms |
7636 KB |
Output is correct |
114 |
Correct |
31 ms |
7640 KB |
Output is correct |
115 |
Correct |
30 ms |
7580 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 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 |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
0 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
2 ms |
468 KB |
Output is correct |
14 |
Correct |
8 ms |
1752 KB |
Output is correct |
15 |
Correct |
13 ms |
3440 KB |
Output is correct |
16 |
Correct |
21 ms |
4120 KB |
Output is correct |
17 |
Correct |
23 ms |
5468 KB |
Output is correct |
18 |
Correct |
23 ms |
4064 KB |
Output is correct |
19 |
Correct |
23 ms |
4040 KB |
Output is correct |
20 |
Correct |
21 ms |
4560 KB |
Output is correct |
21 |
Correct |
26 ms |
4536 KB |
Output is correct |
22 |
Correct |
25 ms |
4040 KB |
Output is correct |
23 |
Correct |
21 ms |
3960 KB |
Output is correct |
24 |
Correct |
22 ms |
4396 KB |
Output is correct |
25 |
Correct |
22 ms |
4504 KB |
Output is correct |
26 |
Correct |
1 ms |
340 KB |
Output is correct |
27 |
Correct |
1 ms |
340 KB |
Output is correct |
28 |
Correct |
2 ms |
488 KB |
Output is correct |
29 |
Correct |
8 ms |
1696 KB |
Output is correct |
30 |
Correct |
13 ms |
2900 KB |
Output is correct |
31 |
Correct |
21 ms |
4300 KB |
Output is correct |
32 |
Correct |
24 ms |
4048 KB |
Output is correct |
33 |
Correct |
21 ms |
4220 KB |
Output is correct |
34 |
Correct |
22 ms |
4124 KB |
Output is correct |
35 |
Correct |
27 ms |
4048 KB |
Output is correct |
36 |
Correct |
27 ms |
4100 KB |
Output is correct |
37 |
Correct |
22 ms |
4100 KB |
Output is correct |
38 |
Correct |
21 ms |
4568 KB |
Output is correct |
39 |
Correct |
22 ms |
4056 KB |
Output is correct |
40 |
Correct |
20 ms |
4144 KB |
Output is correct |
41 |
Correct |
1 ms |
340 KB |
Output is correct |
42 |
Correct |
1 ms |
340 KB |
Output is correct |
43 |
Correct |
1 ms |
348 KB |
Output is correct |
44 |
Correct |
1 ms |
468 KB |
Output is correct |
45 |
Correct |
2 ms |
468 KB |
Output is correct |
46 |
Correct |
1 ms |
468 KB |
Output is correct |
47 |
Correct |
5 ms |
868 KB |
Output is correct |
48 |
Correct |
4 ms |
872 KB |
Output is correct |
49 |
Correct |
8 ms |
1492 KB |
Output is correct |
50 |
Correct |
15 ms |
2700 KB |
Output is correct |
51 |
Correct |
22 ms |
3876 KB |
Output is correct |
52 |
Correct |
23 ms |
3788 KB |
Output is correct |
53 |
Correct |
21 ms |
3892 KB |
Output is correct |
54 |
Correct |
24 ms |
3812 KB |
Output is correct |
55 |
Correct |
22 ms |
3856 KB |
Output is correct |
56 |
Correct |
21 ms |
3804 KB |
Output is correct |
57 |
Correct |
23 ms |
3760 KB |
Output is correct |
58 |
Correct |
21 ms |
3896 KB |
Output is correct |
59 |
Correct |
21 ms |
3856 KB |
Output is correct |
60 |
Correct |
21 ms |
3880 KB |
Output is correct |
61 |
Correct |
22 ms |
3884 KB |
Output is correct |
62 |
Correct |
21 ms |
3772 KB |
Output is correct |
63 |
Correct |
25 ms |
3900 KB |
Output is correct |
64 |
Correct |
21 ms |
3924 KB |
Output is correct |
65 |
Correct |
23 ms |
3912 KB |
Output is correct |
66 |
Correct |
21 ms |
3868 KB |
Output is correct |
67 |
Correct |
21 ms |
3888 KB |
Output is correct |
68 |
Correct |
23 ms |
3784 KB |
Output is correct |
69 |
Correct |
21 ms |
3876 KB |
Output is correct |
70 |
Correct |
22 ms |
3788 KB |
Output is correct |
71 |
Correct |
4 ms |
980 KB |
Output is correct |
72 |
Correct |
4 ms |
1020 KB |
Output is correct |
73 |
Correct |
4 ms |
1000 KB |
Output is correct |
74 |
Correct |
4 ms |
1000 KB |
Output is correct |
75 |
Correct |
4 ms |
980 KB |
Output is correct |
76 |
Correct |
8 ms |
1668 KB |
Output is correct |
77 |
Correct |
7 ms |
1620 KB |
Output is correct |
78 |
Correct |
8 ms |
1656 KB |
Output is correct |
79 |
Correct |
9 ms |
1620 KB |
Output is correct |
80 |
Correct |
8 ms |
1636 KB |
Output is correct |
81 |
Correct |
15 ms |
2900 KB |
Output is correct |
82 |
Correct |
16 ms |
2908 KB |
Output is correct |
83 |
Correct |
15 ms |
2916 KB |
Output is correct |
84 |
Correct |
15 ms |
3008 KB |
Output is correct |
85 |
Correct |
15 ms |
3028 KB |
Output is correct |
86 |
Correct |
19 ms |
3156 KB |
Output is correct |
87 |
Correct |
17 ms |
3172 KB |
Output is correct |
88 |
Correct |
18 ms |
3156 KB |
Output is correct |
89 |
Correct |
18 ms |
3228 KB |
Output is correct |
90 |
Correct |
18 ms |
3176 KB |
Output is correct |
91 |
Correct |
33 ms |
5664 KB |
Output is correct |
92 |
Correct |
26 ms |
5652 KB |
Output is correct |
93 |
Correct |
27 ms |
5584 KB |
Output is correct |
94 |
Correct |
26 ms |
5576 KB |
Output is correct |
95 |
Correct |
28 ms |
5624 KB |
Output is correct |
96 |
Correct |
33 ms |
6900 KB |
Output is correct |
97 |
Correct |
33 ms |
6924 KB |
Output is correct |
98 |
Correct |
31 ms |
6968 KB |
Output is correct |
99 |
Correct |
31 ms |
6916 KB |
Output is correct |
100 |
Correct |
37 ms |
7052 KB |
Output is correct |
101 |
Correct |
31 ms |
6988 KB |
Output is correct |
102 |
Correct |
32 ms |
6948 KB |
Output is correct |
103 |
Correct |
32 ms |
6956 KB |
Output is correct |
104 |
Correct |
33 ms |
7008 KB |
Output is correct |
105 |
Correct |
30 ms |
6988 KB |
Output is correct |
106 |
Correct |
32 ms |
7620 KB |
Output is correct |
107 |
Correct |
33 ms |
7656 KB |
Output is correct |
108 |
Correct |
32 ms |
7656 KB |
Output is correct |
109 |
Correct |
31 ms |
7568 KB |
Output is correct |
110 |
Correct |
36 ms |
7628 KB |
Output is correct |
111 |
Correct |
32 ms |
7652 KB |
Output is correct |
112 |
Correct |
31 ms |
7572 KB |
Output is correct |
113 |
Correct |
35 ms |
7636 KB |
Output is correct |
114 |
Correct |
31 ms |
7640 KB |
Output is correct |
115 |
Correct |
30 ms |
7580 KB |
Output is correct |
116 |
Correct |
200 ms |
2856 KB |
Output is correct |
117 |
Correct |
216 ms |
2864 KB |
Output is correct |
118 |
Correct |
373 ms |
3500 KB |
Output is correct |
119 |
Correct |
449 ms |
3656 KB |
Output is correct |
120 |
Correct |
483 ms |
3544 KB |
Output is correct |
121 |
Correct |
808 ms |
4248 KB |
Output is correct |
122 |
Correct |
952 ms |
4204 KB |
Output is correct |
123 |
Correct |
1761 ms |
5484 KB |
Output is correct |
124 |
Correct |
2382 ms |
5684 KB |
Output is correct |
125 |
Correct |
3528 ms |
5836 KB |
Output is correct |
126 |
Correct |
3365 ms |
6508 KB |
Output is correct |
127 |
Correct |
3327 ms |
6496 KB |
Output is correct |
128 |
Correct |
3343 ms |
6564 KB |
Output is correct |
129 |
Correct |
3319 ms |
6500 KB |
Output is correct |
130 |
Correct |
3323 ms |
6496 KB |
Output is correct |
131 |
Correct |
3393 ms |
6648 KB |
Output is correct |
132 |
Correct |
3450 ms |
6728 KB |
Output is correct |
133 |
Correct |
3420 ms |
6644 KB |
Output is correct |
134 |
Correct |
3426 ms |
6688 KB |
Output is correct |
135 |
Correct |
3425 ms |
6664 KB |
Output is correct |
136 |
Correct |
3441 ms |
6664 KB |
Output is correct |
137 |
Correct |
3438 ms |
6680 KB |
Output is correct |
138 |
Correct |
3456 ms |
6668 KB |
Output is correct |
139 |
Correct |
3492 ms |
6652 KB |
Output is correct |
140 |
Correct |
3664 ms |
6548 KB |
Output is correct |
141 |
Correct |
3214 ms |
6748 KB |
Output is correct |
142 |
Correct |
3245 ms |
6780 KB |
Output is correct |
143 |
Correct |
3238 ms |
6664 KB |
Output is correct |
144 |
Correct |
3240 ms |
6772 KB |
Output is correct |
145 |
Correct |
3214 ms |
6664 KB |
Output is correct |
146 |
Correct |
3508 ms |
6940 KB |
Output is correct |
147 |
Correct |
3476 ms |
6932 KB |
Output is correct |
148 |
Correct |
3527 ms |
7032 KB |
Output is correct |
149 |
Correct |
3495 ms |
6944 KB |
Output is correct |
150 |
Correct |
3502 ms |
7064 KB |
Output is correct |
151 |
Correct |
4799 ms |
7088 KB |
Output is correct |
152 |
Correct |
4789 ms |
6984 KB |
Output is correct |
153 |
Correct |
4839 ms |
6980 KB |
Output is correct |
154 |
Correct |
4843 ms |
6988 KB |
Output is correct |
155 |
Correct |
4774 ms |
6984 KB |
Output is correct |
156 |
Execution timed out |
7046 ms |
7596 KB |
Time limit exceeded |
157 |
Halted |
0 ms |
0 KB |
- |