#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define int ll
const int nmax = 3e5 + 5;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//mt19937 rng(2);
int n, q;
int absol(int x) { return (x >= 0? x : -x);}
namespace Treap {
struct Node {
Node *l, *r;
int area, pri;
int ind() { return l -> area + 1; }
int val, sum;
bool lazy;
ll intl, intr; // left : e mai mic in left
}*nil = new Node{0, 0, 0, -1, 0, 0, 0, 0, 0};
using ns = Node*;
struct pns { ns l, r; };
void prop(ns& node) {
if(node == nil)
return;
if(node -> lazy == 1) {
swap(node -> l, node -> r);
swap(node -> intl, node -> intr);
node -> l -> lazy ^= 1;
node -> r -> lazy ^= 1;
node -> lazy = 0;
}
return;
}
ns updnode(ns node, ns x, int w) {
if(node == nil)
return nil;
(w == 1? node -> r : node -> l) = x;
prop(node);
prop(node -> l);
prop(node -> r);
node -> area = 1 + node -> l -> area + node -> r -> area;
node -> sum = node -> val + node -> l -> sum + node -> r -> sum;
node -> intl = node -> l -> intl + (ll)(node -> r -> sum + node -> val) * (node -> ind()) + node -> r -> intl;
node -> intr = node -> r -> intr + (ll)(node -> l -> sum + node -> val) * (node -> r -> area + 1) + node -> l -> intr;
return node;
}
pns split(ns node, int val) {
prop(node);
pns temp;
return node == nil? pns{nil, nil}:
node -> area <= val? pns{node, nil}:
val == 0? pns{nil, node}:
node -> ind() <= val? (temp = split(node -> r, val - node ->ind()), temp.l = updnode(node, temp.l, 1), temp):
(temp = split(node -> l, val), temp.r = updnode(node, temp.r, 0), temp);
}
ns merge(ns l, ns r) {
prop(l);
prop(r);
return l == nil? r:
r == nil? l:
l -> pri < r -> pri? updnode(r, merge(l, r -> l), 0):
updnode(l, merge(l -> r, r), 1);
}
void print(ns node) {
}
ns parity[2] = {nil, nil};
void flip(ns& root) {
root -> lazy ^= 1;
prop(root);
}
void append(ns& root) { root = merge(new Node{nil, nil, 1, rng(), 0, 0, 0, 0, 0}, root);}
void pop(ns& root) { pns temp = split(root, 1); root = temp.r; }
ll modify(ns& root, int poz, int with) {
int how = (root == parity[0]? 1 : 0);
poz++;
poz = (root == parity[0]? poz : root -> area - poz + 1);
pns temp[2];
temp[0] = split(root, poz - 1);
temp[1] = split(temp[0].r, 1);
temp[1].l -> val += with;
temp[1].l -> sum += with;
temp[1].l -> intl += with;
temp[1].l -> intr += with;
ll modifier = temp[1].r -> intl + temp[0].l -> intr;
root = merge(temp[0].l, merge(temp[1].l, temp[1].r));
poz = (how == 1? root -> area - poz : poz - 1);
if(how == 1) modifier += parity[how] -> intl;
else modifier += parity[how] -> intr;
modifier += (ll)parity[how] -> sum * poz;
modifier *= with;
return modifier;
}
}
using namespace Treap;
int buck;
int v[nmax];
struct Query {
int l, r, ind;
bool operator <(const Query& other) const {
return (l / buck < other.l / buck || (l / buck == other.l / buck && r < other.r));
}
};
namespace Mo {
deque<int> sorted;
deque<int> vals;
int freq[nmax];
int atrindex[nmax];
ll total, comb, sum, sqsum;
void add(int x) {
x = v[x];
//cerr <<x << '\n';
int it;
if(freq[x] == 0) {
flip(parity[0]);
flip(parity[1]);
swap(parity[0], parity[1]);
append(parity[0]);
it = 0;
atrindex[x] = sorted.size();
sorted.push_front(0);
vals.push_front(x);
}
else {
it = prev(upper_bound(sorted.begin(), sorted.end(), sorted.rbegin()[atrindex[x]])) - sorted.begin();
int otr = vals[it];
swap(atrindex[x], atrindex[otr]);
swap(vals.rbegin()[atrindex[x]], vals.rbegin()[atrindex[otr]]);
}
auto temp = modify(parity[it % 2], it / 2, 1);
total += temp;
sorted[it]++;
sqsum += freq[x] * 2 + 1;
sum++;
freq[x]++;
comb += freq[x];
}
void erase(int x) {
x = v[x];
int it;
it = lower_bound(sorted.begin(), sorted.end(), sorted.rbegin()[atrindex[x]]) - sorted.begin();
int otr = vals[it];
swap(atrindex[x], atrindex[otr]);
swap(vals.rbegin()[atrindex[x]], vals.rbegin()[atrindex[otr]]);
total += modify(parity[it % 2], it / 2, -1);
sorted[it]--;
comb -= freq[x];
freq[x]--;
sum--;
sqsum -= freq[x] * 2 + 1;
if(freq[x] == 0) {
pop(parity[0]);
flip(parity[0]);
flip(parity[1]);
swap(parity[0], parity[1]);
sorted.pop_front();
vals.pop_front();
atrindex[x] = 0;
}
return;
}
ll query() {
//cerr << total << ' ' << comb << ' ' << sum << ' ' << sqsum << '\n';
return total + comb + (sum * sum - sqsum) / 2;
}
}
signed main() {
cin >> n >> q;
buck = max(1.0, sqrt((ll) n * n / q));
for(int i = 1; i <= n; i++)
cin >> v[i];
vector<int> rez(q);
vector<Query> qs(q);
int cnt = 0;
for(auto &[l, r, ind] : qs) {
cin >> l >> r;
ind = cnt++;
}
sort(qs.begin(), qs.end());
int lastl = 1, lastr = 0;
for(auto [l, r, ind] : qs) {
while(lastr < r)
Mo::add(++lastr);
while(lastl > l)
Mo::add(--lastl);
while(lastl < l)
Mo::erase(lastl++);
while(lastr > r)
Mo::erase(lastr--);
//cerr << lastr << ' ' << lastl << '\n';
rez[ind] = Mo::query();
//if(ind % 500 == 213)
//cerr << "amog\n";
}
//cerr << "unamog\n";
for(auto x : rez)
cout << x << '\n';
}
// TLE my beloved
Compilation message
diversity.cpp: In function 'void Treap::append(Treap::Node*&)':
diversity.cpp:76:65: warning: narrowing conversion of 'rng.std::mersenne_twister_engine<long unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253>::operator()()' from 'std::mersenne_twister_engine<long unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253>::result_type' {aka 'long unsigned int'} to 'll' {aka 'long long int'} [-Wnarrowing]
76 | void append(ns& root) { root = merge(new Node{nil, nil, 1, rng(), 0, 0, 0, 0, 0}, root);}
| ~~~^~
diversity.cpp: In function 'int main()':
diversity.cpp:191:13: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
191 | for(auto &[l, r, ind] : qs) {
| ^
diversity.cpp:198:12: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
198 | for(auto [l, r, ind] : qs) {
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
316 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
0 ms |
320 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
3 ms |
392 KB |
Output is correct |
4 |
Correct |
27 ms |
1296 KB |
Output is correct |
5 |
Correct |
50 ms |
2252 KB |
Output is correct |
6 |
Correct |
92 ms |
3032 KB |
Output is correct |
7 |
Correct |
76 ms |
3004 KB |
Output is correct |
8 |
Correct |
80 ms |
2940 KB |
Output is correct |
9 |
Correct |
90 ms |
3032 KB |
Output is correct |
10 |
Correct |
101 ms |
2960 KB |
Output is correct |
11 |
Correct |
93 ms |
2960 KB |
Output is correct |
12 |
Correct |
89 ms |
3036 KB |
Output is correct |
13 |
Correct |
82 ms |
3032 KB |
Output is correct |
14 |
Correct |
90 ms |
3036 KB |
Output is correct |
15 |
Correct |
86 ms |
3016 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
3 ms |
392 KB |
Output is correct |
4 |
Correct |
27 ms |
1296 KB |
Output is correct |
5 |
Correct |
50 ms |
2252 KB |
Output is correct |
6 |
Correct |
92 ms |
3032 KB |
Output is correct |
7 |
Correct |
76 ms |
3004 KB |
Output is correct |
8 |
Correct |
80 ms |
2940 KB |
Output is correct |
9 |
Correct |
90 ms |
3032 KB |
Output is correct |
10 |
Correct |
101 ms |
2960 KB |
Output is correct |
11 |
Correct |
93 ms |
2960 KB |
Output is correct |
12 |
Correct |
89 ms |
3036 KB |
Output is correct |
13 |
Correct |
82 ms |
3032 KB |
Output is correct |
14 |
Correct |
90 ms |
3036 KB |
Output is correct |
15 |
Correct |
86 ms |
3016 KB |
Output is correct |
16 |
Correct |
1 ms |
324 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Correct |
4 ms |
340 KB |
Output is correct |
19 |
Correct |
32 ms |
1312 KB |
Output is correct |
20 |
Correct |
74 ms |
2376 KB |
Output is correct |
21 |
Correct |
118 ms |
3020 KB |
Output is correct |
22 |
Correct |
109 ms |
3040 KB |
Output is correct |
23 |
Correct |
99 ms |
3036 KB |
Output is correct |
24 |
Correct |
106 ms |
3020 KB |
Output is correct |
25 |
Correct |
103 ms |
2964 KB |
Output is correct |
26 |
Correct |
110 ms |
3020 KB |
Output is correct |
27 |
Correct |
106 ms |
3012 KB |
Output is correct |
28 |
Correct |
99 ms |
2972 KB |
Output is correct |
29 |
Correct |
99 ms |
3036 KB |
Output is correct |
30 |
Correct |
128 ms |
3036 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
3 ms |
392 KB |
Output is correct |
4 |
Correct |
27 ms |
1296 KB |
Output is correct |
5 |
Correct |
50 ms |
2252 KB |
Output is correct |
6 |
Correct |
92 ms |
3032 KB |
Output is correct |
7 |
Correct |
76 ms |
3004 KB |
Output is correct |
8 |
Correct |
80 ms |
2940 KB |
Output is correct |
9 |
Correct |
90 ms |
3032 KB |
Output is correct |
10 |
Correct |
101 ms |
2960 KB |
Output is correct |
11 |
Correct |
93 ms |
2960 KB |
Output is correct |
12 |
Correct |
89 ms |
3036 KB |
Output is correct |
13 |
Correct |
82 ms |
3032 KB |
Output is correct |
14 |
Correct |
90 ms |
3036 KB |
Output is correct |
15 |
Correct |
86 ms |
3016 KB |
Output is correct |
16 |
Correct |
1 ms |
324 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Correct |
4 ms |
340 KB |
Output is correct |
19 |
Correct |
32 ms |
1312 KB |
Output is correct |
20 |
Correct |
74 ms |
2376 KB |
Output is correct |
21 |
Correct |
118 ms |
3020 KB |
Output is correct |
22 |
Correct |
109 ms |
3040 KB |
Output is correct |
23 |
Correct |
99 ms |
3036 KB |
Output is correct |
24 |
Correct |
106 ms |
3020 KB |
Output is correct |
25 |
Correct |
103 ms |
2964 KB |
Output is correct |
26 |
Correct |
110 ms |
3020 KB |
Output is correct |
27 |
Correct |
106 ms |
3012 KB |
Output is correct |
28 |
Correct |
99 ms |
2972 KB |
Output is correct |
29 |
Correct |
99 ms |
3036 KB |
Output is correct |
30 |
Correct |
128 ms |
3036 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 |
340 KB |
Output is correct |
34 |
Correct |
6 ms |
444 KB |
Output is correct |
35 |
Correct |
7 ms |
460 KB |
Output is correct |
36 |
Correct |
9 ms |
468 KB |
Output is correct |
37 |
Correct |
39 ms |
956 KB |
Output is correct |
38 |
Correct |
47 ms |
980 KB |
Output is correct |
39 |
Correct |
83 ms |
1468 KB |
Output is correct |
40 |
Correct |
191 ms |
2452 KB |
Output is correct |
41 |
Correct |
271 ms |
3140 KB |
Output is correct |
42 |
Correct |
245 ms |
3112 KB |
Output is correct |
43 |
Correct |
256 ms |
3144 KB |
Output is correct |
44 |
Correct |
263 ms |
3160 KB |
Output is correct |
45 |
Correct |
258 ms |
3148 KB |
Output is correct |
46 |
Correct |
254 ms |
3048 KB |
Output is correct |
47 |
Correct |
283 ms |
3148 KB |
Output is correct |
48 |
Correct |
259 ms |
3156 KB |
Output is correct |
49 |
Correct |
252 ms |
3144 KB |
Output is correct |
50 |
Correct |
268 ms |
3144 KB |
Output is correct |
51 |
Correct |
268 ms |
3172 KB |
Output is correct |
52 |
Correct |
284 ms |
3148 KB |
Output is correct |
53 |
Correct |
259 ms |
3224 KB |
Output is correct |
54 |
Correct |
282 ms |
3264 KB |
Output is correct |
55 |
Correct |
259 ms |
3144 KB |
Output is correct |
56 |
Correct |
271 ms |
3200 KB |
Output is correct |
57 |
Correct |
290 ms |
3148 KB |
Output is correct |
58 |
Correct |
265 ms |
3268 KB |
Output is correct |
59 |
Correct |
253 ms |
3144 KB |
Output is correct |
60 |
Correct |
254 ms |
3148 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
316 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
0 ms |
320 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
3 ms |
392 KB |
Output is correct |
14 |
Correct |
27 ms |
1296 KB |
Output is correct |
15 |
Correct |
50 ms |
2252 KB |
Output is correct |
16 |
Correct |
92 ms |
3032 KB |
Output is correct |
17 |
Correct |
76 ms |
3004 KB |
Output is correct |
18 |
Correct |
80 ms |
2940 KB |
Output is correct |
19 |
Correct |
90 ms |
3032 KB |
Output is correct |
20 |
Correct |
101 ms |
2960 KB |
Output is correct |
21 |
Correct |
93 ms |
2960 KB |
Output is correct |
22 |
Correct |
89 ms |
3036 KB |
Output is correct |
23 |
Correct |
82 ms |
3032 KB |
Output is correct |
24 |
Correct |
90 ms |
3036 KB |
Output is correct |
25 |
Correct |
86 ms |
3016 KB |
Output is correct |
26 |
Correct |
1 ms |
324 KB |
Output is correct |
27 |
Correct |
1 ms |
340 KB |
Output is correct |
28 |
Correct |
4 ms |
340 KB |
Output is correct |
29 |
Correct |
32 ms |
1312 KB |
Output is correct |
30 |
Correct |
74 ms |
2376 KB |
Output is correct |
31 |
Correct |
118 ms |
3020 KB |
Output is correct |
32 |
Correct |
109 ms |
3040 KB |
Output is correct |
33 |
Correct |
99 ms |
3036 KB |
Output is correct |
34 |
Correct |
106 ms |
3020 KB |
Output is correct |
35 |
Correct |
103 ms |
2964 KB |
Output is correct |
36 |
Correct |
110 ms |
3020 KB |
Output is correct |
37 |
Correct |
106 ms |
3012 KB |
Output is correct |
38 |
Correct |
99 ms |
2972 KB |
Output is correct |
39 |
Correct |
99 ms |
3036 KB |
Output is correct |
40 |
Correct |
128 ms |
3036 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 |
340 KB |
Output is correct |
44 |
Correct |
6 ms |
444 KB |
Output is correct |
45 |
Correct |
7 ms |
460 KB |
Output is correct |
46 |
Correct |
9 ms |
468 KB |
Output is correct |
47 |
Correct |
39 ms |
956 KB |
Output is correct |
48 |
Correct |
47 ms |
980 KB |
Output is correct |
49 |
Correct |
83 ms |
1468 KB |
Output is correct |
50 |
Correct |
191 ms |
2452 KB |
Output is correct |
51 |
Correct |
271 ms |
3140 KB |
Output is correct |
52 |
Correct |
245 ms |
3112 KB |
Output is correct |
53 |
Correct |
256 ms |
3144 KB |
Output is correct |
54 |
Correct |
263 ms |
3160 KB |
Output is correct |
55 |
Correct |
258 ms |
3148 KB |
Output is correct |
56 |
Correct |
254 ms |
3048 KB |
Output is correct |
57 |
Correct |
283 ms |
3148 KB |
Output is correct |
58 |
Correct |
259 ms |
3156 KB |
Output is correct |
59 |
Correct |
252 ms |
3144 KB |
Output is correct |
60 |
Correct |
268 ms |
3144 KB |
Output is correct |
61 |
Correct |
268 ms |
3172 KB |
Output is correct |
62 |
Correct |
284 ms |
3148 KB |
Output is correct |
63 |
Correct |
259 ms |
3224 KB |
Output is correct |
64 |
Correct |
282 ms |
3264 KB |
Output is correct |
65 |
Correct |
259 ms |
3144 KB |
Output is correct |
66 |
Correct |
271 ms |
3200 KB |
Output is correct |
67 |
Correct |
290 ms |
3148 KB |
Output is correct |
68 |
Correct |
265 ms |
3268 KB |
Output is correct |
69 |
Correct |
253 ms |
3144 KB |
Output is correct |
70 |
Correct |
254 ms |
3148 KB |
Output is correct |
71 |
Correct |
56 ms |
1076 KB |
Output is correct |
72 |
Correct |
54 ms |
1096 KB |
Output is correct |
73 |
Correct |
48 ms |
1160 KB |
Output is correct |
74 |
Correct |
49 ms |
1136 KB |
Output is correct |
75 |
Correct |
47 ms |
1140 KB |
Output is correct |
76 |
Correct |
116 ms |
2020 KB |
Output is correct |
77 |
Correct |
127 ms |
1940 KB |
Output is correct |
78 |
Correct |
116 ms |
1976 KB |
Output is correct |
79 |
Correct |
116 ms |
2020 KB |
Output is correct |
80 |
Correct |
111 ms |
2008 KB |
Output is correct |
81 |
Correct |
293 ms |
3308 KB |
Output is correct |
82 |
Correct |
252 ms |
3596 KB |
Output is correct |
83 |
Correct |
270 ms |
3304 KB |
Output is correct |
84 |
Correct |
251 ms |
3416 KB |
Output is correct |
85 |
Correct |
249 ms |
3452 KB |
Output is correct |
86 |
Correct |
259 ms |
4424 KB |
Output is correct |
87 |
Correct |
274 ms |
4372 KB |
Output is correct |
88 |
Correct |
271 ms |
4504 KB |
Output is correct |
89 |
Correct |
268 ms |
4492 KB |
Output is correct |
90 |
Correct |
285 ms |
4384 KB |
Output is correct |
91 |
Correct |
448 ms |
13980 KB |
Output is correct |
92 |
Correct |
468 ms |
13980 KB |
Output is correct |
93 |
Correct |
467 ms |
14028 KB |
Output is correct |
94 |
Correct |
455 ms |
14044 KB |
Output is correct |
95 |
Correct |
489 ms |
14072 KB |
Output is correct |
96 |
Correct |
367 ms |
25024 KB |
Output is correct |
97 |
Correct |
368 ms |
25032 KB |
Output is correct |
98 |
Correct |
409 ms |
25096 KB |
Output is correct |
99 |
Correct |
367 ms |
25092 KB |
Output is correct |
100 |
Correct |
384 ms |
25040 KB |
Output is correct |
101 |
Correct |
366 ms |
24996 KB |
Output is correct |
102 |
Correct |
355 ms |
25108 KB |
Output is correct |
103 |
Correct |
414 ms |
25164 KB |
Output is correct |
104 |
Correct |
357 ms |
25000 KB |
Output is correct |
105 |
Correct |
393 ms |
25052 KB |
Output is correct |
106 |
Correct |
333 ms |
30384 KB |
Output is correct |
107 |
Correct |
369 ms |
30392 KB |
Output is correct |
108 |
Correct |
345 ms |
30376 KB |
Output is correct |
109 |
Correct |
340 ms |
30520 KB |
Output is correct |
110 |
Correct |
357 ms |
30408 KB |
Output is correct |
111 |
Correct |
352 ms |
30436 KB |
Output is correct |
112 |
Correct |
354 ms |
30500 KB |
Output is correct |
113 |
Correct |
361 ms |
30544 KB |
Output is correct |
114 |
Correct |
354 ms |
30456 KB |
Output is correct |
115 |
Correct |
368 ms |
30504 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
316 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
0 ms |
320 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
3 ms |
392 KB |
Output is correct |
14 |
Correct |
27 ms |
1296 KB |
Output is correct |
15 |
Correct |
50 ms |
2252 KB |
Output is correct |
16 |
Correct |
92 ms |
3032 KB |
Output is correct |
17 |
Correct |
76 ms |
3004 KB |
Output is correct |
18 |
Correct |
80 ms |
2940 KB |
Output is correct |
19 |
Correct |
90 ms |
3032 KB |
Output is correct |
20 |
Correct |
101 ms |
2960 KB |
Output is correct |
21 |
Correct |
93 ms |
2960 KB |
Output is correct |
22 |
Correct |
89 ms |
3036 KB |
Output is correct |
23 |
Correct |
82 ms |
3032 KB |
Output is correct |
24 |
Correct |
90 ms |
3036 KB |
Output is correct |
25 |
Correct |
86 ms |
3016 KB |
Output is correct |
26 |
Correct |
1 ms |
324 KB |
Output is correct |
27 |
Correct |
1 ms |
340 KB |
Output is correct |
28 |
Correct |
4 ms |
340 KB |
Output is correct |
29 |
Correct |
32 ms |
1312 KB |
Output is correct |
30 |
Correct |
74 ms |
2376 KB |
Output is correct |
31 |
Correct |
118 ms |
3020 KB |
Output is correct |
32 |
Correct |
109 ms |
3040 KB |
Output is correct |
33 |
Correct |
99 ms |
3036 KB |
Output is correct |
34 |
Correct |
106 ms |
3020 KB |
Output is correct |
35 |
Correct |
103 ms |
2964 KB |
Output is correct |
36 |
Correct |
110 ms |
3020 KB |
Output is correct |
37 |
Correct |
106 ms |
3012 KB |
Output is correct |
38 |
Correct |
99 ms |
2972 KB |
Output is correct |
39 |
Correct |
99 ms |
3036 KB |
Output is correct |
40 |
Correct |
128 ms |
3036 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 |
340 KB |
Output is correct |
44 |
Correct |
6 ms |
444 KB |
Output is correct |
45 |
Correct |
7 ms |
460 KB |
Output is correct |
46 |
Correct |
9 ms |
468 KB |
Output is correct |
47 |
Correct |
39 ms |
956 KB |
Output is correct |
48 |
Correct |
47 ms |
980 KB |
Output is correct |
49 |
Correct |
83 ms |
1468 KB |
Output is correct |
50 |
Correct |
191 ms |
2452 KB |
Output is correct |
51 |
Correct |
271 ms |
3140 KB |
Output is correct |
52 |
Correct |
245 ms |
3112 KB |
Output is correct |
53 |
Correct |
256 ms |
3144 KB |
Output is correct |
54 |
Correct |
263 ms |
3160 KB |
Output is correct |
55 |
Correct |
258 ms |
3148 KB |
Output is correct |
56 |
Correct |
254 ms |
3048 KB |
Output is correct |
57 |
Correct |
283 ms |
3148 KB |
Output is correct |
58 |
Correct |
259 ms |
3156 KB |
Output is correct |
59 |
Correct |
252 ms |
3144 KB |
Output is correct |
60 |
Correct |
268 ms |
3144 KB |
Output is correct |
61 |
Correct |
268 ms |
3172 KB |
Output is correct |
62 |
Correct |
284 ms |
3148 KB |
Output is correct |
63 |
Correct |
259 ms |
3224 KB |
Output is correct |
64 |
Correct |
282 ms |
3264 KB |
Output is correct |
65 |
Correct |
259 ms |
3144 KB |
Output is correct |
66 |
Correct |
271 ms |
3200 KB |
Output is correct |
67 |
Correct |
290 ms |
3148 KB |
Output is correct |
68 |
Correct |
265 ms |
3268 KB |
Output is correct |
69 |
Correct |
253 ms |
3144 KB |
Output is correct |
70 |
Correct |
254 ms |
3148 KB |
Output is correct |
71 |
Correct |
56 ms |
1076 KB |
Output is correct |
72 |
Correct |
54 ms |
1096 KB |
Output is correct |
73 |
Correct |
48 ms |
1160 KB |
Output is correct |
74 |
Correct |
49 ms |
1136 KB |
Output is correct |
75 |
Correct |
47 ms |
1140 KB |
Output is correct |
76 |
Correct |
116 ms |
2020 KB |
Output is correct |
77 |
Correct |
127 ms |
1940 KB |
Output is correct |
78 |
Correct |
116 ms |
1976 KB |
Output is correct |
79 |
Correct |
116 ms |
2020 KB |
Output is correct |
80 |
Correct |
111 ms |
2008 KB |
Output is correct |
81 |
Correct |
293 ms |
3308 KB |
Output is correct |
82 |
Correct |
252 ms |
3596 KB |
Output is correct |
83 |
Correct |
270 ms |
3304 KB |
Output is correct |
84 |
Correct |
251 ms |
3416 KB |
Output is correct |
85 |
Correct |
249 ms |
3452 KB |
Output is correct |
86 |
Correct |
259 ms |
4424 KB |
Output is correct |
87 |
Correct |
274 ms |
4372 KB |
Output is correct |
88 |
Correct |
271 ms |
4504 KB |
Output is correct |
89 |
Correct |
268 ms |
4492 KB |
Output is correct |
90 |
Correct |
285 ms |
4384 KB |
Output is correct |
91 |
Correct |
448 ms |
13980 KB |
Output is correct |
92 |
Correct |
468 ms |
13980 KB |
Output is correct |
93 |
Correct |
467 ms |
14028 KB |
Output is correct |
94 |
Correct |
455 ms |
14044 KB |
Output is correct |
95 |
Correct |
489 ms |
14072 KB |
Output is correct |
96 |
Correct |
367 ms |
25024 KB |
Output is correct |
97 |
Correct |
368 ms |
25032 KB |
Output is correct |
98 |
Correct |
409 ms |
25096 KB |
Output is correct |
99 |
Correct |
367 ms |
25092 KB |
Output is correct |
100 |
Correct |
384 ms |
25040 KB |
Output is correct |
101 |
Correct |
366 ms |
24996 KB |
Output is correct |
102 |
Correct |
355 ms |
25108 KB |
Output is correct |
103 |
Correct |
414 ms |
25164 KB |
Output is correct |
104 |
Correct |
357 ms |
25000 KB |
Output is correct |
105 |
Correct |
393 ms |
25052 KB |
Output is correct |
106 |
Correct |
333 ms |
30384 KB |
Output is correct |
107 |
Correct |
369 ms |
30392 KB |
Output is correct |
108 |
Correct |
345 ms |
30376 KB |
Output is correct |
109 |
Correct |
340 ms |
30520 KB |
Output is correct |
110 |
Correct |
357 ms |
30408 KB |
Output is correct |
111 |
Correct |
352 ms |
30436 KB |
Output is correct |
112 |
Correct |
354 ms |
30500 KB |
Output is correct |
113 |
Correct |
361 ms |
30544 KB |
Output is correct |
114 |
Correct |
354 ms |
30456 KB |
Output is correct |
115 |
Correct |
368 ms |
30504 KB |
Output is correct |
116 |
Correct |
951 ms |
3556 KB |
Output is correct |
117 |
Correct |
1247 ms |
4884 KB |
Output is correct |
118 |
Correct |
5528 ms |
4940 KB |
Output is correct |
119 |
Execution timed out |
7076 ms |
8356 KB |
Time limit exceeded |
120 |
Halted |
0 ms |
0 KB |
- |