#include <bits/stdc++.h>
using namespace std;
#define int long long
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define foru(i, l, r) for(int i = l; i <= r; i++)
#define ford(i, r, l) for(int i = r; i >= l; i--)
#define __TIME (1.0 * clock() / CLOCKS_PER_SEC)
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<ii, ii> iiii;
const int N = 5e5 + 5;
const int oo = 1e18, mod = 1e9 + 7;
struct Fenwick {
int n;
int tree[N];
void init(int _n) {
n = _n;
for (int i = 1; i <= n; i++) tree[i] = 0;
}
void add(int x, int y) {
while (x <= n) {
tree[x] += y;
x += x & -x;
}
}
int sum(int x) {
int ret = 0;
while (x) {
ret += tree[x];
x -= x & -x;
}
return ret;
}
int sum(int l, int r) {
if (l > r) return 0;
return sum(r) - sum(l - 1);
}
} tree, treeL, treeR;
int n;
int arr[N];
int DP[2][2];
int ld[N], rd[N];
int inversion = 0;
bool impossible(int start0, int start1, int len0, int len1, int cnt0, int cnt1) {
int c0 = 0, c1 = 0;
c0 += (len0 % 2 && start0 == 0) ? (len0 + 1) / 2 : len0 / 2;
c1 += (len0 % 2 && start0 == 1) ? (len0 + 1) / 2 : len0 / 2;
c0 += (len1 % 2 && start1 == 0) ? (len1 + 1) / 2 : len1 / 2;
c1 += (len1 % 2 && start1 == 1) ? (len1 + 1) / 2 : len1 / 2;
if (c0 == cnt0 && c1 == cnt1) return false;
return true;
}
void addSetLeft(int x) {
inversion += ld[x];
inversion += treeL.sum(x + 1, n);
inversion += treeR.sum(1, x - 1);
treeL.add(x, 1);
}
void addSetRight(int x) {
inversion += rd[x];
inversion += treeR.sum(1, x - 1);
inversion += treeL.sum(x + 1, n);
treeR.add(x, 1);
}
void delSetLeft(int x) {
treeL.add(x, -1);
inversion -= treeR.sum(1, x - 1);
inversion -= treeL.sum(x + 1, n);
inversion -= ld[x];
}
void delSetRight(int x) {
treeR.add(x, -1);
inversion -= treeL.sum(x + 1, n);
inversion -= treeR.sum(1, x - 1);
inversion -= rd[x];
}
void process() {
cin >> n;
foru(i, 1, n) {
cin >> arr[i];
if (i % 2 == 0) arr[i] = -arr[i];
}
vector<pair<int, int> > vec;
for (int i = 1; i <= n; i++) vec.push_back(make_pair(abs(arr[i]), i));
sort(vec.rbegin(), vec.rend());
tree.init(n);
treeL.init(n);
treeR.init(n);
for (int i = 1; i <= n; i++) tree.add(i, 1);
for (int a = 0; a < 4; a++) DP[(a >> 1) & 1][a & 1] = oo;
DP[0][0] = 0;
int usedCnt = 0;
for (int s = 0; s < n; s++) {
if (vec[s].first == 0) break;
int e = s;
while (e + 1 < n && vec[s].first == vec[e + 1].first) e++;
reverse(vec.begin() + s, vec.begin() + e + 1);
vector<int> pos[2];
vector<int> rpos[2];
for (int i = s; i <= e; i++) tree.add(vec[i].second, -1);
for (int i = s; i <= e; i++) {
int x = vec[i].second;
ld[x] = tree.sum(1, x), rd[x] = tree.sum(x, n);
if (arr[x] < 0) pos[0].push_back(x);
else pos[1].push_back(x);
}
rpos[0] = pos[0];
rpos[1] = pos[1];
reverse(rpos[0].begin(), rpos[0].end());
reverse(rpos[1].begin(), rpos[1].end());
int L = tree.sum(1, n);
int K = (int)pos[0].size() + (int)pos[1].size();
for (int js = 0; js < 2; js++) {
int je = (n % 2) ^ ((usedCnt - js) & 1);
for (int ta = 0; ta < 2; ta++) {
int tb = (K + ta) % 2;
if (impossible(js, je, ta, K - ta, (int)pos[0].size(), (int)pos[1].size())) continue;
int l = ta, r = K - ta;
inversion = 0;
for (int i = 1; i <= l; i++) {
if (i % 2 == 1) addSetLeft(pos[js][i / 2]);
else addSetLeft(pos[!js][(i - 1) / 2]);
}
for (int i = 1; i <= r; i++) {
if (i % 2 == 1) addSetRight(rpos[je][i / 2]);
else addSetRight(rpos[!je][(i - 1) / 2]);
}
DP[1][(js + ta) & 1] = min(DP[1][(js + ta) & 1], DP[0][js] + inversion);
while (r >= 2) {
for (int c = 0; c < 2; c++) {
if (r % 2 == 1) delSetRight(rpos[je][r / 2]);
else delSetRight(rpos[!je][(r - 1) / 2]);
r--, ++l;
if (l % 2 == 1) addSetLeft(pos[js][l / 2]);
else addSetLeft(pos[!js][(l - 1) / 2]);
}
DP[1][(js + ta) & 1] = min(DP[1][(js + ta) & 1], DP[0][js] + inversion);
}
while (l) {
if (l % 2 == 1) delSetLeft(pos[js][l / 2]);
else delSetLeft(pos[!js][(l - 1) / 2]);
l--;
}
while (r) {
if (r % 2 == 1) delSetRight(rpos[je][r / 2]);
else delSetRight(rpos[!je][(r - 1) / 2]);
r--;
}
}
}
s = e;
for (int a = 0; a < 2; a++) DP[0][a] = DP[1][a], DP[1][a] = oo;
usedCnt += K;
}
int ans = min(DP[0][0], DP[0][1]);
printf("%lld", ans == oo ? -1 : ans);
}
signed main() {
cin.tie(0)->sync_with_stdio(false);
//freopen(".inp", "r", stdin);
//freopen(".out", "w", stdout);
process();
cerr << "Time elapsed: " << __TIME << " s.\n";
return 0;
}
Compilation message
Main.cpp: In function 'void process()':
Main.cpp:145:21: warning: unused variable 'tb' [-Wunused-variable]
145 | int tb = (K + ta) % 2;
| ^~
Main.cpp:139:13: warning: unused variable 'L' [-Wunused-variable]
139 | int L = tree.sum(1, n);
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
10588 KB |
Output is correct |
2 |
Correct |
1 ms |
10588 KB |
Output is correct |
3 |
Correct |
2 ms |
10656 KB |
Output is correct |
4 |
Correct |
2 ms |
10588 KB |
Output is correct |
5 |
Correct |
2 ms |
10588 KB |
Output is correct |
6 |
Correct |
2 ms |
10588 KB |
Output is correct |
7 |
Correct |
2 ms |
10716 KB |
Output is correct |
8 |
Correct |
2 ms |
10588 KB |
Output is correct |
9 |
Correct |
2 ms |
10588 KB |
Output is correct |
10 |
Correct |
2 ms |
10588 KB |
Output is correct |
11 |
Correct |
2 ms |
10588 KB |
Output is correct |
12 |
Correct |
2 ms |
10744 KB |
Output is correct |
13 |
Correct |
2 ms |
10588 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
10588 KB |
Output is correct |
2 |
Correct |
1 ms |
10588 KB |
Output is correct |
3 |
Correct |
2 ms |
10656 KB |
Output is correct |
4 |
Correct |
2 ms |
10588 KB |
Output is correct |
5 |
Correct |
2 ms |
10588 KB |
Output is correct |
6 |
Correct |
2 ms |
10588 KB |
Output is correct |
7 |
Correct |
2 ms |
10716 KB |
Output is correct |
8 |
Correct |
2 ms |
10588 KB |
Output is correct |
9 |
Correct |
2 ms |
10588 KB |
Output is correct |
10 |
Correct |
2 ms |
10588 KB |
Output is correct |
11 |
Correct |
2 ms |
10588 KB |
Output is correct |
12 |
Correct |
2 ms |
10744 KB |
Output is correct |
13 |
Correct |
2 ms |
10588 KB |
Output is correct |
14 |
Correct |
1 ms |
10588 KB |
Output is correct |
15 |
Correct |
244 ms |
42444 KB |
Output is correct |
16 |
Correct |
240 ms |
42920 KB |
Output is correct |
17 |
Correct |
241 ms |
42288 KB |
Output is correct |
18 |
Correct |
64 ms |
41620 KB |
Output is correct |
19 |
Correct |
250 ms |
41400 KB |
Output is correct |
20 |
Correct |
355 ms |
40920 KB |
Output is correct |
21 |
Correct |
307 ms |
40924 KB |
Output is correct |
22 |
Correct |
355 ms |
41148 KB |
Output is correct |
23 |
Correct |
303 ms |
41220 KB |
Output is correct |
24 |
Correct |
208 ms |
40892 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
10588 KB |
Output is correct |
2 |
Correct |
1 ms |
10588 KB |
Output is correct |
3 |
Correct |
2 ms |
10656 KB |
Output is correct |
4 |
Correct |
2 ms |
10588 KB |
Output is correct |
5 |
Correct |
2 ms |
10588 KB |
Output is correct |
6 |
Correct |
2 ms |
10588 KB |
Output is correct |
7 |
Correct |
2 ms |
10716 KB |
Output is correct |
8 |
Correct |
2 ms |
10588 KB |
Output is correct |
9 |
Correct |
2 ms |
10588 KB |
Output is correct |
10 |
Correct |
2 ms |
10588 KB |
Output is correct |
11 |
Correct |
2 ms |
10588 KB |
Output is correct |
12 |
Correct |
2 ms |
10744 KB |
Output is correct |
13 |
Correct |
2 ms |
10588 KB |
Output is correct |
14 |
Correct |
2 ms |
10588 KB |
Output is correct |
15 |
Correct |
1 ms |
10588 KB |
Output is correct |
16 |
Correct |
1 ms |
8540 KB |
Output is correct |
17 |
Correct |
2 ms |
10588 KB |
Output is correct |
18 |
Correct |
2 ms |
10588 KB |
Output is correct |
19 |
Correct |
3 ms |
10840 KB |
Output is correct |
20 |
Correct |
2 ms |
10588 KB |
Output is correct |
21 |
Correct |
2 ms |
10588 KB |
Output is correct |
22 |
Correct |
3 ms |
10588 KB |
Output is correct |
23 |
Correct |
2 ms |
10712 KB |
Output is correct |
24 |
Correct |
2 ms |
10588 KB |
Output is correct |
25 |
Correct |
2 ms |
10588 KB |
Output is correct |
26 |
Correct |
2 ms |
10588 KB |
Output is correct |
27 |
Correct |
2 ms |
10588 KB |
Output is correct |
28 |
Correct |
2 ms |
10588 KB |
Output is correct |
29 |
Correct |
2 ms |
10592 KB |
Output is correct |
30 |
Correct |
1 ms |
8544 KB |
Output is correct |
31 |
Correct |
2 ms |
10704 KB |
Output is correct |
32 |
Correct |
2 ms |
10592 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
10588 KB |
Output is correct |
2 |
Correct |
1 ms |
10588 KB |
Output is correct |
3 |
Correct |
2 ms |
10656 KB |
Output is correct |
4 |
Correct |
2 ms |
10588 KB |
Output is correct |
5 |
Correct |
2 ms |
10588 KB |
Output is correct |
6 |
Correct |
2 ms |
10588 KB |
Output is correct |
7 |
Correct |
2 ms |
10716 KB |
Output is correct |
8 |
Correct |
2 ms |
10588 KB |
Output is correct |
9 |
Correct |
2 ms |
10588 KB |
Output is correct |
10 |
Correct |
2 ms |
10588 KB |
Output is correct |
11 |
Correct |
2 ms |
10588 KB |
Output is correct |
12 |
Correct |
2 ms |
10744 KB |
Output is correct |
13 |
Correct |
2 ms |
10588 KB |
Output is correct |
14 |
Correct |
1 ms |
10588 KB |
Output is correct |
15 |
Correct |
244 ms |
42444 KB |
Output is correct |
16 |
Correct |
240 ms |
42920 KB |
Output is correct |
17 |
Correct |
241 ms |
42288 KB |
Output is correct |
18 |
Correct |
64 ms |
41620 KB |
Output is correct |
19 |
Correct |
250 ms |
41400 KB |
Output is correct |
20 |
Correct |
355 ms |
40920 KB |
Output is correct |
21 |
Correct |
307 ms |
40924 KB |
Output is correct |
22 |
Correct |
355 ms |
41148 KB |
Output is correct |
23 |
Correct |
303 ms |
41220 KB |
Output is correct |
24 |
Correct |
208 ms |
40892 KB |
Output is correct |
25 |
Correct |
2 ms |
10588 KB |
Output is correct |
26 |
Correct |
1 ms |
10588 KB |
Output is correct |
27 |
Correct |
1 ms |
8540 KB |
Output is correct |
28 |
Correct |
2 ms |
10588 KB |
Output is correct |
29 |
Correct |
2 ms |
10588 KB |
Output is correct |
30 |
Correct |
3 ms |
10840 KB |
Output is correct |
31 |
Correct |
2 ms |
10588 KB |
Output is correct |
32 |
Correct |
2 ms |
10588 KB |
Output is correct |
33 |
Correct |
3 ms |
10588 KB |
Output is correct |
34 |
Correct |
2 ms |
10712 KB |
Output is correct |
35 |
Correct |
2 ms |
10588 KB |
Output is correct |
36 |
Correct |
2 ms |
10588 KB |
Output is correct |
37 |
Correct |
2 ms |
10588 KB |
Output is correct |
38 |
Correct |
2 ms |
10588 KB |
Output is correct |
39 |
Correct |
2 ms |
10588 KB |
Output is correct |
40 |
Correct |
2 ms |
10592 KB |
Output is correct |
41 |
Correct |
1 ms |
8544 KB |
Output is correct |
42 |
Correct |
2 ms |
10704 KB |
Output is correct |
43 |
Correct |
2 ms |
10592 KB |
Output is correct |
44 |
Correct |
168 ms |
37440 KB |
Output is correct |
45 |
Correct |
212 ms |
37284 KB |
Output is correct |
46 |
Correct |
123 ms |
37304 KB |
Output is correct |
47 |
Correct |
80 ms |
37172 KB |
Output is correct |
48 |
Correct |
322 ms |
39096 KB |
Output is correct |
49 |
Correct |
378 ms |
41244 KB |
Output is correct |
50 |
Correct |
187 ms |
36748 KB |
Output is correct |
51 |
Correct |
179 ms |
36672 KB |
Output is correct |
52 |
Correct |
188 ms |
37024 KB |
Output is correct |
53 |
Correct |
83 ms |
36792 KB |
Output is correct |
54 |
Correct |
401 ms |
38840 KB |
Output is correct |
55 |
Correct |
266 ms |
38760 KB |
Output is correct |
56 |
Correct |
268 ms |
38792 KB |
Output is correct |
57 |
Correct |
42 ms |
26308 KB |
Output is correct |
58 |
Correct |
54 ms |
30392 KB |
Output is correct |
59 |
Correct |
56 ms |
32696 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
10588 KB |
Output is correct |
2 |
Correct |
1 ms |
10708 KB |
Output is correct |
3 |
Correct |
2 ms |
10588 KB |
Output is correct |
4 |
Correct |
2 ms |
10988 KB |
Output is correct |
5 |
Correct |
2 ms |
10588 KB |
Output is correct |
6 |
Correct |
2 ms |
10588 KB |
Output is correct |
7 |
Correct |
2 ms |
10588 KB |
Output is correct |
8 |
Correct |
2 ms |
10588 KB |
Output is correct |
9 |
Correct |
1 ms |
8540 KB |
Output is correct |
10 |
Correct |
1 ms |
10588 KB |
Output is correct |
11 |
Correct |
2 ms |
10588 KB |
Output is correct |
12 |
Correct |
3 ms |
10588 KB |
Output is correct |
13 |
Correct |
2 ms |
10588 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
10588 KB |
Output is correct |
2 |
Correct |
1 ms |
10708 KB |
Output is correct |
3 |
Correct |
2 ms |
10588 KB |
Output is correct |
4 |
Correct |
2 ms |
10988 KB |
Output is correct |
5 |
Correct |
2 ms |
10588 KB |
Output is correct |
6 |
Correct |
2 ms |
10588 KB |
Output is correct |
7 |
Correct |
2 ms |
10588 KB |
Output is correct |
8 |
Correct |
2 ms |
10588 KB |
Output is correct |
9 |
Correct |
1 ms |
8540 KB |
Output is correct |
10 |
Correct |
1 ms |
10588 KB |
Output is correct |
11 |
Correct |
2 ms |
10588 KB |
Output is correct |
12 |
Correct |
3 ms |
10588 KB |
Output is correct |
13 |
Correct |
2 ms |
10588 KB |
Output is correct |
14 |
Correct |
181 ms |
36820 KB |
Output is correct |
15 |
Correct |
361 ms |
36792 KB |
Output is correct |
16 |
Correct |
322 ms |
35300 KB |
Output is correct |
17 |
Correct |
349 ms |
35772 KB |
Output is correct |
18 |
Correct |
303 ms |
35256 KB |
Output is correct |
19 |
Correct |
393 ms |
35772 KB |
Output is correct |
20 |
Correct |
1 ms |
10588 KB |
Output is correct |
21 |
Correct |
1 ms |
10588 KB |
Output is correct |
22 |
Correct |
250 ms |
36900 KB |
Output is correct |
23 |
Correct |
258 ms |
36860 KB |
Output is correct |
24 |
Correct |
221 ms |
35244 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
10588 KB |
Output is correct |
2 |
Correct |
1 ms |
10588 KB |
Output is correct |
3 |
Correct |
2 ms |
10656 KB |
Output is correct |
4 |
Correct |
2 ms |
10588 KB |
Output is correct |
5 |
Correct |
2 ms |
10588 KB |
Output is correct |
6 |
Correct |
2 ms |
10588 KB |
Output is correct |
7 |
Correct |
2 ms |
10716 KB |
Output is correct |
8 |
Correct |
2 ms |
10588 KB |
Output is correct |
9 |
Correct |
2 ms |
10588 KB |
Output is correct |
10 |
Correct |
2 ms |
10588 KB |
Output is correct |
11 |
Correct |
2 ms |
10588 KB |
Output is correct |
12 |
Correct |
2 ms |
10744 KB |
Output is correct |
13 |
Correct |
2 ms |
10588 KB |
Output is correct |
14 |
Correct |
2 ms |
10588 KB |
Output is correct |
15 |
Correct |
1 ms |
10588 KB |
Output is correct |
16 |
Correct |
1 ms |
8540 KB |
Output is correct |
17 |
Correct |
2 ms |
10588 KB |
Output is correct |
18 |
Correct |
2 ms |
10588 KB |
Output is correct |
19 |
Correct |
3 ms |
10840 KB |
Output is correct |
20 |
Correct |
2 ms |
10588 KB |
Output is correct |
21 |
Correct |
2 ms |
10588 KB |
Output is correct |
22 |
Correct |
3 ms |
10588 KB |
Output is correct |
23 |
Correct |
2 ms |
10712 KB |
Output is correct |
24 |
Correct |
2 ms |
10588 KB |
Output is correct |
25 |
Correct |
2 ms |
10588 KB |
Output is correct |
26 |
Correct |
2 ms |
10588 KB |
Output is correct |
27 |
Correct |
2 ms |
10588 KB |
Output is correct |
28 |
Correct |
2 ms |
10588 KB |
Output is correct |
29 |
Correct |
2 ms |
10592 KB |
Output is correct |
30 |
Correct |
1 ms |
8544 KB |
Output is correct |
31 |
Correct |
2 ms |
10704 KB |
Output is correct |
32 |
Correct |
2 ms |
10592 KB |
Output is correct |
33 |
Correct |
1 ms |
10588 KB |
Output is correct |
34 |
Correct |
1 ms |
10708 KB |
Output is correct |
35 |
Correct |
2 ms |
10588 KB |
Output is correct |
36 |
Correct |
2 ms |
10988 KB |
Output is correct |
37 |
Correct |
2 ms |
10588 KB |
Output is correct |
38 |
Correct |
2 ms |
10588 KB |
Output is correct |
39 |
Correct |
2 ms |
10588 KB |
Output is correct |
40 |
Correct |
2 ms |
10588 KB |
Output is correct |
41 |
Correct |
1 ms |
8540 KB |
Output is correct |
42 |
Correct |
1 ms |
10588 KB |
Output is correct |
43 |
Correct |
2 ms |
10588 KB |
Output is correct |
44 |
Correct |
3 ms |
10588 KB |
Output is correct |
45 |
Correct |
2 ms |
10588 KB |
Output is correct |
46 |
Correct |
2 ms |
10676 KB |
Output is correct |
47 |
Correct |
2 ms |
10808 KB |
Output is correct |
48 |
Correct |
2 ms |
10588 KB |
Output is correct |
49 |
Correct |
3 ms |
10588 KB |
Output is correct |
50 |
Correct |
2 ms |
10588 KB |
Output is correct |
51 |
Correct |
2 ms |
10588 KB |
Output is correct |
52 |
Correct |
2 ms |
10588 KB |
Output is correct |
53 |
Correct |
2 ms |
10588 KB |
Output is correct |
54 |
Correct |
3 ms |
10588 KB |
Output is correct |
55 |
Correct |
2 ms |
10588 KB |
Output is correct |
56 |
Correct |
2 ms |
10588 KB |
Output is correct |
57 |
Correct |
1 ms |
10588 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
10588 KB |
Output is correct |
2 |
Correct |
1 ms |
10588 KB |
Output is correct |
3 |
Correct |
2 ms |
10656 KB |
Output is correct |
4 |
Correct |
2 ms |
10588 KB |
Output is correct |
5 |
Correct |
2 ms |
10588 KB |
Output is correct |
6 |
Correct |
2 ms |
10588 KB |
Output is correct |
7 |
Correct |
2 ms |
10716 KB |
Output is correct |
8 |
Correct |
2 ms |
10588 KB |
Output is correct |
9 |
Correct |
2 ms |
10588 KB |
Output is correct |
10 |
Correct |
2 ms |
10588 KB |
Output is correct |
11 |
Correct |
2 ms |
10588 KB |
Output is correct |
12 |
Correct |
2 ms |
10744 KB |
Output is correct |
13 |
Correct |
2 ms |
10588 KB |
Output is correct |
14 |
Correct |
1 ms |
10588 KB |
Output is correct |
15 |
Correct |
244 ms |
42444 KB |
Output is correct |
16 |
Correct |
240 ms |
42920 KB |
Output is correct |
17 |
Correct |
241 ms |
42288 KB |
Output is correct |
18 |
Correct |
64 ms |
41620 KB |
Output is correct |
19 |
Correct |
250 ms |
41400 KB |
Output is correct |
20 |
Correct |
355 ms |
40920 KB |
Output is correct |
21 |
Correct |
307 ms |
40924 KB |
Output is correct |
22 |
Correct |
355 ms |
41148 KB |
Output is correct |
23 |
Correct |
303 ms |
41220 KB |
Output is correct |
24 |
Correct |
208 ms |
40892 KB |
Output is correct |
25 |
Correct |
2 ms |
10588 KB |
Output is correct |
26 |
Correct |
1 ms |
10588 KB |
Output is correct |
27 |
Correct |
1 ms |
8540 KB |
Output is correct |
28 |
Correct |
2 ms |
10588 KB |
Output is correct |
29 |
Correct |
2 ms |
10588 KB |
Output is correct |
30 |
Correct |
3 ms |
10840 KB |
Output is correct |
31 |
Correct |
2 ms |
10588 KB |
Output is correct |
32 |
Correct |
2 ms |
10588 KB |
Output is correct |
33 |
Correct |
3 ms |
10588 KB |
Output is correct |
34 |
Correct |
2 ms |
10712 KB |
Output is correct |
35 |
Correct |
2 ms |
10588 KB |
Output is correct |
36 |
Correct |
2 ms |
10588 KB |
Output is correct |
37 |
Correct |
2 ms |
10588 KB |
Output is correct |
38 |
Correct |
2 ms |
10588 KB |
Output is correct |
39 |
Correct |
2 ms |
10588 KB |
Output is correct |
40 |
Correct |
2 ms |
10592 KB |
Output is correct |
41 |
Correct |
1 ms |
8544 KB |
Output is correct |
42 |
Correct |
2 ms |
10704 KB |
Output is correct |
43 |
Correct |
2 ms |
10592 KB |
Output is correct |
44 |
Correct |
168 ms |
37440 KB |
Output is correct |
45 |
Correct |
212 ms |
37284 KB |
Output is correct |
46 |
Correct |
123 ms |
37304 KB |
Output is correct |
47 |
Correct |
80 ms |
37172 KB |
Output is correct |
48 |
Correct |
322 ms |
39096 KB |
Output is correct |
49 |
Correct |
378 ms |
41244 KB |
Output is correct |
50 |
Correct |
187 ms |
36748 KB |
Output is correct |
51 |
Correct |
179 ms |
36672 KB |
Output is correct |
52 |
Correct |
188 ms |
37024 KB |
Output is correct |
53 |
Correct |
83 ms |
36792 KB |
Output is correct |
54 |
Correct |
401 ms |
38840 KB |
Output is correct |
55 |
Correct |
266 ms |
38760 KB |
Output is correct |
56 |
Correct |
268 ms |
38792 KB |
Output is correct |
57 |
Correct |
42 ms |
26308 KB |
Output is correct |
58 |
Correct |
54 ms |
30392 KB |
Output is correct |
59 |
Correct |
56 ms |
32696 KB |
Output is correct |
60 |
Correct |
1 ms |
10588 KB |
Output is correct |
61 |
Correct |
1 ms |
10708 KB |
Output is correct |
62 |
Correct |
2 ms |
10588 KB |
Output is correct |
63 |
Correct |
2 ms |
10988 KB |
Output is correct |
64 |
Correct |
2 ms |
10588 KB |
Output is correct |
65 |
Correct |
2 ms |
10588 KB |
Output is correct |
66 |
Correct |
2 ms |
10588 KB |
Output is correct |
67 |
Correct |
2 ms |
10588 KB |
Output is correct |
68 |
Correct |
1 ms |
8540 KB |
Output is correct |
69 |
Correct |
1 ms |
10588 KB |
Output is correct |
70 |
Correct |
2 ms |
10588 KB |
Output is correct |
71 |
Correct |
3 ms |
10588 KB |
Output is correct |
72 |
Correct |
2 ms |
10588 KB |
Output is correct |
73 |
Correct |
181 ms |
36820 KB |
Output is correct |
74 |
Correct |
361 ms |
36792 KB |
Output is correct |
75 |
Correct |
322 ms |
35300 KB |
Output is correct |
76 |
Correct |
349 ms |
35772 KB |
Output is correct |
77 |
Correct |
303 ms |
35256 KB |
Output is correct |
78 |
Correct |
393 ms |
35772 KB |
Output is correct |
79 |
Correct |
1 ms |
10588 KB |
Output is correct |
80 |
Correct |
1 ms |
10588 KB |
Output is correct |
81 |
Correct |
250 ms |
36900 KB |
Output is correct |
82 |
Correct |
258 ms |
36860 KB |
Output is correct |
83 |
Correct |
221 ms |
35244 KB |
Output is correct |
84 |
Correct |
2 ms |
10676 KB |
Output is correct |
85 |
Correct |
2 ms |
10808 KB |
Output is correct |
86 |
Correct |
2 ms |
10588 KB |
Output is correct |
87 |
Correct |
3 ms |
10588 KB |
Output is correct |
88 |
Correct |
2 ms |
10588 KB |
Output is correct |
89 |
Correct |
2 ms |
10588 KB |
Output is correct |
90 |
Correct |
2 ms |
10588 KB |
Output is correct |
91 |
Correct |
2 ms |
10588 KB |
Output is correct |
92 |
Correct |
3 ms |
10588 KB |
Output is correct |
93 |
Correct |
2 ms |
10588 KB |
Output is correct |
94 |
Correct |
2 ms |
10588 KB |
Output is correct |
95 |
Correct |
1 ms |
10588 KB |
Output is correct |
96 |
Correct |
339 ms |
35440 KB |
Output is correct |
97 |
Correct |
456 ms |
35976 KB |
Output is correct |
98 |
Correct |
278 ms |
35944 KB |
Output is correct |
99 |
Correct |
272 ms |
35288 KB |
Output is correct |
100 |
Correct |
359 ms |
43192 KB |
Output is correct |
101 |
Correct |
391 ms |
36900 KB |
Output is correct |
102 |
Correct |
377 ms |
36912 KB |
Output is correct |
103 |
Correct |
561 ms |
35296 KB |
Output is correct |
104 |
Correct |
607 ms |
34316 KB |
Output is correct |
105 |
Correct |
599 ms |
33976 KB |
Output is correct |
106 |
Correct |
432 ms |
33600 KB |
Output is correct |