#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
struct SmartFenwick {
vector<ll> k, b;
int n{};
void init(int x) {
n = x;
k.resize(x + 1), b.resize(x + 1);
}
void addk(int i, ll v) {
for (int x = i + 1; x <= n; x += x & -x) {
k[x] += v;
}
}
void addb(int i, ll v) {
for (int x = i + 1; x <= n; x += x & -x) {
b[x] += v;
}
}
void rangeAdd(int l, int r, ll v) {
addk(l, v);
addk(r, -v);
addb(l, (l - 1) * -v);
addb(r, (r - 1) * v);
}
ll sum(int i) {
ll K = 0, B = 0;
for (int x = i + 1; x > 0; x -= x & -x) {
K += k[x], B += b[x];
}
return B + K * i;
}
ll rangeSum(int l, int r) {
return sum(r - 1) - sum(l - 1);
}
} t[2][2]; // (left/right), (L/R)
struct Query {
int l, r, block, idx;
bool operator<(Query oth) const {
if (oth.block != block) {
return block < oth.block;
}
return (block & 1) ? r > oth.r : r < oth.r;
}
};
constexpr int B = 1337;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, q;
cin >> n >> q;
vector<int> a(n);
for (int i = 0; i < n; ++i) {
cin >> a[i];
}
vector<int> yy = a;
sort(yy.begin(), yy.end());
yy.resize(unique(yy.begin(), yy.end()) - yy.begin());
for (int &x: a) {
x = lower_bound(yy.begin(), yy.end(), x) - yy.begin();
}
const int m = yy.size();
vector<Query> queries(q);
vector<ll> answer(q);
for (int i = 0; i < q; ++i) {
int l, r;
cin >> l >> r;
l -= 1;
queries[i].l = l, queries[i].r = r, queries[i].block = l / B, queries[i].idx = i;
}
sort(queries.begin(), queries.end());
vector<int> head(n + 1);
for (int i = 1; i <= n; ++i) {
head[i] = m;
}
vector<int> pos(m), cnt(m), ord(m);
iota(pos.begin(), pos.end(), 0);
ord = pos;
int siz[2]{(m + 1) / 2, m / 2};
t[0][0].init(siz[0]);
t[0][1].init(siz[0]);
t[1][0].init(siz[1]);
t[1][1].init(siz[1]);
ll ans = 0;
int len = 0;
auto eval = [&](int i) {
return 1LL * cnt[i] * (len - cnt[i]) + 1LL * (cnt[i] + 1) * cnt[i] / 2;
};
auto increase = [&](int i) {
ans += len;
len += 1;
ans -= eval(i);
int p = pos[i];
int tail = head[cnt[i] + 1] - 1;
if (p != tail) {
int id = ord[tail];
pos[id] = p;
ord[p] = id;
pos[i] = tail;
ord[tail] = i;
p = tail;
}
int side = p % 2;
int s = p / 2;
ans += t[side][side ^ 1].rangeSum(s + 1, siz[side]);
t[side][side].rangeAdd(s + 1, siz[side], 1);
t[side][side ^ 1].rangeAdd(0, s, 1);
ans += t[side][side].rangeSum(0, s);
ans += t[side ^ 1][side ^ 1].rangeSum(0, siz[side ^ 1]);
t[side ^ 1][side].rangeAdd(0, siz[side ^ 1], 1);
cnt[i] += 1;
head[cnt[i]] = p;
ans += eval(i);
};
auto decrease = [&](int i) {
ans -= len;
len -= 1;
ans -= eval(i);
int p = pos[i];
int start = head[cnt[i]];
if (p != start) {
int id = ord[start];
pos[id] = p;
ord[p] = id;
pos[i] = start;
ord[start] = i;
p = start;
}
int side = p % 2;
int s = p / 2;
ans -= t[side][side ^ 1].rangeSum(s + 1, siz[side]);
t[side][side].rangeAdd(s + 1, siz[side], -1);
t[side][side ^ 1].rangeAdd(0, s, -1);
ans -= t[side][side].rangeSum(0, s);
ans -= t[side ^ 1][side ^ 1].rangeSum(0, siz[side ^ 1]);
t[side ^ 1][side].rangeAdd(0, siz[side ^ 1], -1);
head[cnt[i]] = p + 1;
cnt[i] -= 1;
ans += eval(i);
};
int lx = 0, rx = 0;
for (auto [l, r, bl, i] : queries) {
while (rx < r) {
increase(a[rx++]);
}
while (lx > l) {
increase(a[--lx]);
}
while (lx < l) {
decrease(a[lx++]);
}
while (rx > r) {
decrease(a[--rx]);
}
answer[i] = ans;
}
for (int i = 0; i < q; ++i) {
cout << answer[i] << '\n';
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
288 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
2 ms |
340 KB |
Output is correct |
4 |
Correct |
15 ms |
1492 KB |
Output is correct |
5 |
Correct |
25 ms |
2692 KB |
Output is correct |
6 |
Correct |
41 ms |
3832 KB |
Output is correct |
7 |
Correct |
38 ms |
3808 KB |
Output is correct |
8 |
Correct |
42 ms |
3828 KB |
Output is correct |
9 |
Correct |
45 ms |
3944 KB |
Output is correct |
10 |
Correct |
41 ms |
3832 KB |
Output is correct |
11 |
Correct |
42 ms |
3796 KB |
Output is correct |
12 |
Correct |
43 ms |
3796 KB |
Output is correct |
13 |
Correct |
46 ms |
3812 KB |
Output is correct |
14 |
Correct |
40 ms |
3828 KB |
Output is correct |
15 |
Correct |
42 ms |
3844 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
2 ms |
340 KB |
Output is correct |
4 |
Correct |
15 ms |
1492 KB |
Output is correct |
5 |
Correct |
25 ms |
2692 KB |
Output is correct |
6 |
Correct |
41 ms |
3832 KB |
Output is correct |
7 |
Correct |
38 ms |
3808 KB |
Output is correct |
8 |
Correct |
42 ms |
3828 KB |
Output is correct |
9 |
Correct |
45 ms |
3944 KB |
Output is correct |
10 |
Correct |
41 ms |
3832 KB |
Output is correct |
11 |
Correct |
42 ms |
3796 KB |
Output is correct |
12 |
Correct |
43 ms |
3796 KB |
Output is correct |
13 |
Correct |
46 ms |
3812 KB |
Output is correct |
14 |
Correct |
40 ms |
3828 KB |
Output is correct |
15 |
Correct |
42 ms |
3844 KB |
Output is correct |
16 |
Correct |
0 ms |
212 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Correct |
2 ms |
340 KB |
Output is correct |
19 |
Correct |
16 ms |
1500 KB |
Output is correct |
20 |
Correct |
32 ms |
2652 KB |
Output is correct |
21 |
Correct |
47 ms |
3804 KB |
Output is correct |
22 |
Correct |
49 ms |
3800 KB |
Output is correct |
23 |
Correct |
53 ms |
3768 KB |
Output is correct |
24 |
Correct |
51 ms |
3936 KB |
Output is correct |
25 |
Correct |
49 ms |
3808 KB |
Output is correct |
26 |
Correct |
50 ms |
3784 KB |
Output is correct |
27 |
Correct |
49 ms |
3824 KB |
Output is correct |
28 |
Correct |
47 ms |
3828 KB |
Output is correct |
29 |
Correct |
48 ms |
3804 KB |
Output is correct |
30 |
Correct |
50 ms |
3804 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
2 ms |
340 KB |
Output is correct |
4 |
Correct |
15 ms |
1492 KB |
Output is correct |
5 |
Correct |
25 ms |
2692 KB |
Output is correct |
6 |
Correct |
41 ms |
3832 KB |
Output is correct |
7 |
Correct |
38 ms |
3808 KB |
Output is correct |
8 |
Correct |
42 ms |
3828 KB |
Output is correct |
9 |
Correct |
45 ms |
3944 KB |
Output is correct |
10 |
Correct |
41 ms |
3832 KB |
Output is correct |
11 |
Correct |
42 ms |
3796 KB |
Output is correct |
12 |
Correct |
43 ms |
3796 KB |
Output is correct |
13 |
Correct |
46 ms |
3812 KB |
Output is correct |
14 |
Correct |
40 ms |
3828 KB |
Output is correct |
15 |
Correct |
42 ms |
3844 KB |
Output is correct |
16 |
Correct |
0 ms |
212 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Correct |
2 ms |
340 KB |
Output is correct |
19 |
Correct |
16 ms |
1500 KB |
Output is correct |
20 |
Correct |
32 ms |
2652 KB |
Output is correct |
21 |
Correct |
47 ms |
3804 KB |
Output is correct |
22 |
Correct |
49 ms |
3800 KB |
Output is correct |
23 |
Correct |
53 ms |
3768 KB |
Output is correct |
24 |
Correct |
51 ms |
3936 KB |
Output is correct |
25 |
Correct |
49 ms |
3808 KB |
Output is correct |
26 |
Correct |
50 ms |
3784 KB |
Output is correct |
27 |
Correct |
49 ms |
3824 KB |
Output is correct |
28 |
Correct |
47 ms |
3828 KB |
Output is correct |
29 |
Correct |
48 ms |
3804 KB |
Output is correct |
30 |
Correct |
50 ms |
3804 KB |
Output is correct |
31 |
Correct |
0 ms |
212 KB |
Output is correct |
32 |
Correct |
0 ms |
212 KB |
Output is correct |
33 |
Correct |
1 ms |
340 KB |
Output is correct |
34 |
Correct |
2 ms |
340 KB |
Output is correct |
35 |
Correct |
3 ms |
468 KB |
Output is correct |
36 |
Correct |
3 ms |
468 KB |
Output is correct |
37 |
Correct |
13 ms |
912 KB |
Output is correct |
38 |
Correct |
13 ms |
852 KB |
Output is correct |
39 |
Correct |
26 ms |
1500 KB |
Output is correct |
40 |
Correct |
55 ms |
2712 KB |
Output is correct |
41 |
Correct |
80 ms |
3804 KB |
Output is correct |
42 |
Correct |
78 ms |
3824 KB |
Output is correct |
43 |
Correct |
81 ms |
3824 KB |
Output is correct |
44 |
Correct |
80 ms |
3808 KB |
Output is correct |
45 |
Correct |
78 ms |
3816 KB |
Output is correct |
46 |
Correct |
78 ms |
3804 KB |
Output is correct |
47 |
Correct |
79 ms |
3880 KB |
Output is correct |
48 |
Correct |
84 ms |
3788 KB |
Output is correct |
49 |
Correct |
79 ms |
3808 KB |
Output is correct |
50 |
Correct |
79 ms |
3824 KB |
Output is correct |
51 |
Correct |
78 ms |
3808 KB |
Output is correct |
52 |
Correct |
80 ms |
3808 KB |
Output is correct |
53 |
Correct |
78 ms |
3812 KB |
Output is correct |
54 |
Correct |
78 ms |
3824 KB |
Output is correct |
55 |
Correct |
79 ms |
3880 KB |
Output is correct |
56 |
Correct |
79 ms |
3824 KB |
Output is correct |
57 |
Correct |
78 ms |
3820 KB |
Output is correct |
58 |
Correct |
78 ms |
3824 KB |
Output is correct |
59 |
Correct |
81 ms |
3880 KB |
Output is correct |
60 |
Correct |
78 ms |
3812 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
288 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
2 ms |
340 KB |
Output is correct |
14 |
Correct |
15 ms |
1492 KB |
Output is correct |
15 |
Correct |
25 ms |
2692 KB |
Output is correct |
16 |
Correct |
41 ms |
3832 KB |
Output is correct |
17 |
Correct |
38 ms |
3808 KB |
Output is correct |
18 |
Correct |
42 ms |
3828 KB |
Output is correct |
19 |
Correct |
45 ms |
3944 KB |
Output is correct |
20 |
Correct |
41 ms |
3832 KB |
Output is correct |
21 |
Correct |
42 ms |
3796 KB |
Output is correct |
22 |
Correct |
43 ms |
3796 KB |
Output is correct |
23 |
Correct |
46 ms |
3812 KB |
Output is correct |
24 |
Correct |
40 ms |
3828 KB |
Output is correct |
25 |
Correct |
42 ms |
3844 KB |
Output is correct |
26 |
Correct |
0 ms |
212 KB |
Output is correct |
27 |
Correct |
0 ms |
212 KB |
Output is correct |
28 |
Correct |
2 ms |
340 KB |
Output is correct |
29 |
Correct |
16 ms |
1500 KB |
Output is correct |
30 |
Correct |
32 ms |
2652 KB |
Output is correct |
31 |
Correct |
47 ms |
3804 KB |
Output is correct |
32 |
Correct |
49 ms |
3800 KB |
Output is correct |
33 |
Correct |
53 ms |
3768 KB |
Output is correct |
34 |
Correct |
51 ms |
3936 KB |
Output is correct |
35 |
Correct |
49 ms |
3808 KB |
Output is correct |
36 |
Correct |
50 ms |
3784 KB |
Output is correct |
37 |
Correct |
49 ms |
3824 KB |
Output is correct |
38 |
Correct |
47 ms |
3828 KB |
Output is correct |
39 |
Correct |
48 ms |
3804 KB |
Output is correct |
40 |
Correct |
50 ms |
3804 KB |
Output is correct |
41 |
Correct |
0 ms |
212 KB |
Output is correct |
42 |
Correct |
0 ms |
212 KB |
Output is correct |
43 |
Correct |
1 ms |
340 KB |
Output is correct |
44 |
Correct |
2 ms |
340 KB |
Output is correct |
45 |
Correct |
3 ms |
468 KB |
Output is correct |
46 |
Correct |
3 ms |
468 KB |
Output is correct |
47 |
Correct |
13 ms |
912 KB |
Output is correct |
48 |
Correct |
13 ms |
852 KB |
Output is correct |
49 |
Correct |
26 ms |
1500 KB |
Output is correct |
50 |
Correct |
55 ms |
2712 KB |
Output is correct |
51 |
Correct |
80 ms |
3804 KB |
Output is correct |
52 |
Correct |
78 ms |
3824 KB |
Output is correct |
53 |
Correct |
81 ms |
3824 KB |
Output is correct |
54 |
Correct |
80 ms |
3808 KB |
Output is correct |
55 |
Correct |
78 ms |
3816 KB |
Output is correct |
56 |
Correct |
78 ms |
3804 KB |
Output is correct |
57 |
Correct |
79 ms |
3880 KB |
Output is correct |
58 |
Correct |
84 ms |
3788 KB |
Output is correct |
59 |
Correct |
79 ms |
3808 KB |
Output is correct |
60 |
Correct |
79 ms |
3824 KB |
Output is correct |
61 |
Correct |
78 ms |
3808 KB |
Output is correct |
62 |
Correct |
80 ms |
3808 KB |
Output is correct |
63 |
Correct |
78 ms |
3812 KB |
Output is correct |
64 |
Correct |
78 ms |
3824 KB |
Output is correct |
65 |
Correct |
79 ms |
3880 KB |
Output is correct |
66 |
Correct |
79 ms |
3824 KB |
Output is correct |
67 |
Correct |
78 ms |
3820 KB |
Output is correct |
68 |
Correct |
78 ms |
3824 KB |
Output is correct |
69 |
Correct |
81 ms |
3880 KB |
Output is correct |
70 |
Correct |
78 ms |
3812 KB |
Output is correct |
71 |
Correct |
15 ms |
980 KB |
Output is correct |
72 |
Correct |
15 ms |
980 KB |
Output is correct |
73 |
Correct |
15 ms |
980 KB |
Output is correct |
74 |
Correct |
15 ms |
980 KB |
Output is correct |
75 |
Correct |
16 ms |
1004 KB |
Output is correct |
76 |
Correct |
32 ms |
1632 KB |
Output is correct |
77 |
Correct |
32 ms |
1632 KB |
Output is correct |
78 |
Correct |
33 ms |
1628 KB |
Output is correct |
79 |
Correct |
32 ms |
1620 KB |
Output is correct |
80 |
Correct |
32 ms |
1636 KB |
Output is correct |
81 |
Correct |
68 ms |
3044 KB |
Output is correct |
82 |
Correct |
68 ms |
3092 KB |
Output is correct |
83 |
Correct |
71 ms |
3032 KB |
Output is correct |
84 |
Correct |
68 ms |
3052 KB |
Output is correct |
85 |
Correct |
68 ms |
3052 KB |
Output is correct |
86 |
Correct |
75 ms |
3416 KB |
Output is correct |
87 |
Correct |
75 ms |
3404 KB |
Output is correct |
88 |
Correct |
75 ms |
3408 KB |
Output is correct |
89 |
Correct |
77 ms |
3416 KB |
Output is correct |
90 |
Correct |
79 ms |
3416 KB |
Output is correct |
91 |
Correct |
181 ms |
8152 KB |
Output is correct |
92 |
Correct |
174 ms |
8140 KB |
Output is correct |
93 |
Correct |
184 ms |
8172 KB |
Output is correct |
94 |
Correct |
183 ms |
8040 KB |
Output is correct |
95 |
Correct |
175 ms |
8268 KB |
Output is correct |
96 |
Correct |
222 ms |
12376 KB |
Output is correct |
97 |
Correct |
217 ms |
12600 KB |
Output is correct |
98 |
Correct |
224 ms |
12368 KB |
Output is correct |
99 |
Correct |
221 ms |
12476 KB |
Output is correct |
100 |
Correct |
216 ms |
12492 KB |
Output is correct |
101 |
Correct |
231 ms |
12388 KB |
Output is correct |
102 |
Correct |
227 ms |
12388 KB |
Output is correct |
103 |
Correct |
222 ms |
12376 KB |
Output is correct |
104 |
Correct |
226 ms |
12480 KB |
Output is correct |
105 |
Correct |
228 ms |
12512 KB |
Output is correct |
106 |
Correct |
224 ms |
14564 KB |
Output is correct |
107 |
Correct |
223 ms |
14540 KB |
Output is correct |
108 |
Correct |
225 ms |
14640 KB |
Output is correct |
109 |
Correct |
228 ms |
14540 KB |
Output is correct |
110 |
Correct |
228 ms |
14556 KB |
Output is correct |
111 |
Correct |
225 ms |
14640 KB |
Output is correct |
112 |
Correct |
221 ms |
14636 KB |
Output is correct |
113 |
Correct |
221 ms |
14636 KB |
Output is correct |
114 |
Correct |
225 ms |
14632 KB |
Output is correct |
115 |
Correct |
229 ms |
14684 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
288 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
2 ms |
340 KB |
Output is correct |
14 |
Correct |
15 ms |
1492 KB |
Output is correct |
15 |
Correct |
25 ms |
2692 KB |
Output is correct |
16 |
Correct |
41 ms |
3832 KB |
Output is correct |
17 |
Correct |
38 ms |
3808 KB |
Output is correct |
18 |
Correct |
42 ms |
3828 KB |
Output is correct |
19 |
Correct |
45 ms |
3944 KB |
Output is correct |
20 |
Correct |
41 ms |
3832 KB |
Output is correct |
21 |
Correct |
42 ms |
3796 KB |
Output is correct |
22 |
Correct |
43 ms |
3796 KB |
Output is correct |
23 |
Correct |
46 ms |
3812 KB |
Output is correct |
24 |
Correct |
40 ms |
3828 KB |
Output is correct |
25 |
Correct |
42 ms |
3844 KB |
Output is correct |
26 |
Correct |
0 ms |
212 KB |
Output is correct |
27 |
Correct |
0 ms |
212 KB |
Output is correct |
28 |
Correct |
2 ms |
340 KB |
Output is correct |
29 |
Correct |
16 ms |
1500 KB |
Output is correct |
30 |
Correct |
32 ms |
2652 KB |
Output is correct |
31 |
Correct |
47 ms |
3804 KB |
Output is correct |
32 |
Correct |
49 ms |
3800 KB |
Output is correct |
33 |
Correct |
53 ms |
3768 KB |
Output is correct |
34 |
Correct |
51 ms |
3936 KB |
Output is correct |
35 |
Correct |
49 ms |
3808 KB |
Output is correct |
36 |
Correct |
50 ms |
3784 KB |
Output is correct |
37 |
Correct |
49 ms |
3824 KB |
Output is correct |
38 |
Correct |
47 ms |
3828 KB |
Output is correct |
39 |
Correct |
48 ms |
3804 KB |
Output is correct |
40 |
Correct |
50 ms |
3804 KB |
Output is correct |
41 |
Correct |
0 ms |
212 KB |
Output is correct |
42 |
Correct |
0 ms |
212 KB |
Output is correct |
43 |
Correct |
1 ms |
340 KB |
Output is correct |
44 |
Correct |
2 ms |
340 KB |
Output is correct |
45 |
Correct |
3 ms |
468 KB |
Output is correct |
46 |
Correct |
3 ms |
468 KB |
Output is correct |
47 |
Correct |
13 ms |
912 KB |
Output is correct |
48 |
Correct |
13 ms |
852 KB |
Output is correct |
49 |
Correct |
26 ms |
1500 KB |
Output is correct |
50 |
Correct |
55 ms |
2712 KB |
Output is correct |
51 |
Correct |
80 ms |
3804 KB |
Output is correct |
52 |
Correct |
78 ms |
3824 KB |
Output is correct |
53 |
Correct |
81 ms |
3824 KB |
Output is correct |
54 |
Correct |
80 ms |
3808 KB |
Output is correct |
55 |
Correct |
78 ms |
3816 KB |
Output is correct |
56 |
Correct |
78 ms |
3804 KB |
Output is correct |
57 |
Correct |
79 ms |
3880 KB |
Output is correct |
58 |
Correct |
84 ms |
3788 KB |
Output is correct |
59 |
Correct |
79 ms |
3808 KB |
Output is correct |
60 |
Correct |
79 ms |
3824 KB |
Output is correct |
61 |
Correct |
78 ms |
3808 KB |
Output is correct |
62 |
Correct |
80 ms |
3808 KB |
Output is correct |
63 |
Correct |
78 ms |
3812 KB |
Output is correct |
64 |
Correct |
78 ms |
3824 KB |
Output is correct |
65 |
Correct |
79 ms |
3880 KB |
Output is correct |
66 |
Correct |
79 ms |
3824 KB |
Output is correct |
67 |
Correct |
78 ms |
3820 KB |
Output is correct |
68 |
Correct |
78 ms |
3824 KB |
Output is correct |
69 |
Correct |
81 ms |
3880 KB |
Output is correct |
70 |
Correct |
78 ms |
3812 KB |
Output is correct |
71 |
Correct |
15 ms |
980 KB |
Output is correct |
72 |
Correct |
15 ms |
980 KB |
Output is correct |
73 |
Correct |
15 ms |
980 KB |
Output is correct |
74 |
Correct |
15 ms |
980 KB |
Output is correct |
75 |
Correct |
16 ms |
1004 KB |
Output is correct |
76 |
Correct |
32 ms |
1632 KB |
Output is correct |
77 |
Correct |
32 ms |
1632 KB |
Output is correct |
78 |
Correct |
33 ms |
1628 KB |
Output is correct |
79 |
Correct |
32 ms |
1620 KB |
Output is correct |
80 |
Correct |
32 ms |
1636 KB |
Output is correct |
81 |
Correct |
68 ms |
3044 KB |
Output is correct |
82 |
Correct |
68 ms |
3092 KB |
Output is correct |
83 |
Correct |
71 ms |
3032 KB |
Output is correct |
84 |
Correct |
68 ms |
3052 KB |
Output is correct |
85 |
Correct |
68 ms |
3052 KB |
Output is correct |
86 |
Correct |
75 ms |
3416 KB |
Output is correct |
87 |
Correct |
75 ms |
3404 KB |
Output is correct |
88 |
Correct |
75 ms |
3408 KB |
Output is correct |
89 |
Correct |
77 ms |
3416 KB |
Output is correct |
90 |
Correct |
79 ms |
3416 KB |
Output is correct |
91 |
Correct |
181 ms |
8152 KB |
Output is correct |
92 |
Correct |
174 ms |
8140 KB |
Output is correct |
93 |
Correct |
184 ms |
8172 KB |
Output is correct |
94 |
Correct |
183 ms |
8040 KB |
Output is correct |
95 |
Correct |
175 ms |
8268 KB |
Output is correct |
96 |
Correct |
222 ms |
12376 KB |
Output is correct |
97 |
Correct |
217 ms |
12600 KB |
Output is correct |
98 |
Correct |
224 ms |
12368 KB |
Output is correct |
99 |
Correct |
221 ms |
12476 KB |
Output is correct |
100 |
Correct |
216 ms |
12492 KB |
Output is correct |
101 |
Correct |
231 ms |
12388 KB |
Output is correct |
102 |
Correct |
227 ms |
12388 KB |
Output is correct |
103 |
Correct |
222 ms |
12376 KB |
Output is correct |
104 |
Correct |
226 ms |
12480 KB |
Output is correct |
105 |
Correct |
228 ms |
12512 KB |
Output is correct |
106 |
Correct |
224 ms |
14564 KB |
Output is correct |
107 |
Correct |
223 ms |
14540 KB |
Output is correct |
108 |
Correct |
225 ms |
14640 KB |
Output is correct |
109 |
Correct |
228 ms |
14540 KB |
Output is correct |
110 |
Correct |
228 ms |
14556 KB |
Output is correct |
111 |
Correct |
225 ms |
14640 KB |
Output is correct |
112 |
Correct |
221 ms |
14636 KB |
Output is correct |
113 |
Correct |
221 ms |
14636 KB |
Output is correct |
114 |
Correct |
225 ms |
14632 KB |
Output is correct |
115 |
Correct |
229 ms |
14684 KB |
Output is correct |
116 |
Correct |
1336 ms |
1992 KB |
Output is correct |
117 |
Correct |
1513 ms |
2000 KB |
Output is correct |
118 |
Correct |
1623 ms |
2588 KB |
Output is correct |
119 |
Correct |
2093 ms |
2596 KB |
Output is correct |
120 |
Correct |
2343 ms |
2764 KB |
Output is correct |
121 |
Correct |
2605 ms |
3224 KB |
Output is correct |
122 |
Correct |
2871 ms |
3268 KB |
Output is correct |
123 |
Correct |
3955 ms |
4528 KB |
Output is correct |
124 |
Correct |
4792 ms |
4708 KB |
Output is correct |
125 |
Correct |
5264 ms |
4916 KB |
Output is correct |
126 |
Correct |
4929 ms |
5540 KB |
Output is correct |
127 |
Correct |
4926 ms |
5536 KB |
Output is correct |
128 |
Correct |
4813 ms |
5536 KB |
Output is correct |
129 |
Correct |
4858 ms |
5576 KB |
Output is correct |
130 |
Correct |
4851 ms |
5532 KB |
Output is correct |
131 |
Correct |
5063 ms |
5668 KB |
Output is correct |
132 |
Correct |
5042 ms |
5668 KB |
Output is correct |
133 |
Correct |
5029 ms |
5676 KB |
Output is correct |
134 |
Correct |
5028 ms |
5672 KB |
Output is correct |
135 |
Correct |
5031 ms |
5672 KB |
Output is correct |
136 |
Correct |
5067 ms |
5672 KB |
Output is correct |
137 |
Correct |
5046 ms |
5672 KB |
Output is correct |
138 |
Correct |
5009 ms |
5672 KB |
Output is correct |
139 |
Correct |
4989 ms |
5668 KB |
Output is correct |
140 |
Correct |
4996 ms |
5688 KB |
Output is correct |
141 |
Correct |
5663 ms |
5700 KB |
Output is correct |
142 |
Correct |
5660 ms |
5696 KB |
Output is correct |
143 |
Correct |
5676 ms |
5696 KB |
Output is correct |
144 |
Correct |
5681 ms |
5696 KB |
Output is correct |
145 |
Correct |
5725 ms |
5712 KB |
Output is correct |
146 |
Execution timed out |
7030 ms |
5872 KB |
Time limit exceeded |
147 |
Halted |
0 ms |
0 KB |
- |