#include <bits/stdc++.h>
//#pragma GCC optimize("O3")
//#pragma GCC target("O3")
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;
int 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) * (ll)(node -> ind()) + node -> r -> intl;
node -> intr = node -> r -> intr + (ll)(node -> l -> sum + node -> val) * (ll)(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;
}
}
inline int64_t hilbertOrder(int x, int y, int pow, int rotate) {
if (pow == 0) {
return 0;
}
int hpow = 1 << (pow-1);
int seg = (x < hpow) ? (
(y < hpow) ? 0 : 3
) : (
(y < hpow) ? 1 : 2
);
seg = (seg + rotate) & 3;
const int rotateDelta[4] = {3, 0, 0, 1};
int nx = x & (x ^ hpow), ny = y & (y ^ hpow);
int nrot = (rotate + rotateDelta[seg]) & 3;
int64_t subSquareSize = int64_t(1) << (2*pow - 2);
int64_t ans = seg * subSquareSize;
int64_t add = hilbertOrder(nx, ny, pow-1, nrot);
ans += (seg == 1 || seg == 2) ? add : (subSquareSize - add - 1);
return ans;
}
using namespace Treap;
int buck;
int v[nmax];
struct Query {
int l, r, ind, atr;
bool operator <(const Query& other) const {
return atr < other.atr;
}
};
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]]);
}
total += modify(parity[it % 2], it / 2, 1);
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.tie(0) -> sync_with_stdio(0);
cin >> n >> q;
buck = max(1.0, sqrt((ll) n * n / q));
for(int i = 1; i <= n; i++)
cin >> v[i];
vector<ll> rez(q);
vector<Query> qs(q);
int cnt = 0;
for(auto &[l, r, ind,atr] : qs) {
cin >> l >> r;
ind = cnt++;
atr = hilbertOrder(l, r, 20, 0);
}
sort(qs.begin(), qs.end());
int lastl = 1, lastr = 0;
for(auto [l, r, ind, amog] : 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';
}
// tot da TLE dar vreau sa insist
// tineti minte: daca e cu treap, e incorecta solutia, treapul e n^2
Compilation message
diversity.cpp: In function 'void Treap::append(Treap::Node*&)':
diversity.cpp:79: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 'int' [-Wnarrowing]
79 | 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:215:13: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
215 | for(auto &[l, r, ind,atr] : qs) {
| ^
diversity.cpp:223:12: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
223 | for(auto [l, r, ind, amog] : qs) {
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
0 ms |
340 KB |
Output is correct |
4 |
Correct |
0 ms |
340 KB |
Output is correct |
5 |
Correct |
0 ms |
340 KB |
Output is correct |
6 |
Correct |
0 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
0 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 |
340 KB |
Output is correct |
4 |
Correct |
19 ms |
740 KB |
Output is correct |
5 |
Correct |
37 ms |
1044 KB |
Output is correct |
6 |
Correct |
66 ms |
1504 KB |
Output is correct |
7 |
Correct |
51 ms |
1496 KB |
Output is correct |
8 |
Correct |
61 ms |
1496 KB |
Output is correct |
9 |
Correct |
67 ms |
1404 KB |
Output is correct |
10 |
Correct |
66 ms |
1424 KB |
Output is correct |
11 |
Correct |
59 ms |
1476 KB |
Output is correct |
12 |
Correct |
56 ms |
1500 KB |
Output is correct |
13 |
Correct |
56 ms |
1464 KB |
Output is correct |
14 |
Correct |
87 ms |
1496 KB |
Output is correct |
15 |
Correct |
75 ms |
1512 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 |
340 KB |
Output is correct |
4 |
Correct |
19 ms |
740 KB |
Output is correct |
5 |
Correct |
37 ms |
1044 KB |
Output is correct |
6 |
Correct |
66 ms |
1504 KB |
Output is correct |
7 |
Correct |
51 ms |
1496 KB |
Output is correct |
8 |
Correct |
61 ms |
1496 KB |
Output is correct |
9 |
Correct |
67 ms |
1404 KB |
Output is correct |
10 |
Correct |
66 ms |
1424 KB |
Output is correct |
11 |
Correct |
59 ms |
1476 KB |
Output is correct |
12 |
Correct |
56 ms |
1500 KB |
Output is correct |
13 |
Correct |
56 ms |
1464 KB |
Output is correct |
14 |
Correct |
87 ms |
1496 KB |
Output is correct |
15 |
Correct |
75 ms |
1512 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Correct |
3 ms |
340 KB |
Output is correct |
19 |
Correct |
26 ms |
744 KB |
Output is correct |
20 |
Correct |
51 ms |
1116 KB |
Output is correct |
21 |
Correct |
98 ms |
1504 KB |
Output is correct |
22 |
Correct |
80 ms |
1492 KB |
Output is correct |
23 |
Correct |
74 ms |
1492 KB |
Output is correct |
24 |
Correct |
78 ms |
1492 KB |
Output is correct |
25 |
Correct |
97 ms |
1500 KB |
Output is correct |
26 |
Correct |
97 ms |
1496 KB |
Output is correct |
27 |
Correct |
102 ms |
1432 KB |
Output is correct |
28 |
Correct |
69 ms |
1492 KB |
Output is correct |
29 |
Correct |
80 ms |
1496 KB |
Output is correct |
30 |
Correct |
88 ms |
1496 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 |
340 KB |
Output is correct |
4 |
Correct |
19 ms |
740 KB |
Output is correct |
5 |
Correct |
37 ms |
1044 KB |
Output is correct |
6 |
Correct |
66 ms |
1504 KB |
Output is correct |
7 |
Correct |
51 ms |
1496 KB |
Output is correct |
8 |
Correct |
61 ms |
1496 KB |
Output is correct |
9 |
Correct |
67 ms |
1404 KB |
Output is correct |
10 |
Correct |
66 ms |
1424 KB |
Output is correct |
11 |
Correct |
59 ms |
1476 KB |
Output is correct |
12 |
Correct |
56 ms |
1500 KB |
Output is correct |
13 |
Correct |
56 ms |
1464 KB |
Output is correct |
14 |
Correct |
87 ms |
1496 KB |
Output is correct |
15 |
Correct |
75 ms |
1512 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Correct |
3 ms |
340 KB |
Output is correct |
19 |
Correct |
26 ms |
744 KB |
Output is correct |
20 |
Correct |
51 ms |
1116 KB |
Output is correct |
21 |
Correct |
98 ms |
1504 KB |
Output is correct |
22 |
Correct |
80 ms |
1492 KB |
Output is correct |
23 |
Correct |
74 ms |
1492 KB |
Output is correct |
24 |
Correct |
78 ms |
1492 KB |
Output is correct |
25 |
Correct |
97 ms |
1500 KB |
Output is correct |
26 |
Correct |
97 ms |
1496 KB |
Output is correct |
27 |
Correct |
102 ms |
1432 KB |
Output is correct |
28 |
Correct |
69 ms |
1492 KB |
Output is correct |
29 |
Correct |
80 ms |
1496 KB |
Output is correct |
30 |
Correct |
88 ms |
1496 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 |
5 ms |
340 KB |
Output is correct |
35 |
Correct |
6 ms |
340 KB |
Output is correct |
36 |
Correct |
8 ms |
468 KB |
Output is correct |
37 |
Correct |
32 ms |
572 KB |
Output is correct |
38 |
Correct |
37 ms |
616 KB |
Output is correct |
39 |
Correct |
74 ms |
804 KB |
Output is correct |
40 |
Correct |
180 ms |
1200 KB |
Output is correct |
41 |
Correct |
219 ms |
1612 KB |
Output is correct |
42 |
Correct |
209 ms |
1572 KB |
Output is correct |
43 |
Correct |
274 ms |
1516 KB |
Output is correct |
44 |
Correct |
226 ms |
1576 KB |
Output is correct |
45 |
Correct |
215 ms |
1620 KB |
Output is correct |
46 |
Correct |
219 ms |
1492 KB |
Output is correct |
47 |
Correct |
229 ms |
1700 KB |
Output is correct |
48 |
Correct |
232 ms |
1572 KB |
Output is correct |
49 |
Correct |
220 ms |
1580 KB |
Output is correct |
50 |
Correct |
204 ms |
1696 KB |
Output is correct |
51 |
Correct |
266 ms |
1584 KB |
Output is correct |
52 |
Correct |
221 ms |
1588 KB |
Output is correct |
53 |
Correct |
223 ms |
1588 KB |
Output is correct |
54 |
Correct |
236 ms |
1612 KB |
Output is correct |
55 |
Correct |
214 ms |
1584 KB |
Output is correct |
56 |
Correct |
221 ms |
1640 KB |
Output is correct |
57 |
Correct |
246 ms |
1580 KB |
Output is correct |
58 |
Correct |
204 ms |
1696 KB |
Output is correct |
59 |
Correct |
214 ms |
1576 KB |
Output is correct |
60 |
Correct |
274 ms |
1572 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
0 ms |
340 KB |
Output is correct |
4 |
Correct |
0 ms |
340 KB |
Output is correct |
5 |
Correct |
0 ms |
340 KB |
Output is correct |
6 |
Correct |
0 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
0 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 |
340 KB |
Output is correct |
14 |
Correct |
19 ms |
740 KB |
Output is correct |
15 |
Correct |
37 ms |
1044 KB |
Output is correct |
16 |
Correct |
66 ms |
1504 KB |
Output is correct |
17 |
Correct |
51 ms |
1496 KB |
Output is correct |
18 |
Correct |
61 ms |
1496 KB |
Output is correct |
19 |
Correct |
67 ms |
1404 KB |
Output is correct |
20 |
Correct |
66 ms |
1424 KB |
Output is correct |
21 |
Correct |
59 ms |
1476 KB |
Output is correct |
22 |
Correct |
56 ms |
1500 KB |
Output is correct |
23 |
Correct |
56 ms |
1464 KB |
Output is correct |
24 |
Correct |
87 ms |
1496 KB |
Output is correct |
25 |
Correct |
75 ms |
1512 KB |
Output is correct |
26 |
Correct |
1 ms |
340 KB |
Output is correct |
27 |
Correct |
1 ms |
340 KB |
Output is correct |
28 |
Correct |
3 ms |
340 KB |
Output is correct |
29 |
Correct |
26 ms |
744 KB |
Output is correct |
30 |
Correct |
51 ms |
1116 KB |
Output is correct |
31 |
Correct |
98 ms |
1504 KB |
Output is correct |
32 |
Correct |
80 ms |
1492 KB |
Output is correct |
33 |
Correct |
74 ms |
1492 KB |
Output is correct |
34 |
Correct |
78 ms |
1492 KB |
Output is correct |
35 |
Correct |
97 ms |
1500 KB |
Output is correct |
36 |
Correct |
97 ms |
1496 KB |
Output is correct |
37 |
Correct |
102 ms |
1432 KB |
Output is correct |
38 |
Correct |
69 ms |
1492 KB |
Output is correct |
39 |
Correct |
80 ms |
1496 KB |
Output is correct |
40 |
Correct |
88 ms |
1496 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 |
5 ms |
340 KB |
Output is correct |
45 |
Correct |
6 ms |
340 KB |
Output is correct |
46 |
Correct |
8 ms |
468 KB |
Output is correct |
47 |
Correct |
32 ms |
572 KB |
Output is correct |
48 |
Correct |
37 ms |
616 KB |
Output is correct |
49 |
Correct |
74 ms |
804 KB |
Output is correct |
50 |
Correct |
180 ms |
1200 KB |
Output is correct |
51 |
Correct |
219 ms |
1612 KB |
Output is correct |
52 |
Correct |
209 ms |
1572 KB |
Output is correct |
53 |
Correct |
274 ms |
1516 KB |
Output is correct |
54 |
Correct |
226 ms |
1576 KB |
Output is correct |
55 |
Correct |
215 ms |
1620 KB |
Output is correct |
56 |
Correct |
219 ms |
1492 KB |
Output is correct |
57 |
Correct |
229 ms |
1700 KB |
Output is correct |
58 |
Correct |
232 ms |
1572 KB |
Output is correct |
59 |
Correct |
220 ms |
1580 KB |
Output is correct |
60 |
Correct |
204 ms |
1696 KB |
Output is correct |
61 |
Correct |
266 ms |
1584 KB |
Output is correct |
62 |
Correct |
221 ms |
1588 KB |
Output is correct |
63 |
Correct |
223 ms |
1588 KB |
Output is correct |
64 |
Correct |
236 ms |
1612 KB |
Output is correct |
65 |
Correct |
214 ms |
1584 KB |
Output is correct |
66 |
Correct |
221 ms |
1640 KB |
Output is correct |
67 |
Correct |
246 ms |
1580 KB |
Output is correct |
68 |
Correct |
204 ms |
1696 KB |
Output is correct |
69 |
Correct |
214 ms |
1576 KB |
Output is correct |
70 |
Correct |
274 ms |
1572 KB |
Output is correct |
71 |
Correct |
42 ms |
596 KB |
Output is correct |
72 |
Correct |
42 ms |
596 KB |
Output is correct |
73 |
Correct |
42 ms |
696 KB |
Output is correct |
74 |
Correct |
46 ms |
684 KB |
Output is correct |
75 |
Correct |
43 ms |
676 KB |
Output is correct |
76 |
Correct |
95 ms |
1048 KB |
Output is correct |
77 |
Correct |
101 ms |
1108 KB |
Output is correct |
78 |
Correct |
105 ms |
1112 KB |
Output is correct |
79 |
Correct |
97 ms |
1120 KB |
Output is correct |
80 |
Correct |
111 ms |
1112 KB |
Output is correct |
81 |
Correct |
242 ms |
2020 KB |
Output is correct |
82 |
Correct |
212 ms |
1856 KB |
Output is correct |
83 |
Correct |
216 ms |
2016 KB |
Output is correct |
84 |
Correct |
219 ms |
1820 KB |
Output is correct |
85 |
Correct |
253 ms |
1864 KB |
Output is correct |
86 |
Correct |
243 ms |
2644 KB |
Output is correct |
87 |
Correct |
226 ms |
2780 KB |
Output is correct |
88 |
Correct |
263 ms |
2568 KB |
Output is correct |
89 |
Correct |
233 ms |
2816 KB |
Output is correct |
90 |
Correct |
238 ms |
2620 KB |
Output is correct |
91 |
Correct |
348 ms |
9328 KB |
Output is correct |
92 |
Correct |
376 ms |
9312 KB |
Output is correct |
93 |
Correct |
358 ms |
9276 KB |
Output is correct |
94 |
Correct |
373 ms |
9272 KB |
Output is correct |
95 |
Correct |
352 ms |
9392 KB |
Output is correct |
96 |
Correct |
351 ms |
17368 KB |
Output is correct |
97 |
Correct |
297 ms |
17232 KB |
Output is correct |
98 |
Correct |
331 ms |
17200 KB |
Output is correct |
99 |
Correct |
297 ms |
17272 KB |
Output is correct |
100 |
Correct |
293 ms |
17156 KB |
Output is correct |
101 |
Correct |
333 ms |
17212 KB |
Output is correct |
102 |
Correct |
290 ms |
17212 KB |
Output is correct |
103 |
Correct |
341 ms |
17228 KB |
Output is correct |
104 |
Correct |
289 ms |
17228 KB |
Output is correct |
105 |
Correct |
315 ms |
17196 KB |
Output is correct |
106 |
Correct |
247 ms |
21208 KB |
Output is correct |
107 |
Correct |
258 ms |
21176 KB |
Output is correct |
108 |
Correct |
291 ms |
21100 KB |
Output is correct |
109 |
Correct |
269 ms |
21136 KB |
Output is correct |
110 |
Correct |
277 ms |
21096 KB |
Output is correct |
111 |
Correct |
253 ms |
21160 KB |
Output is correct |
112 |
Correct |
272 ms |
21172 KB |
Output is correct |
113 |
Correct |
261 ms |
21096 KB |
Output is correct |
114 |
Correct |
281 ms |
21068 KB |
Output is correct |
115 |
Correct |
254 ms |
21128 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
0 ms |
340 KB |
Output is correct |
4 |
Correct |
0 ms |
340 KB |
Output is correct |
5 |
Correct |
0 ms |
340 KB |
Output is correct |
6 |
Correct |
0 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
0 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 |
340 KB |
Output is correct |
14 |
Correct |
19 ms |
740 KB |
Output is correct |
15 |
Correct |
37 ms |
1044 KB |
Output is correct |
16 |
Correct |
66 ms |
1504 KB |
Output is correct |
17 |
Correct |
51 ms |
1496 KB |
Output is correct |
18 |
Correct |
61 ms |
1496 KB |
Output is correct |
19 |
Correct |
67 ms |
1404 KB |
Output is correct |
20 |
Correct |
66 ms |
1424 KB |
Output is correct |
21 |
Correct |
59 ms |
1476 KB |
Output is correct |
22 |
Correct |
56 ms |
1500 KB |
Output is correct |
23 |
Correct |
56 ms |
1464 KB |
Output is correct |
24 |
Correct |
87 ms |
1496 KB |
Output is correct |
25 |
Correct |
75 ms |
1512 KB |
Output is correct |
26 |
Correct |
1 ms |
340 KB |
Output is correct |
27 |
Correct |
1 ms |
340 KB |
Output is correct |
28 |
Correct |
3 ms |
340 KB |
Output is correct |
29 |
Correct |
26 ms |
744 KB |
Output is correct |
30 |
Correct |
51 ms |
1116 KB |
Output is correct |
31 |
Correct |
98 ms |
1504 KB |
Output is correct |
32 |
Correct |
80 ms |
1492 KB |
Output is correct |
33 |
Correct |
74 ms |
1492 KB |
Output is correct |
34 |
Correct |
78 ms |
1492 KB |
Output is correct |
35 |
Correct |
97 ms |
1500 KB |
Output is correct |
36 |
Correct |
97 ms |
1496 KB |
Output is correct |
37 |
Correct |
102 ms |
1432 KB |
Output is correct |
38 |
Correct |
69 ms |
1492 KB |
Output is correct |
39 |
Correct |
80 ms |
1496 KB |
Output is correct |
40 |
Correct |
88 ms |
1496 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 |
5 ms |
340 KB |
Output is correct |
45 |
Correct |
6 ms |
340 KB |
Output is correct |
46 |
Correct |
8 ms |
468 KB |
Output is correct |
47 |
Correct |
32 ms |
572 KB |
Output is correct |
48 |
Correct |
37 ms |
616 KB |
Output is correct |
49 |
Correct |
74 ms |
804 KB |
Output is correct |
50 |
Correct |
180 ms |
1200 KB |
Output is correct |
51 |
Correct |
219 ms |
1612 KB |
Output is correct |
52 |
Correct |
209 ms |
1572 KB |
Output is correct |
53 |
Correct |
274 ms |
1516 KB |
Output is correct |
54 |
Correct |
226 ms |
1576 KB |
Output is correct |
55 |
Correct |
215 ms |
1620 KB |
Output is correct |
56 |
Correct |
219 ms |
1492 KB |
Output is correct |
57 |
Correct |
229 ms |
1700 KB |
Output is correct |
58 |
Correct |
232 ms |
1572 KB |
Output is correct |
59 |
Correct |
220 ms |
1580 KB |
Output is correct |
60 |
Correct |
204 ms |
1696 KB |
Output is correct |
61 |
Correct |
266 ms |
1584 KB |
Output is correct |
62 |
Correct |
221 ms |
1588 KB |
Output is correct |
63 |
Correct |
223 ms |
1588 KB |
Output is correct |
64 |
Correct |
236 ms |
1612 KB |
Output is correct |
65 |
Correct |
214 ms |
1584 KB |
Output is correct |
66 |
Correct |
221 ms |
1640 KB |
Output is correct |
67 |
Correct |
246 ms |
1580 KB |
Output is correct |
68 |
Correct |
204 ms |
1696 KB |
Output is correct |
69 |
Correct |
214 ms |
1576 KB |
Output is correct |
70 |
Correct |
274 ms |
1572 KB |
Output is correct |
71 |
Correct |
42 ms |
596 KB |
Output is correct |
72 |
Correct |
42 ms |
596 KB |
Output is correct |
73 |
Correct |
42 ms |
696 KB |
Output is correct |
74 |
Correct |
46 ms |
684 KB |
Output is correct |
75 |
Correct |
43 ms |
676 KB |
Output is correct |
76 |
Correct |
95 ms |
1048 KB |
Output is correct |
77 |
Correct |
101 ms |
1108 KB |
Output is correct |
78 |
Correct |
105 ms |
1112 KB |
Output is correct |
79 |
Correct |
97 ms |
1120 KB |
Output is correct |
80 |
Correct |
111 ms |
1112 KB |
Output is correct |
81 |
Correct |
242 ms |
2020 KB |
Output is correct |
82 |
Correct |
212 ms |
1856 KB |
Output is correct |
83 |
Correct |
216 ms |
2016 KB |
Output is correct |
84 |
Correct |
219 ms |
1820 KB |
Output is correct |
85 |
Correct |
253 ms |
1864 KB |
Output is correct |
86 |
Correct |
243 ms |
2644 KB |
Output is correct |
87 |
Correct |
226 ms |
2780 KB |
Output is correct |
88 |
Correct |
263 ms |
2568 KB |
Output is correct |
89 |
Correct |
233 ms |
2816 KB |
Output is correct |
90 |
Correct |
238 ms |
2620 KB |
Output is correct |
91 |
Correct |
348 ms |
9328 KB |
Output is correct |
92 |
Correct |
376 ms |
9312 KB |
Output is correct |
93 |
Correct |
358 ms |
9276 KB |
Output is correct |
94 |
Correct |
373 ms |
9272 KB |
Output is correct |
95 |
Correct |
352 ms |
9392 KB |
Output is correct |
96 |
Correct |
351 ms |
17368 KB |
Output is correct |
97 |
Correct |
297 ms |
17232 KB |
Output is correct |
98 |
Correct |
331 ms |
17200 KB |
Output is correct |
99 |
Correct |
297 ms |
17272 KB |
Output is correct |
100 |
Correct |
293 ms |
17156 KB |
Output is correct |
101 |
Correct |
333 ms |
17212 KB |
Output is correct |
102 |
Correct |
290 ms |
17212 KB |
Output is correct |
103 |
Correct |
341 ms |
17228 KB |
Output is correct |
104 |
Correct |
289 ms |
17228 KB |
Output is correct |
105 |
Correct |
315 ms |
17196 KB |
Output is correct |
106 |
Correct |
247 ms |
21208 KB |
Output is correct |
107 |
Correct |
258 ms |
21176 KB |
Output is correct |
108 |
Correct |
291 ms |
21100 KB |
Output is correct |
109 |
Correct |
269 ms |
21136 KB |
Output is correct |
110 |
Correct |
277 ms |
21096 KB |
Output is correct |
111 |
Correct |
253 ms |
21160 KB |
Output is correct |
112 |
Correct |
272 ms |
21172 KB |
Output is correct |
113 |
Correct |
261 ms |
21096 KB |
Output is correct |
114 |
Correct |
281 ms |
21068 KB |
Output is correct |
115 |
Correct |
254 ms |
21128 KB |
Output is correct |
116 |
Correct |
578 ms |
2504 KB |
Output is correct |
117 |
Correct |
744 ms |
3076 KB |
Output is correct |
118 |
Correct |
3735 ms |
3220 KB |
Output is correct |
119 |
Correct |
5859 ms |
8280 KB |
Output is correct |
120 |
Correct |
6755 ms |
14784 KB |
Output is correct |
121 |
Execution timed out |
7040 ms |
5400 KB |
Time limit exceeded |
122 |
Halted |
0 ms |
0 KB |
- |