#include<bits/stdc++.h>
using namespace std;
long long pr[300001][101];
vector<long long> haha(300001);
vector<long long> br(300001);
vector<pair<pair<long long,long long>,long long>> bruh[300001];
const long long k = 100;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
long long n,q,l,r;
cin >> n >> q;
for(long long i = 1; i <= 100; i++) {
for(long long j = 0; j <= n; j++) {
pr[j][i] = j*(j+1)/2;
if(j >= i) {
pr[j][i]+=pr[j-i][i];
}
}
}
for(long long i = 1; i <= n; i++) {
cin >> haha[i];
}
for(long long i = 0; i < q; i++) {
cin >> l >> r;
bruh[l/k].push_back({{r,l},i});
}
vector<long long> ans(q);
for(long long i = 0; i < n; i++) {
sort(bruh[i].begin(),bruh[i].end());
}
for(long long i = 0; i < n; i++) {
if(i*k > n) {
break;
}
if(bruh[i].size() > 0) {
for(long long j = 0; j < br.size(); j++) {
br[j] = 0;
}
long long y = bruh[i].size();
vector<long long> wow(k+1);
for(long long j = 0; j < bruh[i].size(); j++) {
if(bruh[i][j].first.first >= (i+1)*k) {
y = j;
break;
}
r = bruh[i][j].first.first,l = bruh[i][j].first.second;
for(long long j = l; j <= r; j++) {
wow[br[haha[j]]]--;
br[haha[j]]++;
wow[br[haha[j]]]++;
}
long long pl = 0,pr = 0,sb = 0;
for(long long j = 1; j <= k; j++) {
for(long long x = 0; x < wow[j]; x++) {
if(pl > pr) {
swap(pr,pl);
}
long long m = r-l+1;
sb+=m*(m+1)/2;
sb-=pl*(pl+1)/2;
long long c = m-pl-j;
sb-=c*(c+1)/2;
pl+=j;
}
}
ans[bruh[i][j].second] = sb;
for(long long j = l; j <= r; j++) {
br[haha[j]] = 0;
}
for(long long j = 0; j <= k; j++) {
wow[j] = 0;
}
}
vector<long long> wut(0);
for(long long j = (i+1)*k; j <= n; j++) {
if(br[haha[j]] < k) {
wow[br[haha[j]]]--;
wow[br[haha[j]]+1]++;
}
else if(br[haha[j]] == k) {
wow[br[haha[j]]]--;
wut.push_back(haha[j]);
}
br[haha[j]]++;
while(y < bruh[i].size() && bruh[i][y].first.first == j) {
vector<long long> troll(k+1);
for(long long z = 0; z <= k; z++) {
troll[z] = wow[z];
}
r = bruh[i][y].first.first,l = bruh[i][y].first.second;
for(long long z = l; z < (i+1)*k; z++) {
if(br[haha[z]] < k) {
wow[br[haha[z]]]--;
wow[br[haha[z]]+1]++;
}
else if(br[haha[z]] == k) {
wow[br[haha[z]]]--;
wut.push_back(haha[z]);
}
br[haha[z]]++;
}
long long ql = 0,qr = 0,sb = 0,m = (r-l+1);
for(long long j = 1; j <= k; j++) {
long long a = wow[j];
if(ql > qr) {
swap(ql,qr);
}
sb+=(m*(m+1)/2)*a;
long long d = (a+1)/2;
if(d > 0) {
sb-=pr[ql+j*(d-1)][j];
if(ql >= j) {
sb+=pr[ql-j][j];
}
long long c = m-ql-j;
sb-=pr[c][j];
if(c >= d*j) {
sb+=pr[c-d*j][j];
}
}
d = a/2;
swap(ql,qr);
if(d > 0) {
sb-=pr[ql+j*(d-1)][j];
if(ql >= j) {
sb+=pr[ql-j][j];
}
long long c = m-ql-j;
sb-=pr[c][j];
if(c >= d*j) {
sb+=pr[c-d*j][j];
}
}
swap(ql,qr);
ql+=j*((a+1)/2);
qr+=j*(a/2);
}
vector<long long> banana(0);
for(long long z = 0; z < wut.size(); z++) {
banana.push_back(br[wut[z]]);
}
sort(banana.begin(),banana.end());
for(long long z = 0; z < banana.size(); z++) {
long long a = banana[z];
if(ql > qr) {
swap(ql,qr);
}
sb+=m*(m+1)/2;
sb-=ql*(ql+1)/2;
long long c = m-ql-a;
sb-=c*(c+1)/2;
ql+=a;
}
ans[bruh[i][y].second] = sb;
for(long long z = l; z < (i+1)*k; z++) {
br[haha[z]]--;
}
while(!wut.empty() && br[wut[wut.size()-1]] <= k) {
wut.pop_back();
}
for(long long z = 0; z <= k; z++) {
wow[z] = troll[z];
}
y++;
}
}
}
}
for(long long i = 0; i < q; i++) {
cout << ans[i] << "\n";
}
return 0;
}
Compilation message
diversity.cpp: In function 'int main()':
diversity.cpp:41:36: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
41 | for(long long j = 0; j < br.size(); j++) {
| ~~^~~~~~~~~~~
diversity.cpp:46:36: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<std::pair<long long int, long long int>, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
46 | for(long long j = 0; j < bruh[i].size(); j++) {
| ~~^~~~~~~~~~~~~~~~
diversity.cpp:90:25: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<std::pair<long long int, long long int>, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
90 | while(y < bruh[i].size() && bruh[i][y].first.first == j) {
| ~~^~~~~~~~~~~~~~~~
diversity.cpp:144:44: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
144 | for(long long z = 0; z < wut.size(); z++) {
| ~~^~~~~~~~~~~~
diversity.cpp:148:44: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
148 | for(long long z = 0; z < banana.size(); z++) {
| ~~^~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
12124 KB |
Output is correct |
2 |
Correct |
4 ms |
12124 KB |
Output is correct |
3 |
Correct |
5 ms |
12180 KB |
Output is correct |
4 |
Correct |
6 ms |
12124 KB |
Output is correct |
5 |
Correct |
4 ms |
13404 KB |
Output is correct |
6 |
Correct |
3 ms |
13404 KB |
Output is correct |
7 |
Correct |
5 ms |
12124 KB |
Output is correct |
8 |
Correct |
5 ms |
12208 KB |
Output is correct |
9 |
Correct |
5 ms |
12124 KB |
Output is correct |
10 |
Correct |
5 ms |
12124 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
12124 KB |
Output is correct |
2 |
Correct |
5 ms |
12892 KB |
Output is correct |
3 |
Correct |
12 ms |
20056 KB |
Output is correct |
4 |
Correct |
77 ms |
91256 KB |
Output is correct |
5 |
Correct |
139 ms |
170064 KB |
Output is correct |
6 |
Correct |
217 ms |
249364 KB |
Output is correct |
7 |
Correct |
229 ms |
249164 KB |
Output is correct |
8 |
Correct |
219 ms |
249204 KB |
Output is correct |
9 |
Correct |
218 ms |
249172 KB |
Output is correct |
10 |
Correct |
270 ms |
249236 KB |
Output is correct |
11 |
Correct |
221 ms |
249168 KB |
Output is correct |
12 |
Correct |
243 ms |
249372 KB |
Output is correct |
13 |
Correct |
231 ms |
249172 KB |
Output is correct |
14 |
Correct |
239 ms |
249172 KB |
Output is correct |
15 |
Correct |
220 ms |
249168 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
12124 KB |
Output is correct |
2 |
Correct |
5 ms |
12892 KB |
Output is correct |
3 |
Correct |
12 ms |
20056 KB |
Output is correct |
4 |
Correct |
77 ms |
91256 KB |
Output is correct |
5 |
Correct |
139 ms |
170064 KB |
Output is correct |
6 |
Correct |
217 ms |
249364 KB |
Output is correct |
7 |
Correct |
229 ms |
249164 KB |
Output is correct |
8 |
Correct |
219 ms |
249204 KB |
Output is correct |
9 |
Correct |
218 ms |
249172 KB |
Output is correct |
10 |
Correct |
270 ms |
249236 KB |
Output is correct |
11 |
Correct |
221 ms |
249168 KB |
Output is correct |
12 |
Correct |
243 ms |
249372 KB |
Output is correct |
13 |
Correct |
231 ms |
249172 KB |
Output is correct |
14 |
Correct |
239 ms |
249172 KB |
Output is correct |
15 |
Correct |
220 ms |
249168 KB |
Output is correct |
16 |
Correct |
5 ms |
12124 KB |
Output is correct |
17 |
Correct |
5 ms |
12892 KB |
Output is correct |
18 |
Correct |
12 ms |
20132 KB |
Output is correct |
19 |
Correct |
77 ms |
91212 KB |
Output is correct |
20 |
Correct |
141 ms |
170320 KB |
Output is correct |
21 |
Correct |
247 ms |
249168 KB |
Output is correct |
22 |
Correct |
222 ms |
249156 KB |
Output is correct |
23 |
Correct |
226 ms |
249172 KB |
Output is correct |
24 |
Correct |
220 ms |
249152 KB |
Output is correct |
25 |
Correct |
242 ms |
249152 KB |
Output is correct |
26 |
Correct |
223 ms |
249160 KB |
Output is correct |
27 |
Correct |
234 ms |
249320 KB |
Output is correct |
28 |
Correct |
236 ms |
249212 KB |
Output is correct |
29 |
Correct |
230 ms |
249168 KB |
Output is correct |
30 |
Correct |
224 ms |
249168 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
12124 KB |
Output is correct |
2 |
Correct |
5 ms |
12892 KB |
Output is correct |
3 |
Correct |
12 ms |
20056 KB |
Output is correct |
4 |
Correct |
77 ms |
91256 KB |
Output is correct |
5 |
Correct |
139 ms |
170064 KB |
Output is correct |
6 |
Correct |
217 ms |
249364 KB |
Output is correct |
7 |
Correct |
229 ms |
249164 KB |
Output is correct |
8 |
Correct |
219 ms |
249204 KB |
Output is correct |
9 |
Correct |
218 ms |
249172 KB |
Output is correct |
10 |
Correct |
270 ms |
249236 KB |
Output is correct |
11 |
Correct |
221 ms |
249168 KB |
Output is correct |
12 |
Correct |
243 ms |
249372 KB |
Output is correct |
13 |
Correct |
231 ms |
249172 KB |
Output is correct |
14 |
Correct |
239 ms |
249172 KB |
Output is correct |
15 |
Correct |
220 ms |
249168 KB |
Output is correct |
16 |
Correct |
5 ms |
12124 KB |
Output is correct |
17 |
Correct |
5 ms |
12892 KB |
Output is correct |
18 |
Correct |
12 ms |
20132 KB |
Output is correct |
19 |
Correct |
77 ms |
91212 KB |
Output is correct |
20 |
Correct |
141 ms |
170320 KB |
Output is correct |
21 |
Correct |
247 ms |
249168 KB |
Output is correct |
22 |
Correct |
222 ms |
249156 KB |
Output is correct |
23 |
Correct |
226 ms |
249172 KB |
Output is correct |
24 |
Correct |
220 ms |
249152 KB |
Output is correct |
25 |
Correct |
242 ms |
249152 KB |
Output is correct |
26 |
Correct |
223 ms |
249160 KB |
Output is correct |
27 |
Correct |
234 ms |
249320 KB |
Output is correct |
28 |
Correct |
236 ms |
249212 KB |
Output is correct |
29 |
Correct |
230 ms |
249168 KB |
Output is correct |
30 |
Correct |
224 ms |
249168 KB |
Output is correct |
31 |
Correct |
3 ms |
13400 KB |
Output is correct |
32 |
Correct |
4 ms |
13404 KB |
Output is correct |
33 |
Correct |
4 ms |
13404 KB |
Output is correct |
34 |
Correct |
8 ms |
20056 KB |
Output is correct |
35 |
Correct |
8 ms |
20060 KB |
Output is correct |
36 |
Correct |
6 ms |
21696 KB |
Output is correct |
37 |
Correct |
33 ms |
51532 KB |
Output is correct |
38 |
Correct |
36 ms |
51548 KB |
Output is correct |
39 |
Correct |
66 ms |
91256 KB |
Output is correct |
40 |
Correct |
164 ms |
170260 KB |
Output is correct |
41 |
Correct |
246 ms |
249164 KB |
Output is correct |
42 |
Correct |
225 ms |
249280 KB |
Output is correct |
43 |
Correct |
209 ms |
249168 KB |
Output is correct |
44 |
Correct |
236 ms |
249216 KB |
Output is correct |
45 |
Correct |
257 ms |
249172 KB |
Output is correct |
46 |
Correct |
212 ms |
249268 KB |
Output is correct |
47 |
Correct |
238 ms |
249428 KB |
Output is correct |
48 |
Correct |
240 ms |
249172 KB |
Output is correct |
49 |
Correct |
221 ms |
249172 KB |
Output is correct |
50 |
Correct |
218 ms |
249368 KB |
Output is correct |
51 |
Correct |
221 ms |
249168 KB |
Output is correct |
52 |
Correct |
268 ms |
249368 KB |
Output is correct |
53 |
Correct |
224 ms |
249168 KB |
Output is correct |
54 |
Correct |
228 ms |
249156 KB |
Output is correct |
55 |
Correct |
242 ms |
249284 KB |
Output is correct |
56 |
Correct |
232 ms |
249256 KB |
Output is correct |
57 |
Correct |
223 ms |
249172 KB |
Output is correct |
58 |
Correct |
226 ms |
249288 KB |
Output is correct |
59 |
Correct |
221 ms |
249292 KB |
Output is correct |
60 |
Correct |
241 ms |
249172 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
12124 KB |
Output is correct |
2 |
Correct |
4 ms |
12124 KB |
Output is correct |
3 |
Correct |
5 ms |
12180 KB |
Output is correct |
4 |
Correct |
6 ms |
12124 KB |
Output is correct |
5 |
Correct |
4 ms |
13404 KB |
Output is correct |
6 |
Correct |
3 ms |
13404 KB |
Output is correct |
7 |
Correct |
5 ms |
12124 KB |
Output is correct |
8 |
Correct |
5 ms |
12208 KB |
Output is correct |
9 |
Correct |
5 ms |
12124 KB |
Output is correct |
10 |
Correct |
5 ms |
12124 KB |
Output is correct |
11 |
Correct |
5 ms |
12124 KB |
Output is correct |
12 |
Correct |
5 ms |
12892 KB |
Output is correct |
13 |
Correct |
12 ms |
20056 KB |
Output is correct |
14 |
Correct |
77 ms |
91256 KB |
Output is correct |
15 |
Correct |
139 ms |
170064 KB |
Output is correct |
16 |
Correct |
217 ms |
249364 KB |
Output is correct |
17 |
Correct |
229 ms |
249164 KB |
Output is correct |
18 |
Correct |
219 ms |
249204 KB |
Output is correct |
19 |
Correct |
218 ms |
249172 KB |
Output is correct |
20 |
Correct |
270 ms |
249236 KB |
Output is correct |
21 |
Correct |
221 ms |
249168 KB |
Output is correct |
22 |
Correct |
243 ms |
249372 KB |
Output is correct |
23 |
Correct |
231 ms |
249172 KB |
Output is correct |
24 |
Correct |
239 ms |
249172 KB |
Output is correct |
25 |
Correct |
220 ms |
249168 KB |
Output is correct |
26 |
Correct |
5 ms |
12124 KB |
Output is correct |
27 |
Correct |
5 ms |
12892 KB |
Output is correct |
28 |
Correct |
12 ms |
20132 KB |
Output is correct |
29 |
Correct |
77 ms |
91212 KB |
Output is correct |
30 |
Correct |
141 ms |
170320 KB |
Output is correct |
31 |
Correct |
247 ms |
249168 KB |
Output is correct |
32 |
Correct |
222 ms |
249156 KB |
Output is correct |
33 |
Correct |
226 ms |
249172 KB |
Output is correct |
34 |
Correct |
220 ms |
249152 KB |
Output is correct |
35 |
Correct |
242 ms |
249152 KB |
Output is correct |
36 |
Correct |
223 ms |
249160 KB |
Output is correct |
37 |
Correct |
234 ms |
249320 KB |
Output is correct |
38 |
Correct |
236 ms |
249212 KB |
Output is correct |
39 |
Correct |
230 ms |
249168 KB |
Output is correct |
40 |
Correct |
224 ms |
249168 KB |
Output is correct |
41 |
Correct |
3 ms |
13400 KB |
Output is correct |
42 |
Correct |
4 ms |
13404 KB |
Output is correct |
43 |
Correct |
4 ms |
13404 KB |
Output is correct |
44 |
Correct |
8 ms |
20056 KB |
Output is correct |
45 |
Correct |
8 ms |
20060 KB |
Output is correct |
46 |
Correct |
6 ms |
21696 KB |
Output is correct |
47 |
Correct |
33 ms |
51532 KB |
Output is correct |
48 |
Correct |
36 ms |
51548 KB |
Output is correct |
49 |
Correct |
66 ms |
91256 KB |
Output is correct |
50 |
Correct |
164 ms |
170260 KB |
Output is correct |
51 |
Correct |
246 ms |
249164 KB |
Output is correct |
52 |
Correct |
225 ms |
249280 KB |
Output is correct |
53 |
Correct |
209 ms |
249168 KB |
Output is correct |
54 |
Correct |
236 ms |
249216 KB |
Output is correct |
55 |
Correct |
257 ms |
249172 KB |
Output is correct |
56 |
Correct |
212 ms |
249268 KB |
Output is correct |
57 |
Correct |
238 ms |
249428 KB |
Output is correct |
58 |
Correct |
240 ms |
249172 KB |
Output is correct |
59 |
Correct |
221 ms |
249172 KB |
Output is correct |
60 |
Correct |
218 ms |
249368 KB |
Output is correct |
61 |
Correct |
221 ms |
249168 KB |
Output is correct |
62 |
Correct |
268 ms |
249368 KB |
Output is correct |
63 |
Correct |
224 ms |
249168 KB |
Output is correct |
64 |
Correct |
228 ms |
249156 KB |
Output is correct |
65 |
Correct |
242 ms |
249284 KB |
Output is correct |
66 |
Correct |
232 ms |
249256 KB |
Output is correct |
67 |
Correct |
223 ms |
249172 KB |
Output is correct |
68 |
Correct |
226 ms |
249288 KB |
Output is correct |
69 |
Correct |
221 ms |
249292 KB |
Output is correct |
70 |
Correct |
241 ms |
249172 KB |
Output is correct |
71 |
Correct |
30 ms |
51548 KB |
Output is correct |
72 |
Correct |
35 ms |
51548 KB |
Output is correct |
73 |
Correct |
48 ms |
51544 KB |
Output is correct |
74 |
Correct |
39 ms |
51628 KB |
Output is correct |
75 |
Correct |
34 ms |
51544 KB |
Output is correct |
76 |
Correct |
71 ms |
91228 KB |
Output is correct |
77 |
Correct |
86 ms |
91216 KB |
Output is correct |
78 |
Correct |
68 ms |
91252 KB |
Output is correct |
79 |
Correct |
67 ms |
91228 KB |
Output is correct |
80 |
Correct |
73 ms |
91248 KB |
Output is correct |
81 |
Correct |
154 ms |
170064 KB |
Output is correct |
82 |
Correct |
153 ms |
170200 KB |
Output is correct |
83 |
Correct |
132 ms |
170068 KB |
Output is correct |
84 |
Correct |
129 ms |
170088 KB |
Output is correct |
85 |
Correct |
162 ms |
170324 KB |
Output is correct |
86 |
Correct |
132 ms |
170068 KB |
Output is correct |
87 |
Correct |
146 ms |
170116 KB |
Output is correct |
88 |
Correct |
140 ms |
170320 KB |
Output is correct |
89 |
Correct |
149 ms |
170064 KB |
Output is correct |
90 |
Correct |
146 ms |
170064 KB |
Output is correct |
91 |
Correct |
209 ms |
249168 KB |
Output is correct |
92 |
Correct |
223 ms |
249168 KB |
Output is correct |
93 |
Correct |
232 ms |
249168 KB |
Output is correct |
94 |
Correct |
230 ms |
249212 KB |
Output is correct |
95 |
Correct |
215 ms |
249204 KB |
Output is correct |
96 |
Correct |
225 ms |
249172 KB |
Output is correct |
97 |
Correct |
231 ms |
251224 KB |
Output is correct |
98 |
Correct |
243 ms |
251156 KB |
Output is correct |
99 |
Correct |
246 ms |
251112 KB |
Output is correct |
100 |
Correct |
230 ms |
251220 KB |
Output is correct |
101 |
Correct |
238 ms |
251220 KB |
Output is correct |
102 |
Correct |
222 ms |
251120 KB |
Output is correct |
103 |
Correct |
226 ms |
251220 KB |
Output is correct |
104 |
Correct |
228 ms |
251220 KB |
Output is correct |
105 |
Correct |
253 ms |
251216 KB |
Output is correct |
106 |
Correct |
223 ms |
251220 KB |
Output is correct |
107 |
Correct |
227 ms |
251176 KB |
Output is correct |
108 |
Correct |
221 ms |
251216 KB |
Output is correct |
109 |
Correct |
210 ms |
251216 KB |
Output is correct |
110 |
Correct |
246 ms |
251200 KB |
Output is correct |
111 |
Correct |
220 ms |
251148 KB |
Output is correct |
112 |
Correct |
242 ms |
251220 KB |
Output is correct |
113 |
Correct |
232 ms |
251220 KB |
Output is correct |
114 |
Correct |
240 ms |
251284 KB |
Output is correct |
115 |
Correct |
231 ms |
251216 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
12124 KB |
Output is correct |
2 |
Correct |
4 ms |
12124 KB |
Output is correct |
3 |
Correct |
5 ms |
12180 KB |
Output is correct |
4 |
Correct |
6 ms |
12124 KB |
Output is correct |
5 |
Correct |
4 ms |
13404 KB |
Output is correct |
6 |
Correct |
3 ms |
13404 KB |
Output is correct |
7 |
Correct |
5 ms |
12124 KB |
Output is correct |
8 |
Correct |
5 ms |
12208 KB |
Output is correct |
9 |
Correct |
5 ms |
12124 KB |
Output is correct |
10 |
Correct |
5 ms |
12124 KB |
Output is correct |
11 |
Correct |
5 ms |
12124 KB |
Output is correct |
12 |
Correct |
5 ms |
12892 KB |
Output is correct |
13 |
Correct |
12 ms |
20056 KB |
Output is correct |
14 |
Correct |
77 ms |
91256 KB |
Output is correct |
15 |
Correct |
139 ms |
170064 KB |
Output is correct |
16 |
Correct |
217 ms |
249364 KB |
Output is correct |
17 |
Correct |
229 ms |
249164 KB |
Output is correct |
18 |
Correct |
219 ms |
249204 KB |
Output is correct |
19 |
Correct |
218 ms |
249172 KB |
Output is correct |
20 |
Correct |
270 ms |
249236 KB |
Output is correct |
21 |
Correct |
221 ms |
249168 KB |
Output is correct |
22 |
Correct |
243 ms |
249372 KB |
Output is correct |
23 |
Correct |
231 ms |
249172 KB |
Output is correct |
24 |
Correct |
239 ms |
249172 KB |
Output is correct |
25 |
Correct |
220 ms |
249168 KB |
Output is correct |
26 |
Correct |
5 ms |
12124 KB |
Output is correct |
27 |
Correct |
5 ms |
12892 KB |
Output is correct |
28 |
Correct |
12 ms |
20132 KB |
Output is correct |
29 |
Correct |
77 ms |
91212 KB |
Output is correct |
30 |
Correct |
141 ms |
170320 KB |
Output is correct |
31 |
Correct |
247 ms |
249168 KB |
Output is correct |
32 |
Correct |
222 ms |
249156 KB |
Output is correct |
33 |
Correct |
226 ms |
249172 KB |
Output is correct |
34 |
Correct |
220 ms |
249152 KB |
Output is correct |
35 |
Correct |
242 ms |
249152 KB |
Output is correct |
36 |
Correct |
223 ms |
249160 KB |
Output is correct |
37 |
Correct |
234 ms |
249320 KB |
Output is correct |
38 |
Correct |
236 ms |
249212 KB |
Output is correct |
39 |
Correct |
230 ms |
249168 KB |
Output is correct |
40 |
Correct |
224 ms |
249168 KB |
Output is correct |
41 |
Correct |
3 ms |
13400 KB |
Output is correct |
42 |
Correct |
4 ms |
13404 KB |
Output is correct |
43 |
Correct |
4 ms |
13404 KB |
Output is correct |
44 |
Correct |
8 ms |
20056 KB |
Output is correct |
45 |
Correct |
8 ms |
20060 KB |
Output is correct |
46 |
Correct |
6 ms |
21696 KB |
Output is correct |
47 |
Correct |
33 ms |
51532 KB |
Output is correct |
48 |
Correct |
36 ms |
51548 KB |
Output is correct |
49 |
Correct |
66 ms |
91256 KB |
Output is correct |
50 |
Correct |
164 ms |
170260 KB |
Output is correct |
51 |
Correct |
246 ms |
249164 KB |
Output is correct |
52 |
Correct |
225 ms |
249280 KB |
Output is correct |
53 |
Correct |
209 ms |
249168 KB |
Output is correct |
54 |
Correct |
236 ms |
249216 KB |
Output is correct |
55 |
Correct |
257 ms |
249172 KB |
Output is correct |
56 |
Correct |
212 ms |
249268 KB |
Output is correct |
57 |
Correct |
238 ms |
249428 KB |
Output is correct |
58 |
Correct |
240 ms |
249172 KB |
Output is correct |
59 |
Correct |
221 ms |
249172 KB |
Output is correct |
60 |
Correct |
218 ms |
249368 KB |
Output is correct |
61 |
Correct |
221 ms |
249168 KB |
Output is correct |
62 |
Correct |
268 ms |
249368 KB |
Output is correct |
63 |
Correct |
224 ms |
249168 KB |
Output is correct |
64 |
Correct |
228 ms |
249156 KB |
Output is correct |
65 |
Correct |
242 ms |
249284 KB |
Output is correct |
66 |
Correct |
232 ms |
249256 KB |
Output is correct |
67 |
Correct |
223 ms |
249172 KB |
Output is correct |
68 |
Correct |
226 ms |
249288 KB |
Output is correct |
69 |
Correct |
221 ms |
249292 KB |
Output is correct |
70 |
Correct |
241 ms |
249172 KB |
Output is correct |
71 |
Correct |
30 ms |
51548 KB |
Output is correct |
72 |
Correct |
35 ms |
51548 KB |
Output is correct |
73 |
Correct |
48 ms |
51544 KB |
Output is correct |
74 |
Correct |
39 ms |
51628 KB |
Output is correct |
75 |
Correct |
34 ms |
51544 KB |
Output is correct |
76 |
Correct |
71 ms |
91228 KB |
Output is correct |
77 |
Correct |
86 ms |
91216 KB |
Output is correct |
78 |
Correct |
68 ms |
91252 KB |
Output is correct |
79 |
Correct |
67 ms |
91228 KB |
Output is correct |
80 |
Correct |
73 ms |
91248 KB |
Output is correct |
81 |
Correct |
154 ms |
170064 KB |
Output is correct |
82 |
Correct |
153 ms |
170200 KB |
Output is correct |
83 |
Correct |
132 ms |
170068 KB |
Output is correct |
84 |
Correct |
129 ms |
170088 KB |
Output is correct |
85 |
Correct |
162 ms |
170324 KB |
Output is correct |
86 |
Correct |
132 ms |
170068 KB |
Output is correct |
87 |
Correct |
146 ms |
170116 KB |
Output is correct |
88 |
Correct |
140 ms |
170320 KB |
Output is correct |
89 |
Correct |
149 ms |
170064 KB |
Output is correct |
90 |
Correct |
146 ms |
170064 KB |
Output is correct |
91 |
Correct |
209 ms |
249168 KB |
Output is correct |
92 |
Correct |
223 ms |
249168 KB |
Output is correct |
93 |
Correct |
232 ms |
249168 KB |
Output is correct |
94 |
Correct |
230 ms |
249212 KB |
Output is correct |
95 |
Correct |
215 ms |
249204 KB |
Output is correct |
96 |
Correct |
225 ms |
249172 KB |
Output is correct |
97 |
Correct |
231 ms |
251224 KB |
Output is correct |
98 |
Correct |
243 ms |
251156 KB |
Output is correct |
99 |
Correct |
246 ms |
251112 KB |
Output is correct |
100 |
Correct |
230 ms |
251220 KB |
Output is correct |
101 |
Correct |
238 ms |
251220 KB |
Output is correct |
102 |
Correct |
222 ms |
251120 KB |
Output is correct |
103 |
Correct |
226 ms |
251220 KB |
Output is correct |
104 |
Correct |
228 ms |
251220 KB |
Output is correct |
105 |
Correct |
253 ms |
251216 KB |
Output is correct |
106 |
Correct |
223 ms |
251220 KB |
Output is correct |
107 |
Correct |
227 ms |
251176 KB |
Output is correct |
108 |
Correct |
221 ms |
251216 KB |
Output is correct |
109 |
Correct |
210 ms |
251216 KB |
Output is correct |
110 |
Correct |
246 ms |
251200 KB |
Output is correct |
111 |
Correct |
220 ms |
251148 KB |
Output is correct |
112 |
Correct |
242 ms |
251220 KB |
Output is correct |
113 |
Correct |
232 ms |
251220 KB |
Output is correct |
114 |
Correct |
240 ms |
251284 KB |
Output is correct |
115 |
Correct |
231 ms |
251216 KB |
Output is correct |
116 |
Correct |
75 ms |
24524 KB |
Output is correct |
117 |
Correct |
80 ms |
24580 KB |
Output is correct |
118 |
Correct |
285 ms |
55384 KB |
Output is correct |
119 |
Correct |
352 ms |
55380 KB |
Output is correct |
120 |
Correct |
285 ms |
55388 KB |
Output is correct |
121 |
Correct |
874 ms |
95108 KB |
Output is correct |
122 |
Correct |
760 ms |
95112 KB |
Output is correct |
123 |
Correct |
2504 ms |
174732 KB |
Output is correct |
124 |
Correct |
2192 ms |
174828 KB |
Output is correct |
125 |
Correct |
2112 ms |
174856 KB |
Output is correct |
126 |
Correct |
3339 ms |
253960 KB |
Output is correct |
127 |
Correct |
3363 ms |
253940 KB |
Output is correct |
128 |
Correct |
3465 ms |
253948 KB |
Output is correct |
129 |
Correct |
3433 ms |
253932 KB |
Output is correct |
130 |
Correct |
3406 ms |
253960 KB |
Output is correct |
131 |
Correct |
3873 ms |
253988 KB |
Output is correct |
132 |
Correct |
3881 ms |
253904 KB |
Output is correct |
133 |
Correct |
3860 ms |
253960 KB |
Output is correct |
134 |
Correct |
3992 ms |
254036 KB |
Output is correct |
135 |
Correct |
3936 ms |
253996 KB |
Output is correct |
136 |
Correct |
3900 ms |
253988 KB |
Output is correct |
137 |
Correct |
3854 ms |
254004 KB |
Output is correct |
138 |
Correct |
4032 ms |
253976 KB |
Output is correct |
139 |
Correct |
3971 ms |
253984 KB |
Output is correct |
140 |
Correct |
4180 ms |
253972 KB |
Output is correct |
141 |
Correct |
4587 ms |
254012 KB |
Output is correct |
142 |
Correct |
4443 ms |
254020 KB |
Output is correct |
143 |
Correct |
4345 ms |
254012 KB |
Output is correct |
144 |
Correct |
4340 ms |
254036 KB |
Output is correct |
145 |
Correct |
4433 ms |
254088 KB |
Output is correct |
146 |
Correct |
4740 ms |
254256 KB |
Output is correct |
147 |
Correct |
4836 ms |
254288 KB |
Output is correct |
148 |
Correct |
4258 ms |
254288 KB |
Output is correct |
149 |
Correct |
4627 ms |
254312 KB |
Output is correct |
150 |
Correct |
4773 ms |
254288 KB |
Output is correct |
151 |
Correct |
4593 ms |
254292 KB |
Output is correct |
152 |
Correct |
4440 ms |
254292 KB |
Output is correct |
153 |
Correct |
4481 ms |
254308 KB |
Output is correct |
154 |
Correct |
4643 ms |
254332 KB |
Output is correct |
155 |
Correct |
4496 ms |
254288 KB |
Output is correct |
156 |
Correct |
6121 ms |
254596 KB |
Output is correct |
157 |
Correct |
6113 ms |
254600 KB |
Output is correct |
158 |
Correct |
6124 ms |
254544 KB |
Output is correct |
159 |
Correct |
6032 ms |
254804 KB |
Output is correct |
160 |
Correct |
6167 ms |
254548 KB |
Output is correct |
161 |
Correct |
5355 ms |
254676 KB |
Output is correct |
162 |
Correct |
5209 ms |
254804 KB |
Output is correct |
163 |
Correct |
5319 ms |
254804 KB |
Output is correct |
164 |
Correct |
5409 ms |
254804 KB |
Output is correct |
165 |
Correct |
5284 ms |
254804 KB |
Output is correct |
166 |
Correct |
4401 ms |
254508 KB |
Output is correct |
167 |
Correct |
4415 ms |
254544 KB |
Output is correct |
168 |
Correct |
5088 ms |
254492 KB |
Output is correct |
169 |
Correct |
4630 ms |
254552 KB |
Output is correct |
170 |
Correct |
4658 ms |
254380 KB |
Output is correct |
171 |
Correct |
3770 ms |
254540 KB |
Output is correct |
172 |
Correct |
3751 ms |
254548 KB |
Output is correct |
173 |
Correct |
3800 ms |
254548 KB |
Output is correct |
174 |
Correct |
3867 ms |
254548 KB |
Output is correct |
175 |
Correct |
3786 ms |
254540 KB |
Output is correct |