#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
template <typename T>
class FenwickTree{
public:
T* FT;
int n;
bool negmode;
FenwickTree(int sz = 1 << 19, bool negindex = true){
n = sz+505;
FT = new T[n];
fill(FT, FT+n, (T)0);
negmode = negindex;
}
void add(int idx, T amt){
if(negmode) idx += n/2;
while(idx < n){
FT[idx] += amt;
idx += idx & -idx;
}
}
T sum(int idx){
if(negmode) idx += n/2;
T ret = (T)0;
while(idx > 0){
ret += FT[idx];
idx -= idx & -idx;
}
return ret;
}
int lower_bound(const int v){
if(v > FT[1]) return 0;
int cur = 1 << 18;
int part = FT[cur];
for(int i = 17; i >= 0; i--){
if(part >= v){
cur += 1 << i;
part += FT[cur];
}else{
part -= FT[cur];
cur -= 1 << i;
part += FT[cur];
}
}
if(part < v) return cur-1;
return cur;
}
int upper_bound(const int v){
return lower_bound(v+1);
}
};
FenwickTree<int> FT1; // Ri
FenwickTree<long long> FT2; // Ri * i
int cnt[300005];
int a[300005];
// abstract deque
// fenwick indexing:
// [...] [-3] [-2] [-1] [0] [1] [2] [...]
// deque indexing:
// [...] [6] [4] [2] [1] [3] [5] [...]
// invariant:
// dq[-i] <= dq[i] for all positive i
// dq[-i] >= dq[i+1] for all positive i
int dq2fw(int idx){
return idx/2 * (idx % 2 ? 1 : -1);
}
FenwickTree<int> dq(300000, false); // using deque indexing
long long deque_add(const int x){
int idx = dq.upper_bound(x)+1;
dq.add(idx, 1);
dq.add(idx+1, -1);
int b = dq2fw(idx);
FT1.add(b, 1);
FT2.add(b, b);
return FT2.FT[1 << 19] - FT2.sum(b) - 1ll * (b-1) * (FT1.FT[1 << 19] - FT1.sum(b))
+ 1ll * (b+1) * FT1.sum(b-1) - FT2.sum(b-1) + x+1;
}
long long deque_remove(const int x){
int idx = dq.lower_bound(x);
dq.add(idx, -1);
dq.add(idx+1, 1);
int b = dq2fw(idx);
FT1.add(b, -1);
FT2.add(b, -b);
return FT2.FT[1 << 19] - FT2.sum(b) - 1ll * (b-1) * (FT1.FT[1 << 19] - FT1.sum(b))
+ 1ll * (b+1) * FT1.sum(b-1) - FT2.sum(b-1) + x;
}
vector<tuple<int,int,int>> qbckt[300005]; // (L, R, Q)
long long answer[50005];
int qcnt[2048];
int main(){
int n,q;
scanf("%d%d",&n,&q);
for(int i = 1; i <= n; i++){
scanf("%d",a+i);
}
int SQRT = n/sqrt(q);
vector<pair<int,int>> rawq;
for(int i = 0; i < q; i++){
int l, r;
scanf("%d%d",&l,&r);
rawq.emplace_back(l,r);
qcnt[l/SQRT]++;
}
for(int i = 0; i <= n/SQRT+2; i++){
qbckt[i].reserve(qcnt[i]);
}
for(int i = 0; i < q; i++){
int l, r;
tie(l, r) = rawq[i];
qbckt[l / SQRT].emplace_back(l, r, i);
}
int lptr = 1;
int rptr = 0;
long long ans = 0ll;
for(int i = 0; i <= n/SQRT+2; i++){
lptr = 1;
rptr = 0;
ans = 0ll;
memset(FT1.FT, 0, 4*FT1.n);
memset(FT2.FT, 0, 4*FT2.n);
memset(dq.FT, 0, 4*dq.n);
sort(qbckt[i].begin(), qbckt[i].end(), [](tuple<int,int,int> x, tuple<int,int,int> y){
return get<1>(x) < get<1>(y);
});
// Below goes declaratively.
for(auto qr : qbckt[i]){
int l, r, qnum;
tie(l, r, qnum) = qr;
while(rptr < r){
rptr++;
ans += deque_add(cnt[a[rptr]]);
cnt[a[rptr]]++;
}
while(lptr > l){
lptr--;
ans += deque_add(cnt[a[lptr]]);
cnt[a[lptr]]++;
}
while(lptr < l){
ans -= deque_remove(cnt[a[lptr]]);
cnt[a[lptr]]--;
lptr++;
}
while(rptr > r){
ans -= deque_remove(cnt[a[rptr]]);
cnt[a[rptr]]--;
rptr--;
}
answer[qnum] = ans;
}
}
for(int i = 0; i < q; i++){
printf("%lld\n", answer[i]);
}
return 0;
}
Compilation message
diversity.cpp: In function 'int main()':
diversity.cpp:100:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
100 | scanf("%d%d",&n,&q);
| ~~~~~^~~~~~~~~~~~~~
diversity.cpp:102:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
102 | scanf("%d",a+i);
| ~~~~~^~~~~~~~~~
diversity.cpp:108:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
108 | scanf("%d%d",&l,&r);
| ~~~~~^~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
14628 KB |
Output is correct |
2 |
Correct |
9 ms |
14624 KB |
Output is correct |
3 |
Correct |
9 ms |
14668 KB |
Output is correct |
4 |
Correct |
9 ms |
14704 KB |
Output is correct |
5 |
Correct |
8 ms |
14668 KB |
Output is correct |
6 |
Correct |
8 ms |
14668 KB |
Output is correct |
7 |
Correct |
8 ms |
14656 KB |
Output is correct |
8 |
Correct |
9 ms |
14668 KB |
Output is correct |
9 |
Correct |
9 ms |
14712 KB |
Output is correct |
10 |
Correct |
8 ms |
14668 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
9 ms |
14708 KB |
Output is correct |
2 |
Correct |
9 ms |
14716 KB |
Output is correct |
3 |
Correct |
12 ms |
14668 KB |
Output is correct |
4 |
Correct |
35 ms |
15096 KB |
Output is correct |
5 |
Correct |
62 ms |
15436 KB |
Output is correct |
6 |
Correct |
100 ms |
15852 KB |
Output is correct |
7 |
Correct |
111 ms |
15836 KB |
Output is correct |
8 |
Correct |
91 ms |
15824 KB |
Output is correct |
9 |
Correct |
88 ms |
15820 KB |
Output is correct |
10 |
Correct |
90 ms |
15844 KB |
Output is correct |
11 |
Correct |
91 ms |
15836 KB |
Output is correct |
12 |
Correct |
118 ms |
15856 KB |
Output is correct |
13 |
Correct |
96 ms |
15860 KB |
Output is correct |
14 |
Correct |
87 ms |
15820 KB |
Output is correct |
15 |
Correct |
103 ms |
15864 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
9 ms |
14708 KB |
Output is correct |
2 |
Correct |
9 ms |
14716 KB |
Output is correct |
3 |
Correct |
12 ms |
14668 KB |
Output is correct |
4 |
Correct |
35 ms |
15096 KB |
Output is correct |
5 |
Correct |
62 ms |
15436 KB |
Output is correct |
6 |
Correct |
100 ms |
15852 KB |
Output is correct |
7 |
Correct |
111 ms |
15836 KB |
Output is correct |
8 |
Correct |
91 ms |
15824 KB |
Output is correct |
9 |
Correct |
88 ms |
15820 KB |
Output is correct |
10 |
Correct |
90 ms |
15844 KB |
Output is correct |
11 |
Correct |
91 ms |
15836 KB |
Output is correct |
12 |
Correct |
118 ms |
15856 KB |
Output is correct |
13 |
Correct |
96 ms |
15860 KB |
Output is correct |
14 |
Correct |
87 ms |
15820 KB |
Output is correct |
15 |
Correct |
103 ms |
15864 KB |
Output is correct |
16 |
Correct |
9 ms |
14596 KB |
Output is correct |
17 |
Correct |
8 ms |
14628 KB |
Output is correct |
18 |
Correct |
11 ms |
14668 KB |
Output is correct |
19 |
Correct |
37 ms |
15044 KB |
Output is correct |
20 |
Correct |
85 ms |
15468 KB |
Output is correct |
21 |
Correct |
99 ms |
15856 KB |
Output is correct |
22 |
Correct |
97 ms |
15864 KB |
Output is correct |
23 |
Correct |
92 ms |
15824 KB |
Output is correct |
24 |
Correct |
93 ms |
15856 KB |
Output is correct |
25 |
Correct |
94 ms |
15852 KB |
Output is correct |
26 |
Correct |
96 ms |
15844 KB |
Output is correct |
27 |
Correct |
91 ms |
15856 KB |
Output is correct |
28 |
Correct |
95 ms |
15844 KB |
Output is correct |
29 |
Correct |
91 ms |
15820 KB |
Output is correct |
30 |
Correct |
95 ms |
15820 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
9 ms |
14708 KB |
Output is correct |
2 |
Correct |
9 ms |
14716 KB |
Output is correct |
3 |
Correct |
12 ms |
14668 KB |
Output is correct |
4 |
Correct |
35 ms |
15096 KB |
Output is correct |
5 |
Correct |
62 ms |
15436 KB |
Output is correct |
6 |
Correct |
100 ms |
15852 KB |
Output is correct |
7 |
Correct |
111 ms |
15836 KB |
Output is correct |
8 |
Correct |
91 ms |
15824 KB |
Output is correct |
9 |
Correct |
88 ms |
15820 KB |
Output is correct |
10 |
Correct |
90 ms |
15844 KB |
Output is correct |
11 |
Correct |
91 ms |
15836 KB |
Output is correct |
12 |
Correct |
118 ms |
15856 KB |
Output is correct |
13 |
Correct |
96 ms |
15860 KB |
Output is correct |
14 |
Correct |
87 ms |
15820 KB |
Output is correct |
15 |
Correct |
103 ms |
15864 KB |
Output is correct |
16 |
Correct |
9 ms |
14596 KB |
Output is correct |
17 |
Correct |
8 ms |
14628 KB |
Output is correct |
18 |
Correct |
11 ms |
14668 KB |
Output is correct |
19 |
Correct |
37 ms |
15044 KB |
Output is correct |
20 |
Correct |
85 ms |
15468 KB |
Output is correct |
21 |
Correct |
99 ms |
15856 KB |
Output is correct |
22 |
Correct |
97 ms |
15864 KB |
Output is correct |
23 |
Correct |
92 ms |
15824 KB |
Output is correct |
24 |
Correct |
93 ms |
15856 KB |
Output is correct |
25 |
Correct |
94 ms |
15852 KB |
Output is correct |
26 |
Correct |
96 ms |
15844 KB |
Output is correct |
27 |
Correct |
91 ms |
15856 KB |
Output is correct |
28 |
Correct |
95 ms |
15844 KB |
Output is correct |
29 |
Correct |
91 ms |
15820 KB |
Output is correct |
30 |
Correct |
95 ms |
15820 KB |
Output is correct |
31 |
Correct |
8 ms |
14632 KB |
Output is correct |
32 |
Correct |
8 ms |
14668 KB |
Output is correct |
33 |
Correct |
9 ms |
14668 KB |
Output is correct |
34 |
Correct |
11 ms |
14668 KB |
Output is correct |
35 |
Correct |
11 ms |
14752 KB |
Output is correct |
36 |
Correct |
12 ms |
14736 KB |
Output is correct |
37 |
Correct |
23 ms |
14796 KB |
Output is correct |
38 |
Correct |
24 ms |
14852 KB |
Output is correct |
39 |
Correct |
42 ms |
15172 KB |
Output is correct |
40 |
Correct |
68 ms |
15476 KB |
Output is correct |
41 |
Correct |
98 ms |
15848 KB |
Output is correct |
42 |
Correct |
95 ms |
15820 KB |
Output is correct |
43 |
Correct |
99 ms |
15860 KB |
Output is correct |
44 |
Correct |
116 ms |
15928 KB |
Output is correct |
45 |
Correct |
98 ms |
15812 KB |
Output is correct |
46 |
Correct |
96 ms |
15796 KB |
Output is correct |
47 |
Correct |
96 ms |
15812 KB |
Output is correct |
48 |
Correct |
96 ms |
15808 KB |
Output is correct |
49 |
Correct |
98 ms |
15860 KB |
Output is correct |
50 |
Correct |
98 ms |
15828 KB |
Output is correct |
51 |
Correct |
124 ms |
15812 KB |
Output is correct |
52 |
Correct |
97 ms |
15824 KB |
Output is correct |
53 |
Correct |
96 ms |
15852 KB |
Output is correct |
54 |
Correct |
98 ms |
15828 KB |
Output is correct |
55 |
Correct |
101 ms |
15760 KB |
Output is correct |
56 |
Correct |
104 ms |
15796 KB |
Output is correct |
57 |
Correct |
101 ms |
15860 KB |
Output is correct |
58 |
Correct |
119 ms |
15860 KB |
Output is correct |
59 |
Correct |
97 ms |
15844 KB |
Output is correct |
60 |
Correct |
97 ms |
15856 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
14628 KB |
Output is correct |
2 |
Correct |
9 ms |
14624 KB |
Output is correct |
3 |
Correct |
9 ms |
14668 KB |
Output is correct |
4 |
Correct |
9 ms |
14704 KB |
Output is correct |
5 |
Correct |
8 ms |
14668 KB |
Output is correct |
6 |
Correct |
8 ms |
14668 KB |
Output is correct |
7 |
Correct |
8 ms |
14656 KB |
Output is correct |
8 |
Correct |
9 ms |
14668 KB |
Output is correct |
9 |
Correct |
9 ms |
14712 KB |
Output is correct |
10 |
Correct |
8 ms |
14668 KB |
Output is correct |
11 |
Correct |
9 ms |
14708 KB |
Output is correct |
12 |
Correct |
9 ms |
14716 KB |
Output is correct |
13 |
Correct |
12 ms |
14668 KB |
Output is correct |
14 |
Correct |
35 ms |
15096 KB |
Output is correct |
15 |
Correct |
62 ms |
15436 KB |
Output is correct |
16 |
Correct |
100 ms |
15852 KB |
Output is correct |
17 |
Correct |
111 ms |
15836 KB |
Output is correct |
18 |
Correct |
91 ms |
15824 KB |
Output is correct |
19 |
Correct |
88 ms |
15820 KB |
Output is correct |
20 |
Correct |
90 ms |
15844 KB |
Output is correct |
21 |
Correct |
91 ms |
15836 KB |
Output is correct |
22 |
Correct |
118 ms |
15856 KB |
Output is correct |
23 |
Correct |
96 ms |
15860 KB |
Output is correct |
24 |
Correct |
87 ms |
15820 KB |
Output is correct |
25 |
Correct |
103 ms |
15864 KB |
Output is correct |
26 |
Correct |
9 ms |
14596 KB |
Output is correct |
27 |
Correct |
8 ms |
14628 KB |
Output is correct |
28 |
Correct |
11 ms |
14668 KB |
Output is correct |
29 |
Correct |
37 ms |
15044 KB |
Output is correct |
30 |
Correct |
85 ms |
15468 KB |
Output is correct |
31 |
Correct |
99 ms |
15856 KB |
Output is correct |
32 |
Correct |
97 ms |
15864 KB |
Output is correct |
33 |
Correct |
92 ms |
15824 KB |
Output is correct |
34 |
Correct |
93 ms |
15856 KB |
Output is correct |
35 |
Correct |
94 ms |
15852 KB |
Output is correct |
36 |
Correct |
96 ms |
15844 KB |
Output is correct |
37 |
Correct |
91 ms |
15856 KB |
Output is correct |
38 |
Correct |
95 ms |
15844 KB |
Output is correct |
39 |
Correct |
91 ms |
15820 KB |
Output is correct |
40 |
Correct |
95 ms |
15820 KB |
Output is correct |
41 |
Correct |
8 ms |
14632 KB |
Output is correct |
42 |
Correct |
8 ms |
14668 KB |
Output is correct |
43 |
Correct |
9 ms |
14668 KB |
Output is correct |
44 |
Correct |
11 ms |
14668 KB |
Output is correct |
45 |
Correct |
11 ms |
14752 KB |
Output is correct |
46 |
Correct |
12 ms |
14736 KB |
Output is correct |
47 |
Correct |
23 ms |
14796 KB |
Output is correct |
48 |
Correct |
24 ms |
14852 KB |
Output is correct |
49 |
Correct |
42 ms |
15172 KB |
Output is correct |
50 |
Correct |
68 ms |
15476 KB |
Output is correct |
51 |
Correct |
98 ms |
15848 KB |
Output is correct |
52 |
Correct |
95 ms |
15820 KB |
Output is correct |
53 |
Correct |
99 ms |
15860 KB |
Output is correct |
54 |
Correct |
116 ms |
15928 KB |
Output is correct |
55 |
Correct |
98 ms |
15812 KB |
Output is correct |
56 |
Correct |
96 ms |
15796 KB |
Output is correct |
57 |
Correct |
96 ms |
15812 KB |
Output is correct |
58 |
Correct |
96 ms |
15808 KB |
Output is correct |
59 |
Correct |
98 ms |
15860 KB |
Output is correct |
60 |
Correct |
98 ms |
15828 KB |
Output is correct |
61 |
Correct |
124 ms |
15812 KB |
Output is correct |
62 |
Correct |
97 ms |
15824 KB |
Output is correct |
63 |
Correct |
96 ms |
15852 KB |
Output is correct |
64 |
Correct |
98 ms |
15828 KB |
Output is correct |
65 |
Correct |
101 ms |
15760 KB |
Output is correct |
66 |
Correct |
104 ms |
15796 KB |
Output is correct |
67 |
Correct |
101 ms |
15860 KB |
Output is correct |
68 |
Correct |
119 ms |
15860 KB |
Output is correct |
69 |
Correct |
97 ms |
15844 KB |
Output is correct |
70 |
Correct |
97 ms |
15856 KB |
Output is correct |
71 |
Correct |
30 ms |
14904 KB |
Output is correct |
72 |
Correct |
24 ms |
14892 KB |
Output is correct |
73 |
Correct |
24 ms |
14816 KB |
Output is correct |
74 |
Correct |
25 ms |
14904 KB |
Output is correct |
75 |
Correct |
24 ms |
14908 KB |
Output is correct |
76 |
Correct |
39 ms |
15104 KB |
Output is correct |
77 |
Correct |
39 ms |
15100 KB |
Output is correct |
78 |
Correct |
51 ms |
15100 KB |
Output is correct |
79 |
Correct |
43 ms |
15100 KB |
Output is correct |
80 |
Correct |
39 ms |
15052 KB |
Output is correct |
81 |
Correct |
70 ms |
15520 KB |
Output is correct |
82 |
Correct |
70 ms |
15512 KB |
Output is correct |
83 |
Correct |
83 ms |
15508 KB |
Output is correct |
84 |
Correct |
88 ms |
15516 KB |
Output is correct |
85 |
Correct |
70 ms |
15508 KB |
Output is correct |
86 |
Correct |
73 ms |
15548 KB |
Output is correct |
87 |
Correct |
73 ms |
15552 KB |
Output is correct |
88 |
Correct |
75 ms |
15552 KB |
Output is correct |
89 |
Correct |
72 ms |
15556 KB |
Output is correct |
90 |
Correct |
75 ms |
15556 KB |
Output is correct |
91 |
Correct |
109 ms |
16196 KB |
Output is correct |
92 |
Correct |
108 ms |
16244 KB |
Output is correct |
93 |
Correct |
102 ms |
16240 KB |
Output is correct |
94 |
Correct |
100 ms |
16244 KB |
Output is correct |
95 |
Correct |
103 ms |
16216 KB |
Output is correct |
96 |
Correct |
127 ms |
16588 KB |
Output is correct |
97 |
Correct |
99 ms |
16632 KB |
Output is correct |
98 |
Correct |
100 ms |
16528 KB |
Output is correct |
99 |
Correct |
98 ms |
16640 KB |
Output is correct |
100 |
Correct |
110 ms |
16628 KB |
Output is correct |
101 |
Correct |
102 ms |
16564 KB |
Output is correct |
102 |
Correct |
97 ms |
16580 KB |
Output is correct |
103 |
Correct |
100 ms |
16636 KB |
Output is correct |
104 |
Correct |
124 ms |
16640 KB |
Output is correct |
105 |
Correct |
114 ms |
16756 KB |
Output is correct |
106 |
Correct |
94 ms |
16844 KB |
Output is correct |
107 |
Correct |
96 ms |
16832 KB |
Output is correct |
108 |
Correct |
105 ms |
16832 KB |
Output is correct |
109 |
Correct |
104 ms |
16768 KB |
Output is correct |
110 |
Correct |
95 ms |
16796 KB |
Output is correct |
111 |
Correct |
93 ms |
16836 KB |
Output is correct |
112 |
Correct |
98 ms |
16844 KB |
Output is correct |
113 |
Correct |
94 ms |
16732 KB |
Output is correct |
114 |
Correct |
111 ms |
16768 KB |
Output is correct |
115 |
Correct |
112 ms |
16832 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
14628 KB |
Output is correct |
2 |
Correct |
9 ms |
14624 KB |
Output is correct |
3 |
Correct |
9 ms |
14668 KB |
Output is correct |
4 |
Correct |
9 ms |
14704 KB |
Output is correct |
5 |
Correct |
8 ms |
14668 KB |
Output is correct |
6 |
Correct |
8 ms |
14668 KB |
Output is correct |
7 |
Correct |
8 ms |
14656 KB |
Output is correct |
8 |
Correct |
9 ms |
14668 KB |
Output is correct |
9 |
Correct |
9 ms |
14712 KB |
Output is correct |
10 |
Correct |
8 ms |
14668 KB |
Output is correct |
11 |
Correct |
9 ms |
14708 KB |
Output is correct |
12 |
Correct |
9 ms |
14716 KB |
Output is correct |
13 |
Correct |
12 ms |
14668 KB |
Output is correct |
14 |
Correct |
35 ms |
15096 KB |
Output is correct |
15 |
Correct |
62 ms |
15436 KB |
Output is correct |
16 |
Correct |
100 ms |
15852 KB |
Output is correct |
17 |
Correct |
111 ms |
15836 KB |
Output is correct |
18 |
Correct |
91 ms |
15824 KB |
Output is correct |
19 |
Correct |
88 ms |
15820 KB |
Output is correct |
20 |
Correct |
90 ms |
15844 KB |
Output is correct |
21 |
Correct |
91 ms |
15836 KB |
Output is correct |
22 |
Correct |
118 ms |
15856 KB |
Output is correct |
23 |
Correct |
96 ms |
15860 KB |
Output is correct |
24 |
Correct |
87 ms |
15820 KB |
Output is correct |
25 |
Correct |
103 ms |
15864 KB |
Output is correct |
26 |
Correct |
9 ms |
14596 KB |
Output is correct |
27 |
Correct |
8 ms |
14628 KB |
Output is correct |
28 |
Correct |
11 ms |
14668 KB |
Output is correct |
29 |
Correct |
37 ms |
15044 KB |
Output is correct |
30 |
Correct |
85 ms |
15468 KB |
Output is correct |
31 |
Correct |
99 ms |
15856 KB |
Output is correct |
32 |
Correct |
97 ms |
15864 KB |
Output is correct |
33 |
Correct |
92 ms |
15824 KB |
Output is correct |
34 |
Correct |
93 ms |
15856 KB |
Output is correct |
35 |
Correct |
94 ms |
15852 KB |
Output is correct |
36 |
Correct |
96 ms |
15844 KB |
Output is correct |
37 |
Correct |
91 ms |
15856 KB |
Output is correct |
38 |
Correct |
95 ms |
15844 KB |
Output is correct |
39 |
Correct |
91 ms |
15820 KB |
Output is correct |
40 |
Correct |
95 ms |
15820 KB |
Output is correct |
41 |
Correct |
8 ms |
14632 KB |
Output is correct |
42 |
Correct |
8 ms |
14668 KB |
Output is correct |
43 |
Correct |
9 ms |
14668 KB |
Output is correct |
44 |
Correct |
11 ms |
14668 KB |
Output is correct |
45 |
Correct |
11 ms |
14752 KB |
Output is correct |
46 |
Correct |
12 ms |
14736 KB |
Output is correct |
47 |
Correct |
23 ms |
14796 KB |
Output is correct |
48 |
Correct |
24 ms |
14852 KB |
Output is correct |
49 |
Correct |
42 ms |
15172 KB |
Output is correct |
50 |
Correct |
68 ms |
15476 KB |
Output is correct |
51 |
Correct |
98 ms |
15848 KB |
Output is correct |
52 |
Correct |
95 ms |
15820 KB |
Output is correct |
53 |
Correct |
99 ms |
15860 KB |
Output is correct |
54 |
Correct |
116 ms |
15928 KB |
Output is correct |
55 |
Correct |
98 ms |
15812 KB |
Output is correct |
56 |
Correct |
96 ms |
15796 KB |
Output is correct |
57 |
Correct |
96 ms |
15812 KB |
Output is correct |
58 |
Correct |
96 ms |
15808 KB |
Output is correct |
59 |
Correct |
98 ms |
15860 KB |
Output is correct |
60 |
Correct |
98 ms |
15828 KB |
Output is correct |
61 |
Correct |
124 ms |
15812 KB |
Output is correct |
62 |
Correct |
97 ms |
15824 KB |
Output is correct |
63 |
Correct |
96 ms |
15852 KB |
Output is correct |
64 |
Correct |
98 ms |
15828 KB |
Output is correct |
65 |
Correct |
101 ms |
15760 KB |
Output is correct |
66 |
Correct |
104 ms |
15796 KB |
Output is correct |
67 |
Correct |
101 ms |
15860 KB |
Output is correct |
68 |
Correct |
119 ms |
15860 KB |
Output is correct |
69 |
Correct |
97 ms |
15844 KB |
Output is correct |
70 |
Correct |
97 ms |
15856 KB |
Output is correct |
71 |
Correct |
30 ms |
14904 KB |
Output is correct |
72 |
Correct |
24 ms |
14892 KB |
Output is correct |
73 |
Correct |
24 ms |
14816 KB |
Output is correct |
74 |
Correct |
25 ms |
14904 KB |
Output is correct |
75 |
Correct |
24 ms |
14908 KB |
Output is correct |
76 |
Correct |
39 ms |
15104 KB |
Output is correct |
77 |
Correct |
39 ms |
15100 KB |
Output is correct |
78 |
Correct |
51 ms |
15100 KB |
Output is correct |
79 |
Correct |
43 ms |
15100 KB |
Output is correct |
80 |
Correct |
39 ms |
15052 KB |
Output is correct |
81 |
Correct |
70 ms |
15520 KB |
Output is correct |
82 |
Correct |
70 ms |
15512 KB |
Output is correct |
83 |
Correct |
83 ms |
15508 KB |
Output is correct |
84 |
Correct |
88 ms |
15516 KB |
Output is correct |
85 |
Correct |
70 ms |
15508 KB |
Output is correct |
86 |
Correct |
73 ms |
15548 KB |
Output is correct |
87 |
Correct |
73 ms |
15552 KB |
Output is correct |
88 |
Correct |
75 ms |
15552 KB |
Output is correct |
89 |
Correct |
72 ms |
15556 KB |
Output is correct |
90 |
Correct |
75 ms |
15556 KB |
Output is correct |
91 |
Correct |
109 ms |
16196 KB |
Output is correct |
92 |
Correct |
108 ms |
16244 KB |
Output is correct |
93 |
Correct |
102 ms |
16240 KB |
Output is correct |
94 |
Correct |
100 ms |
16244 KB |
Output is correct |
95 |
Correct |
103 ms |
16216 KB |
Output is correct |
96 |
Correct |
127 ms |
16588 KB |
Output is correct |
97 |
Correct |
99 ms |
16632 KB |
Output is correct |
98 |
Correct |
100 ms |
16528 KB |
Output is correct |
99 |
Correct |
98 ms |
16640 KB |
Output is correct |
100 |
Correct |
110 ms |
16628 KB |
Output is correct |
101 |
Correct |
102 ms |
16564 KB |
Output is correct |
102 |
Correct |
97 ms |
16580 KB |
Output is correct |
103 |
Correct |
100 ms |
16636 KB |
Output is correct |
104 |
Correct |
124 ms |
16640 KB |
Output is correct |
105 |
Correct |
114 ms |
16756 KB |
Output is correct |
106 |
Correct |
94 ms |
16844 KB |
Output is correct |
107 |
Correct |
96 ms |
16832 KB |
Output is correct |
108 |
Correct |
105 ms |
16832 KB |
Output is correct |
109 |
Correct |
104 ms |
16768 KB |
Output is correct |
110 |
Correct |
95 ms |
16796 KB |
Output is correct |
111 |
Correct |
93 ms |
16836 KB |
Output is correct |
112 |
Correct |
98 ms |
16844 KB |
Output is correct |
113 |
Correct |
94 ms |
16732 KB |
Output is correct |
114 |
Correct |
111 ms |
16768 KB |
Output is correct |
115 |
Correct |
112 ms |
16832 KB |
Output is correct |
116 |
Execution timed out |
7007 ms |
15984 KB |
Time limit exceeded |
117 |
Halted |
0 ms |
0 KB |
- |