#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#define mi(x, y) (x = min(x, y))
#define ma(x, y) (x = max(x, y))
using namespace std;
const int NS = (int)3e5 + 4, TS = 150014, QS = 50004;
int n, q, B;
long long t2[TS], t4[TS];
int t1[TS], t3[TS];
int a[NS];
int stkn;
int fir[NS], ed[NS], cnt[NS], pos[NS], stk[NS];
long long out[QS];
struct Data{
int l, r, id;
Data(){}
bool operator<(const Data&R)const{
if(l / B == R.l / B) return ((l / B & 1) ? r > R.r : r < R.r);
return (l / B < R.l / B);
}
}que[QS];
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
memset(ed, -1, sizeof(ed));
register int i, j;
int n, q;
cin >> n >> q;
//n = 300000, q = 50000;
for(i = 1; i <= n; ++i){
cin >> a[i];
//a[i] = i;
}
for(i = 1; i <= q; ++i){
cin >> que[i].l >> que[i].r;
//que[i].l = i, que[i].r = i * 6;
que[i].id = i;
}
B = 1500;
sort(que + 1, que + q + 1);
int l = 1, r = 0;
long long ans = 0, szans = 0;
auto upd = [&](int p, int v, int osz){
--p;
//cout << p << ' ' << v << ' ' << osz << endl;
//cout << fir[2] << ' ' << fir[3] << endl;
szans += (osz + (v > 0 ? v : 0)) * v;
ans += (osz + (v > 0 ? v : 0)) * v;
if(p % 2){
long long t1a = 0, t2a = 0, t3a = 0, t4a = 0;
long long t1p = 0, t2p = 0;
for(i = TS - 1; i > 0; i -= (i & -i)){
t1a += t1[i], t2a += t2[i], t3a += t3[i], t4a += t4[i];
}
for(i = p / 2 + 1; i > 0; i -= (i & -i)){
t1p += t1[i], t2p += t2[i];
}
t1a -= osz, t1p -= osz, t2a -= osz * (p / 2), t2p -= osz * (p / 2);
szans += v * (t3a + t1a);
//cout << ans << ' ' << szans << ' ' << t3a << ' ' << t4a << endl;
ans += 2 * v * t3a + (p / 2) * v * t3a + t4a * v;
ans += v * t1a + ((p / 2) * v * t1p - t2p * v) - ((p / 2) * v * (t1a - t1p) - (t2a - t2p) * v);
for(i = p / 2 + 1; i < TS; i += (i & -i)){
t1[i] += v;
t2[i] += v * (p / 2);
}
}
else{
long long t1a = 0, t2a = 0, t3a = 0, t4a = 0;
long long t3p = 0, t4p = 0;
for(i = TS - 1; i > 0; i -= (i & -i)){
t1a += t1[i], t2a += t2[i], t3a += t3[i], t4a += t4[i];
}
for(i = p / 2 + 1; i > 0; i -= (i & -i)){
t3p += t3[i], t4p += t4[i];
}
t3a -= osz, t3p -= osz, t4a -= osz * (p / 2), t4p -= osz * (p / 2);
//cout << "SDF" << ' ' << t1a << ' ' << t2a << ' ' << t3a << ' ' << t4a << ' ' << t3p << ' ' << t4p << endl;
szans += v * (t1a + t3a);
ans += 2 * v * t1a + (p / 2) * v * t1a + t2a * v;
ans += v * t3a + ((p / 2) * v * t3p - t4p * v) - ((p / 2) * v * (t3a - t3p) - (t4a - t4p) * v);
for(i = p / 2 + 1; i < TS; i += (i & -i)){
t3[i] += v;
t4[i] += v * (p / 2);
}
}
//cout << ans << ' ' << szans << endl;
};
auto add = [&](int val){
if(!cnt[val]) pos[val] = ++stkn, stk[stkn] = val;
int ch1 = pos[val], osz = cnt[val];
if(cnt[val] && stk[fir[cnt[val]]] != val){
int nxt = stk[fir[cnt[val]]];
ch1 = pos[nxt];
swap(stk[pos[val]], stk[pos[nxt]]);
swap(pos[val], pos[nxt]);
}
++fir[cnt[val]];
++cnt[val];
if(fir[cnt[val]] > ed[cnt[val]]) fir[cnt[val]] = ed[cnt[val]] = pos[val];
else ++ed[cnt[val]];
upd(ch1, 1, osz);
};
auto del = [&](int val){
int ch1 = pos[val], osz = cnt[val];
if(cnt[val] && stk[ed[cnt[val]]] != val){
int nxt = stk[ed[cnt[val]]];
ch1 = pos[nxt];
swap(stk[pos[val]], stk[pos[nxt]]);
swap(pos[val], pos[nxt]);
}
--ed[cnt[val]];
--cnt[val];
if(fir[cnt[val]] > ed[cnt[val]]) fir[cnt[val]] = ed[cnt[val]] = pos[val];
else --fir[cnt[val]];
upd(ch1, -1, osz);
if(!cnt[val]) stk[stkn] = 0, --stkn, pos[val] = 0;
};
for(int i = 1; i <= q; ++i){
while(r < que[i].r){
++r;
add(a[r]);
}
while(l > que[i].l){
--l;
add(a[l]);
}
while(r > que[i].r){
del(a[r]);
--r;
}
while(l < que[i].l){
del(a[l]);
++l;
}
out[que[i].id] = ans - szans * stkn + (long long)stkn * (que[i].r - que[i].l + 1) * (que[i].r - que[i].l + 2) / 2;
}
for(i = 1; i <= q; ++i){
cout << out[i] << '\n';
}
return 0;
}
Compilation message
diversity.cpp: In function 'int main()':
diversity.cpp:32:21: warning: unused variable 'j' [-Wunused-variable]
32 | register int i, j;
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1512 KB |
Output is correct |
2 |
Correct |
1 ms |
1620 KB |
Output is correct |
3 |
Correct |
1 ms |
1620 KB |
Output is correct |
4 |
Correct |
1 ms |
1620 KB |
Output is correct |
5 |
Correct |
1 ms |
1620 KB |
Output is correct |
6 |
Correct |
1 ms |
1640 KB |
Output is correct |
7 |
Correct |
1 ms |
1620 KB |
Output is correct |
8 |
Correct |
1 ms |
1636 KB |
Output is correct |
9 |
Correct |
1 ms |
1632 KB |
Output is correct |
10 |
Correct |
1 ms |
1620 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1620 KB |
Output is correct |
2 |
Correct |
2 ms |
1620 KB |
Output is correct |
3 |
Correct |
3 ms |
1748 KB |
Output is correct |
4 |
Correct |
22 ms |
2336 KB |
Output is correct |
5 |
Correct |
41 ms |
3116 KB |
Output is correct |
6 |
Correct |
53 ms |
3748 KB |
Output is correct |
7 |
Correct |
54 ms |
4032 KB |
Output is correct |
8 |
Correct |
51 ms |
3632 KB |
Output is correct |
9 |
Correct |
54 ms |
3684 KB |
Output is correct |
10 |
Correct |
54 ms |
3776 KB |
Output is correct |
11 |
Correct |
65 ms |
3716 KB |
Output is correct |
12 |
Correct |
53 ms |
3640 KB |
Output is correct |
13 |
Correct |
52 ms |
3660 KB |
Output is correct |
14 |
Correct |
53 ms |
3688 KB |
Output is correct |
15 |
Correct |
65 ms |
3724 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1620 KB |
Output is correct |
2 |
Correct |
2 ms |
1620 KB |
Output is correct |
3 |
Correct |
3 ms |
1748 KB |
Output is correct |
4 |
Correct |
22 ms |
2336 KB |
Output is correct |
5 |
Correct |
41 ms |
3116 KB |
Output is correct |
6 |
Correct |
53 ms |
3748 KB |
Output is correct |
7 |
Correct |
54 ms |
4032 KB |
Output is correct |
8 |
Correct |
51 ms |
3632 KB |
Output is correct |
9 |
Correct |
54 ms |
3684 KB |
Output is correct |
10 |
Correct |
54 ms |
3776 KB |
Output is correct |
11 |
Correct |
65 ms |
3716 KB |
Output is correct |
12 |
Correct |
53 ms |
3640 KB |
Output is correct |
13 |
Correct |
52 ms |
3660 KB |
Output is correct |
14 |
Correct |
53 ms |
3688 KB |
Output is correct |
15 |
Correct |
65 ms |
3724 KB |
Output is correct |
16 |
Correct |
1 ms |
1620 KB |
Output is correct |
17 |
Correct |
1 ms |
1620 KB |
Output is correct |
18 |
Correct |
3 ms |
1644 KB |
Output is correct |
19 |
Correct |
18 ms |
2388 KB |
Output is correct |
20 |
Correct |
37 ms |
3000 KB |
Output is correct |
21 |
Correct |
53 ms |
3880 KB |
Output is correct |
22 |
Correct |
55 ms |
3868 KB |
Output is correct |
23 |
Correct |
57 ms |
3820 KB |
Output is correct |
24 |
Correct |
62 ms |
3660 KB |
Output is correct |
25 |
Correct |
56 ms |
3772 KB |
Output is correct |
26 |
Correct |
53 ms |
3728 KB |
Output is correct |
27 |
Correct |
52 ms |
3748 KB |
Output is correct |
28 |
Correct |
55 ms |
3872 KB |
Output is correct |
29 |
Correct |
53 ms |
3668 KB |
Output is correct |
30 |
Correct |
51 ms |
3764 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1620 KB |
Output is correct |
2 |
Correct |
2 ms |
1620 KB |
Output is correct |
3 |
Correct |
3 ms |
1748 KB |
Output is correct |
4 |
Correct |
22 ms |
2336 KB |
Output is correct |
5 |
Correct |
41 ms |
3116 KB |
Output is correct |
6 |
Correct |
53 ms |
3748 KB |
Output is correct |
7 |
Correct |
54 ms |
4032 KB |
Output is correct |
8 |
Correct |
51 ms |
3632 KB |
Output is correct |
9 |
Correct |
54 ms |
3684 KB |
Output is correct |
10 |
Correct |
54 ms |
3776 KB |
Output is correct |
11 |
Correct |
65 ms |
3716 KB |
Output is correct |
12 |
Correct |
53 ms |
3640 KB |
Output is correct |
13 |
Correct |
52 ms |
3660 KB |
Output is correct |
14 |
Correct |
53 ms |
3688 KB |
Output is correct |
15 |
Correct |
65 ms |
3724 KB |
Output is correct |
16 |
Correct |
1 ms |
1620 KB |
Output is correct |
17 |
Correct |
1 ms |
1620 KB |
Output is correct |
18 |
Correct |
3 ms |
1644 KB |
Output is correct |
19 |
Correct |
18 ms |
2388 KB |
Output is correct |
20 |
Correct |
37 ms |
3000 KB |
Output is correct |
21 |
Correct |
53 ms |
3880 KB |
Output is correct |
22 |
Correct |
55 ms |
3868 KB |
Output is correct |
23 |
Correct |
57 ms |
3820 KB |
Output is correct |
24 |
Correct |
62 ms |
3660 KB |
Output is correct |
25 |
Correct |
56 ms |
3772 KB |
Output is correct |
26 |
Correct |
53 ms |
3728 KB |
Output is correct |
27 |
Correct |
52 ms |
3748 KB |
Output is correct |
28 |
Correct |
55 ms |
3872 KB |
Output is correct |
29 |
Correct |
53 ms |
3668 KB |
Output is correct |
30 |
Correct |
51 ms |
3764 KB |
Output is correct |
31 |
Correct |
1 ms |
1620 KB |
Output is correct |
32 |
Correct |
1 ms |
1620 KB |
Output is correct |
33 |
Correct |
1 ms |
1636 KB |
Output is correct |
34 |
Correct |
3 ms |
1644 KB |
Output is correct |
35 |
Correct |
3 ms |
1748 KB |
Output is correct |
36 |
Correct |
4 ms |
1748 KB |
Output is correct |
37 |
Correct |
11 ms |
2076 KB |
Output is correct |
38 |
Correct |
11 ms |
2004 KB |
Output is correct |
39 |
Correct |
21 ms |
2476 KB |
Output is correct |
40 |
Correct |
36 ms |
3236 KB |
Output is correct |
41 |
Correct |
54 ms |
4100 KB |
Output is correct |
42 |
Correct |
52 ms |
4008 KB |
Output is correct |
43 |
Correct |
57 ms |
3996 KB |
Output is correct |
44 |
Correct |
52 ms |
4016 KB |
Output is correct |
45 |
Correct |
55 ms |
4128 KB |
Output is correct |
46 |
Correct |
57 ms |
3972 KB |
Output is correct |
47 |
Correct |
60 ms |
4004 KB |
Output is correct |
48 |
Correct |
53 ms |
4004 KB |
Output is correct |
49 |
Correct |
54 ms |
3992 KB |
Output is correct |
50 |
Correct |
54 ms |
3952 KB |
Output is correct |
51 |
Correct |
52 ms |
3944 KB |
Output is correct |
52 |
Correct |
65 ms |
4004 KB |
Output is correct |
53 |
Correct |
55 ms |
3920 KB |
Output is correct |
54 |
Correct |
57 ms |
3924 KB |
Output is correct |
55 |
Correct |
53 ms |
3916 KB |
Output is correct |
56 |
Correct |
53 ms |
3996 KB |
Output is correct |
57 |
Correct |
56 ms |
3916 KB |
Output is correct |
58 |
Correct |
56 ms |
3944 KB |
Output is correct |
59 |
Correct |
56 ms |
4128 KB |
Output is correct |
60 |
Correct |
54 ms |
3996 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1512 KB |
Output is correct |
2 |
Correct |
1 ms |
1620 KB |
Output is correct |
3 |
Correct |
1 ms |
1620 KB |
Output is correct |
4 |
Correct |
1 ms |
1620 KB |
Output is correct |
5 |
Correct |
1 ms |
1620 KB |
Output is correct |
6 |
Correct |
1 ms |
1640 KB |
Output is correct |
7 |
Correct |
1 ms |
1620 KB |
Output is correct |
8 |
Correct |
1 ms |
1636 KB |
Output is correct |
9 |
Correct |
1 ms |
1632 KB |
Output is correct |
10 |
Correct |
1 ms |
1620 KB |
Output is correct |
11 |
Correct |
1 ms |
1620 KB |
Output is correct |
12 |
Correct |
2 ms |
1620 KB |
Output is correct |
13 |
Correct |
3 ms |
1748 KB |
Output is correct |
14 |
Correct |
22 ms |
2336 KB |
Output is correct |
15 |
Correct |
41 ms |
3116 KB |
Output is correct |
16 |
Correct |
53 ms |
3748 KB |
Output is correct |
17 |
Correct |
54 ms |
4032 KB |
Output is correct |
18 |
Correct |
51 ms |
3632 KB |
Output is correct |
19 |
Correct |
54 ms |
3684 KB |
Output is correct |
20 |
Correct |
54 ms |
3776 KB |
Output is correct |
21 |
Correct |
65 ms |
3716 KB |
Output is correct |
22 |
Correct |
53 ms |
3640 KB |
Output is correct |
23 |
Correct |
52 ms |
3660 KB |
Output is correct |
24 |
Correct |
53 ms |
3688 KB |
Output is correct |
25 |
Correct |
65 ms |
3724 KB |
Output is correct |
26 |
Correct |
1 ms |
1620 KB |
Output is correct |
27 |
Correct |
1 ms |
1620 KB |
Output is correct |
28 |
Correct |
3 ms |
1644 KB |
Output is correct |
29 |
Correct |
18 ms |
2388 KB |
Output is correct |
30 |
Correct |
37 ms |
3000 KB |
Output is correct |
31 |
Correct |
53 ms |
3880 KB |
Output is correct |
32 |
Correct |
55 ms |
3868 KB |
Output is correct |
33 |
Correct |
57 ms |
3820 KB |
Output is correct |
34 |
Correct |
62 ms |
3660 KB |
Output is correct |
35 |
Correct |
56 ms |
3772 KB |
Output is correct |
36 |
Correct |
53 ms |
3728 KB |
Output is correct |
37 |
Correct |
52 ms |
3748 KB |
Output is correct |
38 |
Correct |
55 ms |
3872 KB |
Output is correct |
39 |
Correct |
53 ms |
3668 KB |
Output is correct |
40 |
Correct |
51 ms |
3764 KB |
Output is correct |
41 |
Correct |
1 ms |
1620 KB |
Output is correct |
42 |
Correct |
1 ms |
1620 KB |
Output is correct |
43 |
Correct |
1 ms |
1636 KB |
Output is correct |
44 |
Correct |
3 ms |
1644 KB |
Output is correct |
45 |
Correct |
3 ms |
1748 KB |
Output is correct |
46 |
Correct |
4 ms |
1748 KB |
Output is correct |
47 |
Correct |
11 ms |
2076 KB |
Output is correct |
48 |
Correct |
11 ms |
2004 KB |
Output is correct |
49 |
Correct |
21 ms |
2476 KB |
Output is correct |
50 |
Correct |
36 ms |
3236 KB |
Output is correct |
51 |
Correct |
54 ms |
4100 KB |
Output is correct |
52 |
Correct |
52 ms |
4008 KB |
Output is correct |
53 |
Correct |
57 ms |
3996 KB |
Output is correct |
54 |
Correct |
52 ms |
4016 KB |
Output is correct |
55 |
Correct |
55 ms |
4128 KB |
Output is correct |
56 |
Correct |
57 ms |
3972 KB |
Output is correct |
57 |
Correct |
60 ms |
4004 KB |
Output is correct |
58 |
Correct |
53 ms |
4004 KB |
Output is correct |
59 |
Correct |
54 ms |
3992 KB |
Output is correct |
60 |
Correct |
54 ms |
3952 KB |
Output is correct |
61 |
Correct |
52 ms |
3944 KB |
Output is correct |
62 |
Correct |
65 ms |
4004 KB |
Output is correct |
63 |
Correct |
55 ms |
3920 KB |
Output is correct |
64 |
Correct |
57 ms |
3924 KB |
Output is correct |
65 |
Correct |
53 ms |
3916 KB |
Output is correct |
66 |
Correct |
53 ms |
3996 KB |
Output is correct |
67 |
Correct |
56 ms |
3916 KB |
Output is correct |
68 |
Correct |
56 ms |
3944 KB |
Output is correct |
69 |
Correct |
56 ms |
4128 KB |
Output is correct |
70 |
Correct |
54 ms |
3996 KB |
Output is correct |
71 |
Correct |
10 ms |
2132 KB |
Output is correct |
72 |
Correct |
11 ms |
2060 KB |
Output is correct |
73 |
Correct |
15 ms |
2132 KB |
Output is correct |
74 |
Correct |
11 ms |
2128 KB |
Output is correct |
75 |
Correct |
13 ms |
2132 KB |
Output is correct |
76 |
Correct |
21 ms |
2624 KB |
Output is correct |
77 |
Correct |
19 ms |
2544 KB |
Output is correct |
78 |
Correct |
19 ms |
2612 KB |
Output is correct |
79 |
Correct |
19 ms |
2532 KB |
Output is correct |
80 |
Correct |
20 ms |
2616 KB |
Output is correct |
81 |
Correct |
40 ms |
3572 KB |
Output is correct |
82 |
Correct |
37 ms |
3504 KB |
Output is correct |
83 |
Correct |
37 ms |
3660 KB |
Output is correct |
84 |
Correct |
37 ms |
3544 KB |
Output is correct |
85 |
Correct |
39 ms |
3608 KB |
Output is correct |
86 |
Correct |
40 ms |
3932 KB |
Output is correct |
87 |
Correct |
44 ms |
3928 KB |
Output is correct |
88 |
Correct |
39 ms |
3872 KB |
Output is correct |
89 |
Correct |
41 ms |
3936 KB |
Output is correct |
90 |
Correct |
40 ms |
3936 KB |
Output is correct |
91 |
Correct |
60 ms |
6776 KB |
Output is correct |
92 |
Correct |
74 ms |
6764 KB |
Output is correct |
93 |
Correct |
56 ms |
6852 KB |
Output is correct |
94 |
Correct |
58 ms |
6860 KB |
Output is correct |
95 |
Correct |
57 ms |
6780 KB |
Output is correct |
96 |
Correct |
63 ms |
8916 KB |
Output is correct |
97 |
Correct |
62 ms |
8928 KB |
Output is correct |
98 |
Correct |
60 ms |
8764 KB |
Output is correct |
99 |
Correct |
66 ms |
8764 KB |
Output is correct |
100 |
Correct |
61 ms |
8652 KB |
Output is correct |
101 |
Correct |
66 ms |
8608 KB |
Output is correct |
102 |
Correct |
63 ms |
8432 KB |
Output is correct |
103 |
Correct |
67 ms |
8380 KB |
Output is correct |
104 |
Correct |
61 ms |
8260 KB |
Output is correct |
105 |
Correct |
68 ms |
8296 KB |
Output is correct |
106 |
Correct |
66 ms |
9420 KB |
Output is correct |
107 |
Correct |
59 ms |
9492 KB |
Output is correct |
108 |
Correct |
61 ms |
9364 KB |
Output is correct |
109 |
Correct |
59 ms |
9392 KB |
Output is correct |
110 |
Correct |
73 ms |
9304 KB |
Output is correct |
111 |
Correct |
58 ms |
9292 KB |
Output is correct |
112 |
Correct |
83 ms |
9280 KB |
Output is correct |
113 |
Correct |
83 ms |
9388 KB |
Output is correct |
114 |
Correct |
58 ms |
9276 KB |
Output is correct |
115 |
Correct |
63 ms |
9376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1512 KB |
Output is correct |
2 |
Correct |
1 ms |
1620 KB |
Output is correct |
3 |
Correct |
1 ms |
1620 KB |
Output is correct |
4 |
Correct |
1 ms |
1620 KB |
Output is correct |
5 |
Correct |
1 ms |
1620 KB |
Output is correct |
6 |
Correct |
1 ms |
1640 KB |
Output is correct |
7 |
Correct |
1 ms |
1620 KB |
Output is correct |
8 |
Correct |
1 ms |
1636 KB |
Output is correct |
9 |
Correct |
1 ms |
1632 KB |
Output is correct |
10 |
Correct |
1 ms |
1620 KB |
Output is correct |
11 |
Correct |
1 ms |
1620 KB |
Output is correct |
12 |
Correct |
2 ms |
1620 KB |
Output is correct |
13 |
Correct |
3 ms |
1748 KB |
Output is correct |
14 |
Correct |
22 ms |
2336 KB |
Output is correct |
15 |
Correct |
41 ms |
3116 KB |
Output is correct |
16 |
Correct |
53 ms |
3748 KB |
Output is correct |
17 |
Correct |
54 ms |
4032 KB |
Output is correct |
18 |
Correct |
51 ms |
3632 KB |
Output is correct |
19 |
Correct |
54 ms |
3684 KB |
Output is correct |
20 |
Correct |
54 ms |
3776 KB |
Output is correct |
21 |
Correct |
65 ms |
3716 KB |
Output is correct |
22 |
Correct |
53 ms |
3640 KB |
Output is correct |
23 |
Correct |
52 ms |
3660 KB |
Output is correct |
24 |
Correct |
53 ms |
3688 KB |
Output is correct |
25 |
Correct |
65 ms |
3724 KB |
Output is correct |
26 |
Correct |
1 ms |
1620 KB |
Output is correct |
27 |
Correct |
1 ms |
1620 KB |
Output is correct |
28 |
Correct |
3 ms |
1644 KB |
Output is correct |
29 |
Correct |
18 ms |
2388 KB |
Output is correct |
30 |
Correct |
37 ms |
3000 KB |
Output is correct |
31 |
Correct |
53 ms |
3880 KB |
Output is correct |
32 |
Correct |
55 ms |
3868 KB |
Output is correct |
33 |
Correct |
57 ms |
3820 KB |
Output is correct |
34 |
Correct |
62 ms |
3660 KB |
Output is correct |
35 |
Correct |
56 ms |
3772 KB |
Output is correct |
36 |
Correct |
53 ms |
3728 KB |
Output is correct |
37 |
Correct |
52 ms |
3748 KB |
Output is correct |
38 |
Correct |
55 ms |
3872 KB |
Output is correct |
39 |
Correct |
53 ms |
3668 KB |
Output is correct |
40 |
Correct |
51 ms |
3764 KB |
Output is correct |
41 |
Correct |
1 ms |
1620 KB |
Output is correct |
42 |
Correct |
1 ms |
1620 KB |
Output is correct |
43 |
Correct |
1 ms |
1636 KB |
Output is correct |
44 |
Correct |
3 ms |
1644 KB |
Output is correct |
45 |
Correct |
3 ms |
1748 KB |
Output is correct |
46 |
Correct |
4 ms |
1748 KB |
Output is correct |
47 |
Correct |
11 ms |
2076 KB |
Output is correct |
48 |
Correct |
11 ms |
2004 KB |
Output is correct |
49 |
Correct |
21 ms |
2476 KB |
Output is correct |
50 |
Correct |
36 ms |
3236 KB |
Output is correct |
51 |
Correct |
54 ms |
4100 KB |
Output is correct |
52 |
Correct |
52 ms |
4008 KB |
Output is correct |
53 |
Correct |
57 ms |
3996 KB |
Output is correct |
54 |
Correct |
52 ms |
4016 KB |
Output is correct |
55 |
Correct |
55 ms |
4128 KB |
Output is correct |
56 |
Correct |
57 ms |
3972 KB |
Output is correct |
57 |
Correct |
60 ms |
4004 KB |
Output is correct |
58 |
Correct |
53 ms |
4004 KB |
Output is correct |
59 |
Correct |
54 ms |
3992 KB |
Output is correct |
60 |
Correct |
54 ms |
3952 KB |
Output is correct |
61 |
Correct |
52 ms |
3944 KB |
Output is correct |
62 |
Correct |
65 ms |
4004 KB |
Output is correct |
63 |
Correct |
55 ms |
3920 KB |
Output is correct |
64 |
Correct |
57 ms |
3924 KB |
Output is correct |
65 |
Correct |
53 ms |
3916 KB |
Output is correct |
66 |
Correct |
53 ms |
3996 KB |
Output is correct |
67 |
Correct |
56 ms |
3916 KB |
Output is correct |
68 |
Correct |
56 ms |
3944 KB |
Output is correct |
69 |
Correct |
56 ms |
4128 KB |
Output is correct |
70 |
Correct |
54 ms |
3996 KB |
Output is correct |
71 |
Correct |
10 ms |
2132 KB |
Output is correct |
72 |
Correct |
11 ms |
2060 KB |
Output is correct |
73 |
Correct |
15 ms |
2132 KB |
Output is correct |
74 |
Correct |
11 ms |
2128 KB |
Output is correct |
75 |
Correct |
13 ms |
2132 KB |
Output is correct |
76 |
Correct |
21 ms |
2624 KB |
Output is correct |
77 |
Correct |
19 ms |
2544 KB |
Output is correct |
78 |
Correct |
19 ms |
2612 KB |
Output is correct |
79 |
Correct |
19 ms |
2532 KB |
Output is correct |
80 |
Correct |
20 ms |
2616 KB |
Output is correct |
81 |
Correct |
40 ms |
3572 KB |
Output is correct |
82 |
Correct |
37 ms |
3504 KB |
Output is correct |
83 |
Correct |
37 ms |
3660 KB |
Output is correct |
84 |
Correct |
37 ms |
3544 KB |
Output is correct |
85 |
Correct |
39 ms |
3608 KB |
Output is correct |
86 |
Correct |
40 ms |
3932 KB |
Output is correct |
87 |
Correct |
44 ms |
3928 KB |
Output is correct |
88 |
Correct |
39 ms |
3872 KB |
Output is correct |
89 |
Correct |
41 ms |
3936 KB |
Output is correct |
90 |
Correct |
40 ms |
3936 KB |
Output is correct |
91 |
Correct |
60 ms |
6776 KB |
Output is correct |
92 |
Correct |
74 ms |
6764 KB |
Output is correct |
93 |
Correct |
56 ms |
6852 KB |
Output is correct |
94 |
Correct |
58 ms |
6860 KB |
Output is correct |
95 |
Correct |
57 ms |
6780 KB |
Output is correct |
96 |
Correct |
63 ms |
8916 KB |
Output is correct |
97 |
Correct |
62 ms |
8928 KB |
Output is correct |
98 |
Correct |
60 ms |
8764 KB |
Output is correct |
99 |
Correct |
66 ms |
8764 KB |
Output is correct |
100 |
Correct |
61 ms |
8652 KB |
Output is correct |
101 |
Correct |
66 ms |
8608 KB |
Output is correct |
102 |
Correct |
63 ms |
8432 KB |
Output is correct |
103 |
Correct |
67 ms |
8380 KB |
Output is correct |
104 |
Correct |
61 ms |
8260 KB |
Output is correct |
105 |
Correct |
68 ms |
8296 KB |
Output is correct |
106 |
Correct |
66 ms |
9420 KB |
Output is correct |
107 |
Correct |
59 ms |
9492 KB |
Output is correct |
108 |
Correct |
61 ms |
9364 KB |
Output is correct |
109 |
Correct |
59 ms |
9392 KB |
Output is correct |
110 |
Correct |
73 ms |
9304 KB |
Output is correct |
111 |
Correct |
58 ms |
9292 KB |
Output is correct |
112 |
Correct |
83 ms |
9280 KB |
Output is correct |
113 |
Correct |
83 ms |
9388 KB |
Output is correct |
114 |
Correct |
58 ms |
9276 KB |
Output is correct |
115 |
Correct |
63 ms |
9376 KB |
Output is correct |
116 |
Correct |
2977 ms |
3580 KB |
Output is correct |
117 |
Correct |
2707 ms |
3568 KB |
Output is correct |
118 |
Correct |
2893 ms |
3756 KB |
Output is correct |
119 |
Correct |
3022 ms |
3616 KB |
Output is correct |
120 |
Correct |
2847 ms |
3496 KB |
Output is correct |
121 |
Correct |
3119 ms |
3564 KB |
Output is correct |
122 |
Correct |
3071 ms |
3660 KB |
Output is correct |
123 |
Correct |
4358 ms |
4084 KB |
Output is correct |
124 |
Correct |
4501 ms |
4152 KB |
Output is correct |
125 |
Correct |
4237 ms |
4264 KB |
Output is correct |
126 |
Correct |
6290 ms |
4352 KB |
Output is correct |
127 |
Correct |
6255 ms |
6068 KB |
Output is correct |
128 |
Correct |
6372 ms |
6100 KB |
Output is correct |
129 |
Correct |
6356 ms |
6072 KB |
Output is correct |
130 |
Correct |
6262 ms |
6064 KB |
Output is correct |
131 |
Correct |
5942 ms |
6236 KB |
Output is correct |
132 |
Correct |
6141 ms |
6236 KB |
Output is correct |
133 |
Correct |
6149 ms |
6324 KB |
Output is correct |
134 |
Correct |
6350 ms |
6224 KB |
Output is correct |
135 |
Correct |
6236 ms |
6240 KB |
Output is correct |
136 |
Correct |
6189 ms |
6236 KB |
Output is correct |
137 |
Correct |
6296 ms |
6260 KB |
Output is correct |
138 |
Correct |
6458 ms |
6360 KB |
Output is correct |
139 |
Correct |
6125 ms |
6228 KB |
Output is correct |
140 |
Correct |
6104 ms |
6228 KB |
Output is correct |
141 |
Correct |
6316 ms |
6264 KB |
Output is correct |
142 |
Correct |
6291 ms |
6260 KB |
Output is correct |
143 |
Correct |
6246 ms |
6260 KB |
Output is correct |
144 |
Correct |
6054 ms |
6268 KB |
Output is correct |
145 |
Correct |
6346 ms |
6260 KB |
Output is correct |
146 |
Execution timed out |
7056 ms |
5836 KB |
Time limit exceeded |
147 |
Halted |
0 ms |
0 KB |
- |