#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
const int maxN = 300'000;
const int maxQ = 50'000;
const int Sp = (1 << 19); //******
struct fenwick_tree
{
vector<long long> BIT = vector<long long>(1+Sp, 0);
void add(int L, int i, long long v)
{
for(int j = i; j <= Sp; j += j&-j)
BIT[j] += v;
}
int rangesum(int L, int i)
{
long long res = 0;
for(int j = i; j >= 1; j -= j&-j)
res += BIT[j];
return res;
}
};
struct segtree
{
int l;
int r;
long long lp = 0;
long long sm = 0;
segtree* left = NULL;
segtree* right = NULL;
segtree()
{
;
}
segtree(int L, int R)
{
l = L;
r = R;
if(l == r) return;
int m = (l+r)/2;
left = new segtree(l, m);
right = new segtree(m+1, r);
}
void add(int L, int R, long long V)
{
if(R < L) return;
if(R < l || r < L) return;
else if(L <= l && r <= R)
{
lp += V;
sm += (r-l+1)*V;
}
else
{
sm += V*(min(R,r) - max(L,l) + 1);
left->add(L, R, V);
right->add(L, R, V);
}
}
long long rangesum(int L, int R)
{
if(R < L) return 0;
if(R < l || r < L) return 0;
else if(L <= l && r <= R)
{
return sm;
}
else
{
return lp*(min(R,r) - max(L,l) + 1) + left->rangesum(L, R) + right->rangesum(L, R);
}
}
};
vector<int> a(1+maxN);
vector<int> l(1+maxQ), r(1+maxQ);
int L = 1;
int R = 0;
fenwick_tree ST;
segtree ST2(1, Sp);
segtree ST3(1, Sp);
vector<int> species_size(1+Sp);
vector<int> species_rank(1+Sp); //1 = center, S = edge
vector<int> rank_species(1+Sp);
vector<int> rank_pos(1+Sp);
vector<int> pos_rank(1+Sp);
vector<int> size_lowrank(1+maxN, -1), size_highrank(1+maxN, -1);
long long curr_ans = 0;
void add(int A)
{
// cerr << "add " << A << '\n';
int curr_size = species_size[A];
// cerr << "curr_size = " << curr_size << '\n';
int B = rank_species[ size_lowrank[ curr_size ] ];
swap(rank_species[ species_rank[A] ], rank_species[ species_rank[B] ]);
swap(species_rank[A], species_rank[B]);
long long T = species_size[A];
long long P = ST.rangesum(1, rank_pos[species_rank[A]] - 1);
long long S = R-L+1 - P - T;
curr_ans += ((T+1)*(T+2)/2) - (T*(T+1)/2);
curr_ans += 2*P + 2*S;
curr_ans += ST2.rangesum(1, rank_pos[species_rank[A]] - 2);
curr_ans += ST3.rangesum(rank_pos[species_rank[A]] + 2, Sp);
// cerr << "A = " << A << '\n';
species_size[A]++;
long long RP = rank_pos[ species_rank[A] ];
ST.add(RP, RP, +1);
ST2.add(RP, Sp, +1);
ST3.add(1, RP, +1);
if(size_lowrank[curr_size+1] > size_highrank[curr_size+1])
{
// cerr << "creating new\n";
size_lowrank[curr_size+1] = size_highrank[curr_size+1] = size_lowrank[curr_size];
size_lowrank[curr_size]++;
}
else
{
// cerr << "expanding old\n";
size_highrank[curr_size+1]++;
size_lowrank[curr_size]++;
}
}
void remove(int A)
{
// cerr << "remove " << A << '\n';
int curr_size = species_size[A];
int B = rank_species[ size_highrank[ curr_size ] ];
swap(rank_species[ species_rank[A] ], rank_species[ species_rank[B] ]);
swap(species_rank[A], species_rank[B]);
species_size[A]--;
int RP = rank_pos[ species_rank[A] ];
ST.add(RP, RP, -1);
ST2.add(RP, Sp, -1);
ST3.add(1, RP, -1);
long long T = species_size[A];
long long P = ST.rangesum(1, rank_pos[species_rank[A]] - 1);
long long S = R-L+1 - P - T;
curr_ans -= ((T+1)*(T+2)/2) - (T*(T+1)/2);
curr_ans -= 2*P + 2*S;
curr_ans -= ST2.rangesum(1, rank_pos[species_rank[A]] - 2);
curr_ans -= ST3.rangesum(rank_pos[species_rank[A]] + 2, Sp);
if(size_lowrank[curr_size-1] > size_highrank[curr_size-1])
{
size_lowrank[curr_size-1] = size_highrank[curr_size-1] = size_highrank[curr_size];
size_highrank[curr_size]--;
}
else
{
size_lowrank[curr_size-1]--;
size_highrank[curr_size]--;
}
}
int C;
const int rt = 500;
void fastscan(int &number)
{
bool negative = false;
int c;
number = 0;
c = getchar();
if (c=='-')
{
negative = true;
c = getchar();
}
for (; (c>47 && c<58); c=getchar())
number = number *10 + c - 48;
if (negative)
number *= -1;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int N, Q;
fastscan(N);
fastscan(Q);
for(int i = 1; i <= N; i++) fastscan(a[i]);
for(int j = 1; j <= Q; j++)
{
fastscan(l[j]);
fastscan(r[j]);
}
vector<long long> answer(1+Q);
vector<int> queries(Q);
for(int j = 0; j < Q; j++) queries[j] = j+1;
sort(queries.begin(), queries.end(), [] (int u, int v)
{
if(l[u] / rt != l[v] / rt) return l[u] / rt < l[v] / rt;
else return r[u] < r[v];
});
L = 1;
R = 0;
for(int s = 1; s <= Sp; s++)
{
species_size[s] = 0;
species_rank[s] = s;
rank_species[s] = s;
}
C = (1+Sp)/2;
if(Sp % 2 == 0)
C++;
vector<int> P(Sp);
for(int i = 0; i < Sp; i++) P[i] = i+1;
sort(P.begin(), P.end(), [] (int u, int v)
{
if(abs(u - C) != abs(v - C)) return abs(u - C) < abs(v - C);
else return u < v;
});
for(int i = 1; i <= Sp; i++)
{
rank_pos[i] = P[i-1];
pos_rank[ P[i-1] ] = i;
}
size_lowrank[0] = 1;
size_highrank[0] = Sp;
for(int i = 1; i <= N; i++)
{
size_lowrank[i] = -1;
size_highrank[i] = -2;
}
L = l[queries[0]];
R = L-1;
for(int j: queries)
{
while(R < r[j])
{
add(a[R+1]);
R++;
}
while(r[j] < R)
{
R--;
remove(a[R+1]);
}
while(l[j] < L)
{
add(a[L-1]);
L--;
}
while(L < l[j])
{
L++;
remove(a[L-1]);
}
answer[j] = curr_ans;
}
for(int j = 1; j <= Q; j++) cout << answer[j] << '\n';
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
158 ms |
119064 KB |
Output is correct |
2 |
Correct |
161 ms |
119128 KB |
Output is correct |
3 |
Correct |
172 ms |
119160 KB |
Output is correct |
4 |
Correct |
162 ms |
119152 KB |
Output is correct |
5 |
Correct |
180 ms |
119032 KB |
Output is correct |
6 |
Correct |
176 ms |
119072 KB |
Output is correct |
7 |
Correct |
156 ms |
119164 KB |
Output is correct |
8 |
Correct |
159 ms |
119156 KB |
Output is correct |
9 |
Correct |
182 ms |
119252 KB |
Output is correct |
10 |
Correct |
164 ms |
119220 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
182 ms |
119264 KB |
Output is correct |
2 |
Correct |
162 ms |
119044 KB |
Output is correct |
3 |
Correct |
159 ms |
119060 KB |
Output is correct |
4 |
Correct |
201 ms |
119164 KB |
Output is correct |
5 |
Correct |
258 ms |
119108 KB |
Output is correct |
6 |
Correct |
328 ms |
119236 KB |
Output is correct |
7 |
Correct |
301 ms |
119192 KB |
Output is correct |
8 |
Correct |
311 ms |
119148 KB |
Output is correct |
9 |
Correct |
311 ms |
119156 KB |
Output is correct |
10 |
Correct |
294 ms |
119084 KB |
Output is correct |
11 |
Correct |
297 ms |
119128 KB |
Output is correct |
12 |
Correct |
339 ms |
119352 KB |
Output is correct |
13 |
Correct |
309 ms |
119280 KB |
Output is correct |
14 |
Correct |
303 ms |
119160 KB |
Output is correct |
15 |
Correct |
302 ms |
119160 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
182 ms |
119264 KB |
Output is correct |
2 |
Correct |
162 ms |
119044 KB |
Output is correct |
3 |
Correct |
159 ms |
119060 KB |
Output is correct |
4 |
Correct |
201 ms |
119164 KB |
Output is correct |
5 |
Correct |
258 ms |
119108 KB |
Output is correct |
6 |
Correct |
328 ms |
119236 KB |
Output is correct |
7 |
Correct |
301 ms |
119192 KB |
Output is correct |
8 |
Correct |
311 ms |
119148 KB |
Output is correct |
9 |
Correct |
311 ms |
119156 KB |
Output is correct |
10 |
Correct |
294 ms |
119084 KB |
Output is correct |
11 |
Correct |
297 ms |
119128 KB |
Output is correct |
12 |
Correct |
339 ms |
119352 KB |
Output is correct |
13 |
Correct |
309 ms |
119280 KB |
Output is correct |
14 |
Correct |
303 ms |
119160 KB |
Output is correct |
15 |
Correct |
302 ms |
119160 KB |
Output is correct |
16 |
Correct |
181 ms |
119052 KB |
Output is correct |
17 |
Correct |
167 ms |
119180 KB |
Output is correct |
18 |
Correct |
159 ms |
119128 KB |
Output is correct |
19 |
Correct |
209 ms |
119152 KB |
Output is correct |
20 |
Correct |
289 ms |
119160 KB |
Output is correct |
21 |
Correct |
312 ms |
119084 KB |
Output is correct |
22 |
Correct |
322 ms |
119112 KB |
Output is correct |
23 |
Correct |
322 ms |
119200 KB |
Output is correct |
24 |
Correct |
321 ms |
119280 KB |
Output is correct |
25 |
Correct |
337 ms |
119184 KB |
Output is correct |
26 |
Correct |
312 ms |
119276 KB |
Output is correct |
27 |
Correct |
320 ms |
119260 KB |
Output is correct |
28 |
Correct |
311 ms |
119156 KB |
Output is correct |
29 |
Correct |
328 ms |
119104 KB |
Output is correct |
30 |
Correct |
343 ms |
119272 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
182 ms |
119264 KB |
Output is correct |
2 |
Correct |
162 ms |
119044 KB |
Output is correct |
3 |
Correct |
159 ms |
119060 KB |
Output is correct |
4 |
Correct |
201 ms |
119164 KB |
Output is correct |
5 |
Correct |
258 ms |
119108 KB |
Output is correct |
6 |
Correct |
328 ms |
119236 KB |
Output is correct |
7 |
Correct |
301 ms |
119192 KB |
Output is correct |
8 |
Correct |
311 ms |
119148 KB |
Output is correct |
9 |
Correct |
311 ms |
119156 KB |
Output is correct |
10 |
Correct |
294 ms |
119084 KB |
Output is correct |
11 |
Correct |
297 ms |
119128 KB |
Output is correct |
12 |
Correct |
339 ms |
119352 KB |
Output is correct |
13 |
Correct |
309 ms |
119280 KB |
Output is correct |
14 |
Correct |
303 ms |
119160 KB |
Output is correct |
15 |
Correct |
302 ms |
119160 KB |
Output is correct |
16 |
Correct |
181 ms |
119052 KB |
Output is correct |
17 |
Correct |
167 ms |
119180 KB |
Output is correct |
18 |
Correct |
159 ms |
119128 KB |
Output is correct |
19 |
Correct |
209 ms |
119152 KB |
Output is correct |
20 |
Correct |
289 ms |
119160 KB |
Output is correct |
21 |
Correct |
312 ms |
119084 KB |
Output is correct |
22 |
Correct |
322 ms |
119112 KB |
Output is correct |
23 |
Correct |
322 ms |
119200 KB |
Output is correct |
24 |
Correct |
321 ms |
119280 KB |
Output is correct |
25 |
Correct |
337 ms |
119184 KB |
Output is correct |
26 |
Correct |
312 ms |
119276 KB |
Output is correct |
27 |
Correct |
320 ms |
119260 KB |
Output is correct |
28 |
Correct |
311 ms |
119156 KB |
Output is correct |
29 |
Correct |
328 ms |
119104 KB |
Output is correct |
30 |
Correct |
343 ms |
119272 KB |
Output is correct |
31 |
Correct |
166 ms |
119112 KB |
Output is correct |
32 |
Correct |
175 ms |
119156 KB |
Output is correct |
33 |
Correct |
167 ms |
119236 KB |
Output is correct |
34 |
Correct |
202 ms |
119104 KB |
Output is correct |
35 |
Correct |
171 ms |
119156 KB |
Output is correct |
36 |
Correct |
205 ms |
119204 KB |
Output is correct |
37 |
Correct |
200 ms |
119108 KB |
Output is correct |
38 |
Correct |
202 ms |
119108 KB |
Output is correct |
39 |
Correct |
246 ms |
119104 KB |
Output is correct |
40 |
Correct |
330 ms |
119160 KB |
Output is correct |
41 |
Correct |
399 ms |
119108 KB |
Output is correct |
42 |
Correct |
418 ms |
119160 KB |
Output is correct |
43 |
Correct |
370 ms |
119108 KB |
Output is correct |
44 |
Correct |
412 ms |
119236 KB |
Output is correct |
45 |
Correct |
391 ms |
119236 KB |
Output is correct |
46 |
Correct |
389 ms |
119104 KB |
Output is correct |
47 |
Correct |
411 ms |
119236 KB |
Output is correct |
48 |
Correct |
387 ms |
119108 KB |
Output is correct |
49 |
Correct |
427 ms |
119156 KB |
Output is correct |
50 |
Correct |
382 ms |
119108 KB |
Output is correct |
51 |
Correct |
410 ms |
119264 KB |
Output is correct |
52 |
Correct |
381 ms |
119236 KB |
Output is correct |
53 |
Correct |
412 ms |
119220 KB |
Output is correct |
54 |
Correct |
399 ms |
119164 KB |
Output is correct |
55 |
Correct |
401 ms |
119156 KB |
Output is correct |
56 |
Correct |
431 ms |
119156 KB |
Output is correct |
57 |
Correct |
382 ms |
119236 KB |
Output is correct |
58 |
Correct |
388 ms |
119196 KB |
Output is correct |
59 |
Correct |
405 ms |
119164 KB |
Output is correct |
60 |
Correct |
391 ms |
119164 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
158 ms |
119064 KB |
Output is correct |
2 |
Correct |
161 ms |
119128 KB |
Output is correct |
3 |
Correct |
172 ms |
119160 KB |
Output is correct |
4 |
Correct |
162 ms |
119152 KB |
Output is correct |
5 |
Correct |
180 ms |
119032 KB |
Output is correct |
6 |
Correct |
176 ms |
119072 KB |
Output is correct |
7 |
Correct |
156 ms |
119164 KB |
Output is correct |
8 |
Correct |
159 ms |
119156 KB |
Output is correct |
9 |
Correct |
182 ms |
119252 KB |
Output is correct |
10 |
Correct |
164 ms |
119220 KB |
Output is correct |
11 |
Correct |
182 ms |
119264 KB |
Output is correct |
12 |
Correct |
162 ms |
119044 KB |
Output is correct |
13 |
Correct |
159 ms |
119060 KB |
Output is correct |
14 |
Correct |
201 ms |
119164 KB |
Output is correct |
15 |
Correct |
258 ms |
119108 KB |
Output is correct |
16 |
Correct |
328 ms |
119236 KB |
Output is correct |
17 |
Correct |
301 ms |
119192 KB |
Output is correct |
18 |
Correct |
311 ms |
119148 KB |
Output is correct |
19 |
Correct |
311 ms |
119156 KB |
Output is correct |
20 |
Correct |
294 ms |
119084 KB |
Output is correct |
21 |
Correct |
297 ms |
119128 KB |
Output is correct |
22 |
Correct |
339 ms |
119352 KB |
Output is correct |
23 |
Correct |
309 ms |
119280 KB |
Output is correct |
24 |
Correct |
303 ms |
119160 KB |
Output is correct |
25 |
Correct |
302 ms |
119160 KB |
Output is correct |
26 |
Correct |
181 ms |
119052 KB |
Output is correct |
27 |
Correct |
167 ms |
119180 KB |
Output is correct |
28 |
Correct |
159 ms |
119128 KB |
Output is correct |
29 |
Correct |
209 ms |
119152 KB |
Output is correct |
30 |
Correct |
289 ms |
119160 KB |
Output is correct |
31 |
Correct |
312 ms |
119084 KB |
Output is correct |
32 |
Correct |
322 ms |
119112 KB |
Output is correct |
33 |
Correct |
322 ms |
119200 KB |
Output is correct |
34 |
Correct |
321 ms |
119280 KB |
Output is correct |
35 |
Correct |
337 ms |
119184 KB |
Output is correct |
36 |
Correct |
312 ms |
119276 KB |
Output is correct |
37 |
Correct |
320 ms |
119260 KB |
Output is correct |
38 |
Correct |
311 ms |
119156 KB |
Output is correct |
39 |
Correct |
328 ms |
119104 KB |
Output is correct |
40 |
Correct |
343 ms |
119272 KB |
Output is correct |
41 |
Correct |
166 ms |
119112 KB |
Output is correct |
42 |
Correct |
175 ms |
119156 KB |
Output is correct |
43 |
Correct |
167 ms |
119236 KB |
Output is correct |
44 |
Correct |
202 ms |
119104 KB |
Output is correct |
45 |
Correct |
171 ms |
119156 KB |
Output is correct |
46 |
Correct |
205 ms |
119204 KB |
Output is correct |
47 |
Correct |
200 ms |
119108 KB |
Output is correct |
48 |
Correct |
202 ms |
119108 KB |
Output is correct |
49 |
Correct |
246 ms |
119104 KB |
Output is correct |
50 |
Correct |
330 ms |
119160 KB |
Output is correct |
51 |
Correct |
399 ms |
119108 KB |
Output is correct |
52 |
Correct |
418 ms |
119160 KB |
Output is correct |
53 |
Correct |
370 ms |
119108 KB |
Output is correct |
54 |
Correct |
412 ms |
119236 KB |
Output is correct |
55 |
Correct |
391 ms |
119236 KB |
Output is correct |
56 |
Correct |
389 ms |
119104 KB |
Output is correct |
57 |
Correct |
411 ms |
119236 KB |
Output is correct |
58 |
Correct |
387 ms |
119108 KB |
Output is correct |
59 |
Correct |
427 ms |
119156 KB |
Output is correct |
60 |
Correct |
382 ms |
119108 KB |
Output is correct |
61 |
Correct |
410 ms |
119264 KB |
Output is correct |
62 |
Correct |
381 ms |
119236 KB |
Output is correct |
63 |
Correct |
412 ms |
119220 KB |
Output is correct |
64 |
Correct |
399 ms |
119164 KB |
Output is correct |
65 |
Correct |
401 ms |
119156 KB |
Output is correct |
66 |
Correct |
431 ms |
119156 KB |
Output is correct |
67 |
Correct |
382 ms |
119236 KB |
Output is correct |
68 |
Correct |
388 ms |
119196 KB |
Output is correct |
69 |
Correct |
405 ms |
119164 KB |
Output is correct |
70 |
Correct |
391 ms |
119164 KB |
Output is correct |
71 |
Correct |
210 ms |
119116 KB |
Output is correct |
72 |
Correct |
203 ms |
119160 KB |
Output is correct |
73 |
Correct |
209 ms |
119216 KB |
Output is correct |
74 |
Correct |
217 ms |
119244 KB |
Output is correct |
75 |
Correct |
224 ms |
119036 KB |
Output is correct |
76 |
Correct |
268 ms |
119088 KB |
Output is correct |
77 |
Correct |
251 ms |
119092 KB |
Output is correct |
78 |
Correct |
253 ms |
119160 KB |
Output is correct |
79 |
Correct |
252 ms |
119036 KB |
Output is correct |
80 |
Correct |
256 ms |
119164 KB |
Output is correct |
81 |
Correct |
382 ms |
119160 KB |
Output is correct |
82 |
Correct |
335 ms |
119156 KB |
Output is correct |
83 |
Correct |
378 ms |
119208 KB |
Output is correct |
84 |
Correct |
329 ms |
119156 KB |
Output is correct |
85 |
Correct |
379 ms |
119160 KB |
Output is correct |
86 |
Correct |
340 ms |
119164 KB |
Output is correct |
87 |
Correct |
373 ms |
119268 KB |
Output is correct |
88 |
Correct |
350 ms |
119164 KB |
Output is correct |
89 |
Correct |
334 ms |
119280 KB |
Output is correct |
90 |
Correct |
340 ms |
119160 KB |
Output is correct |
91 |
Correct |
431 ms |
119160 KB |
Output is correct |
92 |
Correct |
460 ms |
119212 KB |
Output is correct |
93 |
Correct |
471 ms |
119236 KB |
Output is correct |
94 |
Correct |
445 ms |
119236 KB |
Output is correct |
95 |
Correct |
460 ms |
119280 KB |
Output is correct |
96 |
Correct |
445 ms |
119156 KB |
Output is correct |
97 |
Correct |
449 ms |
119164 KB |
Output is correct |
98 |
Correct |
445 ms |
119160 KB |
Output is correct |
99 |
Correct |
433 ms |
119284 KB |
Output is correct |
100 |
Correct |
461 ms |
119160 KB |
Output is correct |
101 |
Correct |
435 ms |
119156 KB |
Output is correct |
102 |
Correct |
465 ms |
119156 KB |
Output is correct |
103 |
Correct |
448 ms |
119068 KB |
Output is correct |
104 |
Correct |
459 ms |
119280 KB |
Output is correct |
105 |
Correct |
426 ms |
119240 KB |
Output is correct |
106 |
Correct |
456 ms |
119048 KB |
Output is correct |
107 |
Correct |
434 ms |
119232 KB |
Output is correct |
108 |
Correct |
447 ms |
119160 KB |
Output is correct |
109 |
Correct |
461 ms |
119124 KB |
Output is correct |
110 |
Correct |
434 ms |
119164 KB |
Output is correct |
111 |
Correct |
429 ms |
119160 KB |
Output is correct |
112 |
Correct |
454 ms |
119104 KB |
Output is correct |
113 |
Correct |
476 ms |
119156 KB |
Output is correct |
114 |
Correct |
432 ms |
119156 KB |
Output is correct |
115 |
Correct |
425 ms |
119156 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
158 ms |
119064 KB |
Output is correct |
2 |
Correct |
161 ms |
119128 KB |
Output is correct |
3 |
Correct |
172 ms |
119160 KB |
Output is correct |
4 |
Correct |
162 ms |
119152 KB |
Output is correct |
5 |
Correct |
180 ms |
119032 KB |
Output is correct |
6 |
Correct |
176 ms |
119072 KB |
Output is correct |
7 |
Correct |
156 ms |
119164 KB |
Output is correct |
8 |
Correct |
159 ms |
119156 KB |
Output is correct |
9 |
Correct |
182 ms |
119252 KB |
Output is correct |
10 |
Correct |
164 ms |
119220 KB |
Output is correct |
11 |
Correct |
182 ms |
119264 KB |
Output is correct |
12 |
Correct |
162 ms |
119044 KB |
Output is correct |
13 |
Correct |
159 ms |
119060 KB |
Output is correct |
14 |
Correct |
201 ms |
119164 KB |
Output is correct |
15 |
Correct |
258 ms |
119108 KB |
Output is correct |
16 |
Correct |
328 ms |
119236 KB |
Output is correct |
17 |
Correct |
301 ms |
119192 KB |
Output is correct |
18 |
Correct |
311 ms |
119148 KB |
Output is correct |
19 |
Correct |
311 ms |
119156 KB |
Output is correct |
20 |
Correct |
294 ms |
119084 KB |
Output is correct |
21 |
Correct |
297 ms |
119128 KB |
Output is correct |
22 |
Correct |
339 ms |
119352 KB |
Output is correct |
23 |
Correct |
309 ms |
119280 KB |
Output is correct |
24 |
Correct |
303 ms |
119160 KB |
Output is correct |
25 |
Correct |
302 ms |
119160 KB |
Output is correct |
26 |
Correct |
181 ms |
119052 KB |
Output is correct |
27 |
Correct |
167 ms |
119180 KB |
Output is correct |
28 |
Correct |
159 ms |
119128 KB |
Output is correct |
29 |
Correct |
209 ms |
119152 KB |
Output is correct |
30 |
Correct |
289 ms |
119160 KB |
Output is correct |
31 |
Correct |
312 ms |
119084 KB |
Output is correct |
32 |
Correct |
322 ms |
119112 KB |
Output is correct |
33 |
Correct |
322 ms |
119200 KB |
Output is correct |
34 |
Correct |
321 ms |
119280 KB |
Output is correct |
35 |
Correct |
337 ms |
119184 KB |
Output is correct |
36 |
Correct |
312 ms |
119276 KB |
Output is correct |
37 |
Correct |
320 ms |
119260 KB |
Output is correct |
38 |
Correct |
311 ms |
119156 KB |
Output is correct |
39 |
Correct |
328 ms |
119104 KB |
Output is correct |
40 |
Correct |
343 ms |
119272 KB |
Output is correct |
41 |
Correct |
166 ms |
119112 KB |
Output is correct |
42 |
Correct |
175 ms |
119156 KB |
Output is correct |
43 |
Correct |
167 ms |
119236 KB |
Output is correct |
44 |
Correct |
202 ms |
119104 KB |
Output is correct |
45 |
Correct |
171 ms |
119156 KB |
Output is correct |
46 |
Correct |
205 ms |
119204 KB |
Output is correct |
47 |
Correct |
200 ms |
119108 KB |
Output is correct |
48 |
Correct |
202 ms |
119108 KB |
Output is correct |
49 |
Correct |
246 ms |
119104 KB |
Output is correct |
50 |
Correct |
330 ms |
119160 KB |
Output is correct |
51 |
Correct |
399 ms |
119108 KB |
Output is correct |
52 |
Correct |
418 ms |
119160 KB |
Output is correct |
53 |
Correct |
370 ms |
119108 KB |
Output is correct |
54 |
Correct |
412 ms |
119236 KB |
Output is correct |
55 |
Correct |
391 ms |
119236 KB |
Output is correct |
56 |
Correct |
389 ms |
119104 KB |
Output is correct |
57 |
Correct |
411 ms |
119236 KB |
Output is correct |
58 |
Correct |
387 ms |
119108 KB |
Output is correct |
59 |
Correct |
427 ms |
119156 KB |
Output is correct |
60 |
Correct |
382 ms |
119108 KB |
Output is correct |
61 |
Correct |
410 ms |
119264 KB |
Output is correct |
62 |
Correct |
381 ms |
119236 KB |
Output is correct |
63 |
Correct |
412 ms |
119220 KB |
Output is correct |
64 |
Correct |
399 ms |
119164 KB |
Output is correct |
65 |
Correct |
401 ms |
119156 KB |
Output is correct |
66 |
Correct |
431 ms |
119156 KB |
Output is correct |
67 |
Correct |
382 ms |
119236 KB |
Output is correct |
68 |
Correct |
388 ms |
119196 KB |
Output is correct |
69 |
Correct |
405 ms |
119164 KB |
Output is correct |
70 |
Correct |
391 ms |
119164 KB |
Output is correct |
71 |
Correct |
210 ms |
119116 KB |
Output is correct |
72 |
Correct |
203 ms |
119160 KB |
Output is correct |
73 |
Correct |
209 ms |
119216 KB |
Output is correct |
74 |
Correct |
217 ms |
119244 KB |
Output is correct |
75 |
Correct |
224 ms |
119036 KB |
Output is correct |
76 |
Correct |
268 ms |
119088 KB |
Output is correct |
77 |
Correct |
251 ms |
119092 KB |
Output is correct |
78 |
Correct |
253 ms |
119160 KB |
Output is correct |
79 |
Correct |
252 ms |
119036 KB |
Output is correct |
80 |
Correct |
256 ms |
119164 KB |
Output is correct |
81 |
Correct |
382 ms |
119160 KB |
Output is correct |
82 |
Correct |
335 ms |
119156 KB |
Output is correct |
83 |
Correct |
378 ms |
119208 KB |
Output is correct |
84 |
Correct |
329 ms |
119156 KB |
Output is correct |
85 |
Correct |
379 ms |
119160 KB |
Output is correct |
86 |
Correct |
340 ms |
119164 KB |
Output is correct |
87 |
Correct |
373 ms |
119268 KB |
Output is correct |
88 |
Correct |
350 ms |
119164 KB |
Output is correct |
89 |
Correct |
334 ms |
119280 KB |
Output is correct |
90 |
Correct |
340 ms |
119160 KB |
Output is correct |
91 |
Correct |
431 ms |
119160 KB |
Output is correct |
92 |
Correct |
460 ms |
119212 KB |
Output is correct |
93 |
Correct |
471 ms |
119236 KB |
Output is correct |
94 |
Correct |
445 ms |
119236 KB |
Output is correct |
95 |
Correct |
460 ms |
119280 KB |
Output is correct |
96 |
Correct |
445 ms |
119156 KB |
Output is correct |
97 |
Correct |
449 ms |
119164 KB |
Output is correct |
98 |
Correct |
445 ms |
119160 KB |
Output is correct |
99 |
Correct |
433 ms |
119284 KB |
Output is correct |
100 |
Correct |
461 ms |
119160 KB |
Output is correct |
101 |
Correct |
435 ms |
119156 KB |
Output is correct |
102 |
Correct |
465 ms |
119156 KB |
Output is correct |
103 |
Correct |
448 ms |
119068 KB |
Output is correct |
104 |
Correct |
459 ms |
119280 KB |
Output is correct |
105 |
Correct |
426 ms |
119240 KB |
Output is correct |
106 |
Correct |
456 ms |
119048 KB |
Output is correct |
107 |
Correct |
434 ms |
119232 KB |
Output is correct |
108 |
Correct |
447 ms |
119160 KB |
Output is correct |
109 |
Correct |
461 ms |
119124 KB |
Output is correct |
110 |
Correct |
434 ms |
119164 KB |
Output is correct |
111 |
Correct |
429 ms |
119160 KB |
Output is correct |
112 |
Correct |
454 ms |
119104 KB |
Output is correct |
113 |
Correct |
476 ms |
119156 KB |
Output is correct |
114 |
Correct |
432 ms |
119156 KB |
Output is correct |
115 |
Correct |
425 ms |
119156 KB |
Output is correct |
116 |
Correct |
4994 ms |
120132 KB |
Output is correct |
117 |
Correct |
5250 ms |
120132 KB |
Output is correct |
118 |
Execution timed out |
7044 ms |
119640 KB |
Time limit exceeded |
119 |
Halted |
0 ms |
0 KB |
- |