QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#197236 | #3145. Rope | Camillus | 100 ✓ | 1228ms | 105096kb | C++20 | 2.7kb | 2023-10-02 13:33:07 | 2023-10-02 13:33:07 |
Judging History
answer
#include "bits/stdc++.h"
using namespace std;
namespace st {
static constexpr int size = 1 << 20;
int tree[size * 2 - 1];
void add(int i, int v) {
int x = size + i - 1;
tree[x] += v;
while (x) {
x = (x - 1) / 2;
tree[x] = max(tree[x * 2 + 1], tree[x * 2 + 2]);
}
}
} // namespace st
signed main() {
#ifndef LOCAL
ios::sync_with_stdio(false);
cin.tie(nullptr);
#else
freopen("input.txt", "r", stdin);
#endif
int n, m;
cin >> n >> m;
vector<int> c(n);
for (int i = 0; i < n; i++) {
cin >> c[i];
c[i]--;
st::add(c[i], 1);
}
vector<int> ans(m, n);
{
vector<vector<vector<int>>> B(m);
for (int i = 0; i < n; i += 2) {
if (i + 1 == n) {
B[c[i]].push_back(vector<int>(1, c[i]));
} else {
B[c[i]].push_back(vector<int>{c[i], c[i + 1]});
if (c[i + 1] != c[i]) {
B[c[i + 1]].push_back(vector<int>{c[i], c[i + 1]});
}
}
}
for (int i = 0; i < m; i++) {
int cnt = 0;
int cnt2 = 0;
for (auto v : B[i]) {
for (int x : v) {
cnt += 1;
cnt2 += x != i;
st::add(x, -1);
}
}
ans[i] = min(ans[i], n - cnt - st::tree[0] + cnt2);
for (auto v : B[i]) {
for (int x : v) {
st::add(x, 1);
}
}
}
}
{
vector<vector<vector<int>>> B(m);
for (int i = -1; i < n; i += 2) {
if (i + 1 == n) {
B[c[i]].push_back(vector<int>(1, c[i]));
} else if (i == -1) {
B[c[i + 1]].push_back(vector<int>{c[i + 1]});
} else {
B[c[i]].push_back(vector<int>{c[i], c[i + 1]});
if (c[i + 1] != c[i]) {
B[c[i + 1]].push_back(vector<int>{c[i], c[i + 1]});
}
}
}
for (int i = 0; i < m; i++) {
int cnt = 0;
int cnt2 = 0;
for (auto v : B[i]) {
for (int x : v) {
cnt += 1;
cnt2 += x != i;
st::add(x, -1);
}
}
ans[i] = min(ans[i], n - cnt - st::tree[0] + cnt2);
for (auto v : B[i]) {
for (int x : v) {
st::add(x, 1);
}
}
}
}
for (int i = 0; i < m; i++) {
cout << ans[i] << '\n';
}
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 15
Accepted
Test #1:
score: 15
Accepted
time: 1ms
memory: 7872kb
input:
15 10 5 4 4 10 6 1 5 3 10 2 2 3 7 9 8
output:
12 11 11 11 11 12 12 12 12 11
result:
ok 10 lines
Test #2:
score: 0
Accepted
time: 1ms
memory: 7756kb
input:
12 10 8 10 3 6 3 1 9 5 4 1 2 7
output:
8 9 8 9 9 9 9 9 9 9
result:
ok 10 lines
Test #3:
score: 0
Accepted
time: 1ms
memory: 7908kb
input:
13 10 9 3 4 7 5 6 9 10 9 10 1 2 8
output:
9 9 9 9 9 9 9 9 9 9
result:
ok 10 lines
Test #4:
score: 0
Accepted
time: 1ms
memory: 7884kb
input:
15 4 3 3 2 4 4 4 4 1 4 4 4 4 4 2 4
output:
5 4 3 3
result:
ok 4 lines
Test #5:
score: 0
Accepted
time: 1ms
memory: 7724kb
input:
14 3 2 1 3 3 2 2 2 3 1 3 3 3 1 2
output:
6 4 4
result:
ok 3 lines
Test #6:
score: 0
Accepted
time: 1ms
memory: 7616kb
input:
13 10 4 10 8 7 9 5 5 1 7 6 8 3 2
output:
10 10 10 10 9 10 9 9 10 10
result:
ok 10 lines
Test #7:
score: 0
Accepted
time: 1ms
memory: 7872kb
input:
14 9 9 3 5 6 4 2 5 8 9 1 6 7 7 5
output:
10 10 10 10 9 9 9 10 9
result:
ok 9 lines
Test #8:
score: 0
Accepted
time: 1ms
memory: 7744kb
input:
15 7 2 2 6 1 1 4 2 3 5 4 7 5 6 6 4
output:
10 9 11 9 10 9 11
result:
ok 7 lines
Test #9:
score: 0
Accepted
time: 1ms
memory: 7724kb
input:
15 6 6 3 5 1 6 2 2 2 2 3 4 2 1 3 1
output:
7 7 7 9 9 8
result:
ok 6 lines
Test #10:
score: 0
Accepted
time: 1ms
memory: 7728kb
input:
15 5 2 2 1 5 3 5 5 2 4 1 1 4 3 2 2
output:
7 7 8 8 7
result:
ok 5 lines
Test #11:
score: 0
Accepted
time: 1ms
memory: 7752kb
input:
10 10 8 10 2 5 6 7 9 4 1 3
output:
8 8 8 8 8 8 8 8 8 8
result:
ok 10 lines
Test #12:
score: 0
Accepted
time: 1ms
memory: 7868kb
input:
10 10 10 8 4 6 1 5 3 7 2 9
output:
8 8 8 8 8 8 8 8 8 8
result:
ok 10 lines
Test #13:
score: 0
Accepted
time: 1ms
memory: 7732kb
input:
10 8 5 6 7 8 3 1 2 6 7 4
output:
7 7 7 7 7 6 6 7
result:
ok 8 lines
Test #14:
score: 0
Accepted
time: 1ms
memory: 7728kb
input:
9 4 3 4 2 2 1 4 2 3 1
output:
4 4 4 4
result:
ok 4 lines
Test #15:
score: 0
Accepted
time: 1ms
memory: 7740kb
input:
9 3 2 1 3 2 2 3 2 3 3
output:
4 2 2
result:
ok 3 lines
Test #16:
score: 0
Accepted
time: 1ms
memory: 7744kb
input:
10 3 3 2 3 1 2 3 3 3 1 1
output:
3 4 3
result:
ok 3 lines
Test #17:
score: 0
Accepted
time: 1ms
memory: 7916kb
input:
10 9 7 6 1 4 8 2 6 3 5 9
output:
7 7 7 7 7 7 7 7 7
result:
ok 9 lines
Test #18:
score: 0
Accepted
time: 1ms
memory: 7720kb
input:
10 7 3 2 1 7 5 3 5 6 1 4
output:
6 7 6 7 6 7 7
result:
ok 7 lines
Test #19:
score: 0
Accepted
time: 1ms
memory: 7704kb
input:
10 6 5 5 4 6 4 6 2 3 1 3
output:
7 7 6 6 6 6
result:
ok 6 lines
Test #20:
score: 0
Accepted
time: 0ms
memory: 7756kb
input:
10 5 4 3 3 2 1 2 5 5 5 4
output:
6 5 5 5 5
result:
ok 5 lines
Test #21:
score: 0
Accepted
time: 0ms
memory: 7656kb
input:
2 2 1 2
output:
0 0
result:
ok 2 lines
Test #22:
score: 0
Accepted
time: 1ms
memory: 7964kb
input:
2 1 1 1
output:
0
result:
ok single line: '0'
Test #23:
score: 0
Accepted
time: 1ms
memory: 7616kb
input:
3 3 1 2 3
output:
1 1 1
result:
ok 3 lines
Test #24:
score: 0
Accepted
time: 1ms
memory: 7668kb
input:
3 2 1 2 1
output:
1 1
result:
ok 2 lines
Test #25:
score: 0
Accepted
time: 1ms
memory: 7908kb
input:
3 2 1 2 2
output:
0 0
result:
ok 2 lines
Test #26:
score: 0
Accepted
time: 1ms
memory: 7740kb
input:
3 1 1 1 1
output:
0
result:
ok single line: '0'
Subtask #2:
score: 30
Accepted
Dependency #1:
100%
Accepted
Test #27:
score: 30
Accepted
time: 46ms
memory: 13956kb
input:
100000 10 9 6 4 2 5 4 8 7 4 2 3 5 9 7 4 2 4 5 10 3 7 3 6 5 5 2 8 3 7 10 6 4 8 2 3 3 7 3 8 3 6 10 1 2 4 5 2 3 8 3 10 6 10 5 2 1 7 1 5 5 5 3 8 8 2 10 6 5 1 5 3 1 6 7 9 5 3 3 6 10 6 4 5 5 2 7 6 7 3 4 3 5 3 7 8 3 4 8 7 8 2 3 9 8 4 5 5 9 6 1 1 5 3 1 9 7 3 2 3 7 4 6 2 2 6 10 4 8 1 9 6 6 4 1 5 5 1 6 8 2 8 ...
output:
80838 80839 80871 80838 80845 81023 80919 80865 80849 80940
result:
ok 10 lines
Test #28:
score: 0
Accepted
time: 36ms
memory: 13188kb
input:
100000 4 1 3 2 1 3 2 2 4 1 4 1 4 2 1 4 3 4 1 4 3 3 1 4 2 1 4 4 3 4 1 1 4 1 1 1 4 2 2 3 4 2 4 3 3 3 1 3 2 2 2 3 2 4 2 4 4 3 3 2 4 2 4 3 4 4 1 2 1 1 2 1 2 1 2 3 1 1 1 1 3 1 3 4 1 3 2 3 3 3 1 2 3 3 3 1 4 3 2 4 3 2 1 4 1 4 2 2 4 2 4 3 3 4 2 3 3 2 2 4 3 1 1 1 2 3 1 4 1 1 2 2 4 4 3 3 3 3 1 2 1 1 4 3 4 4 4...
output:
56149 56136 56136 56200
result:
ok 4 lines
Test #29:
score: 0
Accepted
time: 51ms
memory: 13624kb
input:
99999 9 2 5 8 8 9 9 3 8 9 7 9 1 7 8 9 2 8 9 5 2 6 2 6 4 1 7 7 2 4 9 9 6 4 2 1 2 1 6 1 9 5 8 4 8 3 6 1 3 5 9 6 3 8 4 8 7 5 4 9 8 2 9 1 6 5 7 1 2 2 6 3 4 6 4 6 5 4 4 2 6 8 3 4 3 2 7 9 2 8 5 6 9 7 3 4 7 7 1 5 5 9 6 8 9 4 5 7 3 5 1 2 7 8 5 3 6 6 1 7 5 4 8 3 1 5 3 2 4 8 9 6 2 3 3 8 3 7 1 7 2 6 1 2 7 3 8 ...
output:
78990 78884 78751 78851 78883 78760 78857 78751 78856
result:
ok 9 lines
Test #30:
score: 0
Accepted
time: 43ms
memory: 13772kb
input:
99999 5 4 4 1 5 1 1 3 5 1 1 1 4 3 3 5 2 2 2 4 1 5 4 3 3 3 2 5 4 2 5 1 4 2 3 2 3 5 4 2 4 1 1 4 3 2 3 3 3 4 3 2 1 2 2 4 3 3 3 2 5 3 3 3 1 4 3 1 1 2 2 5 3 2 4 4 2 5 5 1 3 1 4 1 5 2 2 5 4 4 4 4 3 3 4 4 4 1 2 3 4 2 4 1 2 2 2 4 4 1 4 4 5 1 4 1 2 4 3 5 3 1 3 2 1 5 5 2 3 3 4 3 3 2 3 4 1 4 1 2 5 4 4 3 4 5 2 ...
output:
63846 63931 63782 63782 63961
result:
ok 5 lines
Test #31:
score: 0
Accepted
time: 52ms
memory: 13952kb
input:
100000 10 5 7 10 1 9 6 5 2 3 10 4 1 3 2 10 9 5 10 6 10 3 4 3 7 8 2 6 9 10 1 7 7 7 2 1 2 8 8 8 5 5 8 6 4 8 1 7 6 9 7 10 5 7 9 10 8 7 4 9 2 5 3 4 2 10 6 5 1 9 1 7 8 3 6 3 8 4 2 1 10 7 8 7 2 3 1 5 4 9 3 3 7 4 7 10 6 6 2 9 10 2 6 3 3 5 10 2 8 1 10 7 10 8 10 7 4 10 10 7 6 7 5 5 5 2 7 5 2 4 10 9 5 6 4 4 5...
output:
80739 80716 80873 80716 80902 80885 80751 80717 80777 80814
result:
ok 10 lines
Test #32:
score: 0
Accepted
time: 42ms
memory: 12852kb
input:
100000 4 3 1 4 1 2 3 2 2 3 3 2 1 2 2 2 3 4 3 1 3 3 4 2 2 3 3 2 2 4 2 1 2 2 2 3 1 1 2 4 1 4 1 4 3 2 1 1 2 4 2 1 1 3 3 4 2 1 3 4 1 1 3 1 3 3 3 4 3 2 3 1 1 1 3 3 4 3 1 3 4 4 4 4 4 3 3 4 4 3 1 2 2 4 2 3 2 3 4 1 1 3 1 4 1 4 1 4 1 4 1 3 4 3 2 3 4 1 2 1 3 1 2 2 1 2 2 2 1 1 3 4 3 3 1 2 2 3 1 4 3 3 4 2 1 2 3...
output:
56096 56174 56096 56199
result:
ok 4 lines
Test #33:
score: 0
Accepted
time: 48ms
memory: 13484kb
input:
99999 9 5 8 4 9 3 9 4 5 8 6 5 8 8 1 5 6 1 8 1 2 7 7 7 4 8 5 2 8 1 9 7 3 6 3 8 5 3 8 6 3 5 8 9 4 1 7 3 8 8 4 5 4 2 6 7 7 4 8 4 8 7 2 6 9 9 4 9 9 7 5 7 6 4 8 7 8 6 5 2 4 1 3 2 3 2 7 2 7 3 1 1 1 8 5 5 6 4 6 9 7 2 2 1 5 2 5 9 1 7 7 7 5 5 1 2 6 2 3 5 3 5 4 5 8 7 8 9 4 6 7 7 7 8 1 7 6 8 7 7 6 8 5 4 8 2 7 ...
output:
78839 78858 78674 78873 78944 78674 78867 78869 78844
result:
ok 9 lines
Test #34:
score: 0
Accepted
time: 44ms
memory: 13708kb
input:
99999 5 3 4 5 3 1 1 4 5 5 3 3 1 3 3 2 2 5 3 4 4 5 2 4 2 2 1 1 1 3 5 1 4 4 3 2 5 5 5 5 2 3 3 4 2 2 3 2 2 5 5 5 5 4 4 3 4 1 5 5 1 5 1 2 2 1 5 4 4 3 5 2 3 1 3 1 3 5 2 1 2 2 3 4 2 1 3 2 2 1 1 1 5 3 1 3 1 2 2 2 3 4 3 3 5 1 1 4 4 1 1 5 3 3 5 5 1 3 3 2 1 5 1 1 3 4 4 5 5 2 2 3 1 2 5 3 5 3 2 5 4 3 3 5 5 1 2 ...
output:
63920 63896 63742 63865 63742
result:
ok 5 lines
Subtask #3:
score: 10
Accepted
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Test #35:
score: 10
Accepted
time: 54ms
memory: 13812kb
input:
100000 500 218 386 312 220 489 297 165 328 247 102 229 162 30 394 46 482 296 483 57 437 234 263 259 179 257 314 284 12 258 201 444 70 441 326 109 354 47 219 222 316 57 264 205 285 311 253 388 421 115 345 337 272 130 78 248 307 148 379 145 430 384 15 385 120 377 250 118 186 140 356 499 460 162 174 10...
output:
99568 99572 99562 99575 99587 99571 99572 99581 99576 99550 99545 99562 99559 99554 99581 99559 99551 99565 99560 99559 99567 99541 99550 99554 99588 99562 99553 99554 99540 99559 99564 99566 99567 99577 99550 99568 99547 99570 99571 99576 99569 99552 99584 99563 99554 99568 99570 99566 99553 99562 ...
result:
ok 500 lines
Test #36:
score: 0
Accepted
time: 45ms
memory: 13844kb
input:
100000 499 368 295 65 22 247 111 403 492 4 162 214 195 1 390 170 12 13 178 185 88 292 351 223 305 324 373 88 366 264 499 163 240 275 360 146 55 477 321 376 183 327 243 499 187 251 387 463 381 461 300 416 91 289 426 57 447 80 318 295 105 49 82 236 395 55 238 212 411 246 477 182 456 416 165 225 94 190...
output:
99557 99541 99566 99567 99556 99548 99562 99554 99559 99550 99585 99534 99554 99556 99563 99597 99544 99535 99561 99532 99569 99550 99560 99574 99547 99579 99550 99565 99558 99526 99561 99528 99540 99562 99544 99517 99575 99539 99551 99562 99554 99566 99570 99585 99548 99568 99527 99554 99554 99555 ...
result:
ok 499 lines
Test #37:
score: 0
Accepted
time: 53ms
memory: 13812kb
input:
99999 480 372 256 62 201 151 99 204 90 223 441 65 296 149 162 371 386 174 62 231 177 276 166 389 70 166 52 249 396 474 206 49 140 248 393 113 384 229 356 28 132 117 236 287 320 293 113 330 90 442 237 476 129 466 381 175 127 355 190 393 196 320 351 476 60 130 110 133 92 351 411 20 347 270 46 355 24 3...
output:
99552 99517 99539 99560 99567 99559 99573 99545 99520 99552 99558 99544 99567 99511 99557 99554 99560 99531 99548 99535 99515 99562 99526 99538 99559 99548 99536 99554 99552 99523 99536 99532 99578 99524 99564 99533 99541 99528 99565 99553 99545 99526 99565 99550 99511 99544 99551 99550 99559 99531 ...
result:
ok 480 lines
Test #38:
score: 0
Accepted
time: 49ms
memory: 13784kb
input:
99999 488 169 1 96 244 408 306 27 93 123 163 286 129 476 117 282 202 393 480 16 172 454 398 444 185 484 273 226 232 370 178 13 334 36 169 121 305 141 480 77 65 42 240 61 479 189 74 33 38 150 24 320 102 462 381 183 35 79 117 174 368 161 65 98 396 256 287 117 146 400 294 470 146 212 473 439 154 421 29...
output:
99545 99533 99562 99548 99538 99536 99545 99544 99532 99527 99556 99542 99539 99559 99543 99527 99534 99531 99553 99567 99568 99542 99545 99543 99533 99549 99543 99553 99542 99549 99533 99532 99538 99537 99564 99570 99541 99554 99565 99577 99558 99578 99552 99575 99554 99554 99528 99528 99557 99557 ...
result:
ok 488 lines
Test #39:
score: 0
Accepted
time: 45ms
memory: 13884kb
input:
99999 498 166 168 268 493 249 48 329 55 431 418 233 463 232 34 362 462 256 329 497 122 159 7 377 223 464 437 208 389 77 392 356 168 379 108 480 106 203 130 288 3 492 114 496 232 202 459 5 314 145 250 492 149 24 153 126 40 43 94 183 391 340 158 176 25 45 116 236 108 361 213 103 159 320 192 185 212 35...
output:
99547 99530 99544 99556 99550 99553 99562 99556 99550 99569 99548 99536 99550 99548 99553 99554 99565 99549 99551 99565 99549 99565 99577 99542 99541 99513 99556 99560 99573 99539 99569 99559 99567 99564 99559 99550 99544 99553 99568 99543 99513 99546 99550 99558 99545 99573 99567 99550 99555 99541 ...
result:
ok 498 lines
Test #40:
score: 0
Accepted
time: 50ms
memory: 14592kb
input:
100000 500 129 129 129 425 129 27 129 195 129 200 129 487 129 279 129 349 129 178 129 146 129 445 129 61 129 278 129 207 129 185 129 124 129 289 129 45 129 184 129 2 129 253 129 352 129 18 129 83 129 361 129 53 129 213 129 434 129 181 129 268 129 273 129 312 129 375 129 271 129 242 129 119 129 277 1...
output:
98776 98776 99305 99312 98776 99291 99285 99275 99301 99298 99295 99290 98776 99284 98776 99308 99307 98776 99276 99282 99290 98776 99294 99302 99299 99298 98776 99295 99291 99304 99280 99284 99307 99263 99291 99285 99293 99291 99281 99289 99308 99296 98776 99301 98776 99285 99301 99286 99289 99292 ...
result:
ok 500 lines
Test #41:
score: 0
Accepted
time: 53ms
memory: 14312kb
input:
100000 500 185 185 185 255 185 51 185 485 185 139 185 28 185 155 185 464 185 49 185 390 185 256 185 405 185 380 185 463 185 85 185 253 185 106 185 330 185 387 185 410 185 188 185 266 185 187 185 209 185 451 185 449 185 57 185 381 185 52 185 260 185 4 185 35 185 404 185 110 185 208 185 407 185 321 18...
output:
99307 99294 99275 98764 99288 99303 99295 99298 99288 99275 99292 99301 99279 99297 99302 99287 99289 99288 99288 99284 99276 98764 99279 99300 99288 99292 99289 98764 99282 99265 99291 99271 99297 99281 98764 99280 99280 99304 98760 99290 98764 99297 99288 99282 99286 98764 99293 99290 98764 99279 ...
result:
ok 500 lines
Test #42:
score: 0
Accepted
time: 50ms
memory: 14456kb
input:
100000 400 1 1 1 147 1 50 1 61 1 384 1 5 1 315 1 252 1 99 1 221 1 213 1 287 1 369 1 394 1 159 1 207 1 279 1 297 1 150 1 354 1 175 1 292 1 88 1 397 1 176 1 205 1 44 1 109 1 208 1 378 1 37 1 374 1 320 1 313 1 28 1 396 1 192 1 89 1 349 1 358 1 395 1 20 1 139 1 253 1 236 1 249 1 117 1 30 1 398 1 59 1 36...
output:
98656 98656 99232 99237 98656 98656 99231 99239 99226 99226 99252 98656 99230 98656 99246 99260 99235 99246 99242 98656 98656 99249 99252 99242 99239 99252 99253 98656 99250 98656 98656 98656 99248 99238 99260 98656 98656 99247 99241 99245 98656 99240 99231 98656 99238 99249 99227 98656 99229 98656 ...
result:
ok 400 lines
Test #43:
score: 0
Accepted
time: 52ms
memory: 14420kb
input:
100000 300 36 36 36 63 36 295 36 137 36 32 36 94 36 223 36 22 36 252 36 191 36 125 36 242 36 117 36 130 36 240 36 160 36 166 36 232 36 225 36 192 36 116 36 87 36 40 36 71 36 113 36 83 36 248 36 93 36 226 36 112 36 95 36 136 36 199 36 1 36 270 36 128 36 59 36 35 36 46 36 273 36 272 36 147 36 80 36 16...
output:
98716 99194 98716 99233 99204 99201 98716 98716 99209 99209 99175 98716 98716 99199 98716 99189 99188 99202 99187 99180 99181 98716 99183 99204 99189 99203 99190 99180 98716 99178 98716 98716 99186 98716 98716 98716 99181 99201 99191 98716 98716 99188 99195 99193 98716 98716 99176 99203 99201 98716 ...
result:
ok 300 lines
Test #44:
score: 0
Accepted
time: 54ms
memory: 14592kb
input:
100000 500 194 194 194 102 194 500 194 161 194 289 194 71 194 329 194 211 194 337 194 319 194 29 194 301 194 411 194 182 194 18 194 452 194 360 194 116 194 353 194 57 194 234 194 328 194 333 194 113 194 298 194 115 194 271 194 394 194 25 194 419 194 478 194 177 194 243 194 175 194 150 194 187 194 13...
output:
99301 99310 98797 99300 99294 99299 99299 99311 99298 98797 99286 99311 99289 99301 98797 99302 99292 98797 98797 99300 99286 99290 99272 99292 98797 99306 98797 99294 98797 99297 99299 99307 99315 99283 98797 99294 99305 99294 99309 99314 98797 98797 99297 98797 99300 99296 99312 98797 98797 99304 ...
result:
ok 500 lines
Test #45:
score: 0
Accepted
time: 50ms
memory: 14688kb
input:
100000 500 365 365 365 309 365 79 365 330 365 187 365 54 365 112 365 247 365 358 365 461 365 88 365 207 365 195 365 299 365 345 365 120 365 89 365 236 365 475 365 85 365 178 365 134 365 400 365 402 365 137 365 56 365 423 365 181 365 353 365 146 365 377 365 117 365 427 365 32 365 225 365 368 365 431 ...
output:
99288 99303 99278 99301 99298 99299 99298 99299 99295 99303 99292 99291 99286 99321 99298 99288 99282 99281 99317 99304 99292 99302 99310 99318 99290 99292 99296 99290 99298 99302 99306 98785 98785 98785 99282 99287 99296 99305 98785 99292 99273 99300 99288 99310 99301 99309 99309 99301 99299 99294 ...
result:
ok 500 lines
Test #46:
score: 0
Accepted
time: 50ms
memory: 14424kb
input:
100000 400 353 353 353 334 353 6 353 125 353 257 353 364 353 383 353 379 353 352 353 105 353 317 353 61 353 288 353 394 353 389 353 93 353 301 353 16 353 139 353 238 353 303 353 372 353 398 353 274 353 344 353 370 353 48 353 254 353 65 353 256 353 73 353 66 353 179 353 229 353 59 353 76 353 104 353 ...
output:
99235 99235 98677 99247 99236 98677 99234 99247 99238 99261 98677 99245 99250 99240 99257 98677 99245 99244 99245 99237 99256 99241 98677 99251 99245 99258 99249 98677 99253 99242 99249 98677 99235 99252 99251 99275 99250 99250 98677 99248 99261 98677 98677 99243 99229 98677 99240 98677 99240 98677 ...
result:
ok 400 lines
Test #47:
score: 0
Accepted
time: 51ms
memory: 14520kb
input:
100000 300 11 11 11 5 11 121 11 13 11 291 11 118 11 211 11 263 11 101 11 3 11 115 11 186 11 149 11 292 11 59 11 218 11 105 11 19 11 143 11 294 11 46 11 86 11 155 11 213 11 177 11 198 11 224 11 231 11 194 11 205 11 42 11 278 11 130 11 216 11 97 11 178 11 168 11 237 11 246 11 268 11 280 11 183 11 2 11...
output:
99198 98737 98737 99179 98737 99180 99216 98737 99189 98737 98737 99190 98737 99206 99179 98737 99193 99209 98737 99168 99203 99203 99187 99200 99185 99177 98737 98737 99178 99224 99212 99218 99189 98737 99190 98737 99201 99178 99195 99209 98737 98737 99210 99196 98737 98737 98737 98737 99189 99193 ...
result:
ok 300 lines
Subtask #4:
score: 25
Accepted
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
100%
Accepted
Test #48:
score: 25
Accepted
time: 736ms
memory: 78592kb
input:
1000000 3000 965 2888 1026 2566 1409 2446 1203 2953 1580 2648 1444 1013 653 506 165 187 440 1002 413 2109 1660 1504 736 544 431 835 2856 1961 2439 2488 944 2404 87 1605 1453 26 83 374 1255 703 2376 2036 544 685 2008 605 1701 1767 2928 2988 2930 2294 989 1105 2823 105 840 2464 896 914 1208 1407 315 1...
output:
999275 999275 999271 999276 999269 999267 999272 999269 999249 999286 999284 999309 999270 999266 999260 999290 999295 999270 999307 999268 999308 999217 999284 999284 999262 999283 999244 999283 999280 999300 999262 999290 999286 999252 999275 999289 999262 999273 999259 999254 999268 999275 999274...
result:
ok 3000 lines
Test #49:
score: 0
Accepted
time: 708ms
memory: 78672kb
input:
1000000 2999 1172 2189 2123 1738 1505 659 1334 637 417 1578 1473 1901 2141 826 1428 740 465 1043 583 1546 351 2282 1138 1339 2167 2317 1392 2264 1523 2596 2714 2496 1178 141 822 846 257 323 1343 1814 2031 105 1021 1526 308 916 1752 1658 928 114 2676 193 316 529 646 1273 2754 1039 2262 2491 2314 2059...
output:
999245 999266 999275 999279 999257 999245 999234 999245 999255 999245 999265 999251 999242 999248 999232 999267 999256 999272 999227 999256 999225 999259 999225 999272 999241 999252 999246 999237 999239 999230 999260 999273 999241 999216 999245 999229 999231 999262 999251 999243 999250 999268 999263...
result:
ok 2999 lines
Test #50:
score: 0
Accepted
time: 713ms
memory: 78592kb
input:
999999 2998 2157 1821 2311 436 1560 2817 2645 1859 1291 1766 1588 632 935 2707 2105 2218 808 2155 2462 2495 924 1366 2100 1061 694 136 2229 1567 1158 1842 391 2468 885 1713 2859 1028 1439 1152 2249 1035 71 1521 1316 1611 376 697 1301 2406 2195 1482 2627 1478 896 2428 1606 1194 2069 915 251 1049 1888...
output:
999254 999275 999254 999245 999265 999256 999259 999267 999253 999292 999239 999268 999266 999285 999268 999252 999244 999275 999259 999237 999253 999262 999268 999246 999293 999261 999268 999231 999279 999278 999220 999259 999225 999262 999240 999296 999274 999242 999266 999247 999216 999259 999263...
result:
ok 2998 lines
Test #51:
score: 0
Accepted
time: 685ms
memory: 78676kb
input:
999999 1500 819 1072 414 740 903 6 502 970 409 752 217 515 483 403 265 439 1061 169 469 516 1219 85 698 1027 323 228 734 1412 1025 586 36 177 1057 974 878 1006 1087 1392 1291 996 1212 698 1160 1180 1367 426 23 768 734 722 546 1381 853 806 255 919 1078 210 1230 1449 119 174 134 1020 408 808 427 761 1...
output:
998571 998617 998543 998584 998572 998587 998615 998627 998592 998582 998585 998601 998618 998586 998548 998561 998571 998544 998578 998575 998593 998551 998546 998598 998596 998583 998598 998614 998580 998583 998637 998597 998597 998571 998560 998607 998584 998621 998593 998627 998568 998584 998533...
result:
ok 1500 lines
Test #52:
score: 0
Accepted
time: 653ms
memory: 70148kb
input:
999999 1000 97 187 493 19 492 622 453 92 533 301 950 148 928 785 313 986 666 2 45 908 887 319 74 447 158 676 800 407 198 816 848 95 320 383 813 769 969 342 106 255 456 378 264 426 420 164 988 96 177 594 825 433 827 703 303 556 866 394 472 362 149 473 320 243 739 202 720 997 476 686 409 54 631 100 39...
output:
997910 997905 997829 997877 997868 997882 997851 997918 997881 997892 997911 997912 997911 997929 997866 997869 997894 997861 997853 997906 997911 997849 997897 997916 997909 997899 997932 997844 997947 997884 997937 997928 997897 997885 997841 997922 997853 997883 997859 997913 997918 997950 997877...
result:
ok 1000 lines
Test #53:
score: 0
Accepted
time: 617ms
memory: 76568kb
input:
1000000 3000 1050 1050 1050 164 1050 161 1050 2105 1050 2785 1050 1818 1050 91 1050 2497 1050 760 1050 2308 1050 2000 1050 2338 1050 1152 1050 548 1050 339 1050 476 1050 133 1050 396 1050 1692 1050 942 1050 2686 1050 353 1050 2471 1050 710 1050 904 1050 737 1050 1010 1050 1625 1050 2377 1050 1881 10...
output:
998254 998262 996784 998247 998239 998248 998243 998274 998263 998265 998245 998276 998266 998251 998254 998249 998254 998263 998284 998272 998241 998227 998262 998244 998246 998268 998241 996784 998246 996784 998240 998245 998240 998265 998257 996784 996784 998276 998246 998258 998257 998216 998253...
result:
ok 3000 lines
Test #54:
score: 0
Accepted
time: 574ms
memory: 70732kb
input:
1000000 3000 330 330 330 677 330 2541 330 2878 330 1423 330 2565 330 1901 330 1534 330 2833 330 2154 330 2681 330 670 330 2638 330 53 330 1158 330 1845 330 796 330 672 330 3 330 686 330 57 330 2349 330 1015 330 2615 330 726 330 1915 330 1694 330 2682 330 761 330 2373 330 282 330 1769 330 973 330 260...
output:
998116 996344 996344 996344 998112 998099 998104 996344 998117 998114 996344 998120 998110 998115 998104 998114 998113 998114 998097 998108 998108 998102 996344 998101 998115 998107 998110 998099 998101 998093 998111 998109 998116 998104 998115 998111 998111 996344 998107 998109 998111 998120 998110...
result:
ok 3000 lines
Test #55:
score: 0
Accepted
time: 567ms
memory: 69604kb
input:
1000000 3000 2100 2100 2100 2543 2100 2559 2100 2290 2100 2424 2100 818 2100 169 2100 2648 2100 713 2100 1499 2100 1483 2100 749 2100 2391 2100 1370 2100 696 2100 1007 2100 225 2100 2564 2100 987 2100 223 2100 893 2100 1641 2100 1705 2100 2641 2100 1050 2100 1582 2100 3 2100 695 2100 922 2100 1273 2...
output:
998094 998091 996312 998097 998090 998109 998104 998098 998097 996312 998101 998084 998101 998089 998105 996312 998090 998100 998099 998109 998100 998093 996312 998091 998088 996312 998092 998097 998105 998093 998091 998092 998094 998092 998096 998105 998096 998092 996312 996312 996312 998087 998084...
result:
ok 3000 lines
Test #56:
score: 0
Accepted
time: 560ms
memory: 68060kb
input:
1000000 3000 163 163 163 1754 163 2216 163 565 163 1545 163 545 163 1993 163 2253 163 1132 163 1201 163 1913 163 2705 163 1000 163 2274 163 2992 163 1807 163 237 163 192 163 391 163 1340 163 1176 163 376 163 2174 163 494 163 2398 163 1594 163 1472 163 2405 163 2170 163 2962 163 2301 163 1761 163 206...
output:
996144 998047 998049 998028 998031 998033 996144 996144 998056 996144 998039 998046 998037 998042 998048 998044 998037 998041 998038 998043 998048 998048 998046 998032 998046 998048 998044 998046 998052 998049 998045 998045 998037 998034 996144 998045 996144 996144 998049 998044 998047 996144 998040...
result:
ok 3000 lines
Subtask #5:
score: 20
Accepted
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
100%
Accepted
Dependency #4:
100%
Accepted
Test #57:
score: 20
Accepted
time: 1169ms
memory: 105096kb
input:
1000000 1000000 460697 909030 916528 216636 292058 10123 358382 31043 310167 229612 296966 32639 847131 688280 872577 946316 144444 634767 890494 957419 342594 868027 364972 772791 204147 592501 427467 436925 8142 875837 934848 988404 551018 729107 150769 858963 895170 625075 125255 478854 561799 17...
output:
999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998...
result:
ok 1000000 lines
Test #58:
score: 0
Accepted
time: 1181ms
memory: 93432kb
input:
1000000 599999 361214 557178 583011 571899 270540 426435 102867 86699 202345 588818 131584 292702 33894 574807 488902 109326 89350 412167 283812 141153 16934 573498 511751 288088 469021 536118 292783 521311 96523 194741 178821 171820 26371 168459 169241 300293 245929 344475 376192 26939 535476 13277...
output:
999989 999991 999991 999989 999989 999990 999990 999989 999991 999991 999991 999991 999991 999990 999989 999990 999987 999991 999991 999990 999990 999990 999990 999990 999989 999991 999991 999990 999991 999991 999990 999991 999990 999990 999991 999990 999990 999990 999990 999991 999991 999988 999991...
result:
ok 599999 lines
Test #59:
score: 0
Accepted
time: 1228ms
memory: 94112kb
input:
1000000 598000 288110 415749 408160 487213 588013 187971 131342 557374 483234 496521 222425 466976 542355 408531 415527 183641 241810 210422 594068 476327 497721 138096 208320 140187 357340 2152 331316 357842 186115 7035 1139 454854 160747 363060 355265 321360 574633 339866 180309 557713 148002 8562...
output:
999989 999989 999990 999990 999990 999990 999990 999987 999990 999989 999990 999989 999990 999990 999988 999989 999990 999989 999988 999989 999989 999989 999989 999989 999990 999990 999989 999989 999990 999990 999990 999990 999989 999990 999989 999990 999990 999989 999990 999990 999990 999990 999989...
result:
ok 598000 lines
Test #60:
score: 0
Accepted
time: 1227ms
memory: 96740kb
input:
1000000 698989 84925 260501 378802 79966 452000 632392 677279 91042 622456 291534 77206 398078 564273 224047 240896 615127 405121 426360 34832 96695 361915 213810 68343 566401 128726 522968 593182 537418 258130 618489 617712 417198 395401 517888 543806 466616 302392 305093 300549 283636 354222 55280...
output:
999992 999992 999990 999991 999992 999992 999991 999992 999991 999992 999991 999992 999990 999992 999991 999991 999991 999991 999992 999992 999990 999990 999992 999992 999991 999991 999992 999991 999991 999992 999992 999992 999992 999992 999992 999991 999992 999991 999992 999990 999992 999992 999992...
result:
ok 698989 lines
Test #61:
score: 0
Accepted
time: 1228ms
memory: 96232kb
input:
1000000 700000 332702 444773 603573 233686 498271 10861 173530 174622 44227 539027 126699 240815 81861 697726 459218 95747 550312 194951 458984 246807 408581 155123 633498 387732 644237 396448 617136 105663 412004 63165 314307 585266 464238 156238 579940 616061 604421 7965 485566 394460 66446 92562 ...
output:
999991 999992 999992 999992 999991 999990 999991 999992 999992 999991 999991 999991 999992 999992 999992 999991 999992 999992 999992 999992 999990 999992 999992 999989 999992 999992 999991 999992 999992 999992 999992 999992 999991 999991 999992 999992 999992 999992 999992 999992 999992 999992 999992...
result:
ok 700000 lines
Test #62:
score: 0
Accepted
time: 767ms
memory: 81632kb
input:
1000000 297082 293350 293350 293350 155743 293350 172740 293350 19164 293350 14893 293350 277441 293350 77843 293350 154988 293350 14375 293350 86033 293350 113169 293350 269101 293350 91750 293350 103925 293350 90642 293350 24115 293350 189404 293350 214603 293350 279756 293350 127074 293350 26054 ...
output:
998389 998389 998387 998389 998389 998389 998388 998389 998388 998389 998389 998389 998389 998388 998389 998389 998389 998389 998389 998388 998389 998389 998389 998389 998389 998389 998389 998389 998389 998388 998389 998389 998389 998389 998389 998387 998389 998389 998389 998389 998389 998389 998388...
result:
ok 297082 lines
Test #63:
score: 0
Accepted
time: 896ms
memory: 90608kb
input:
1000000 420792 322464 322464 322464 172248 322464 1868 322464 149426 322464 370413 322464 101488 322464 230219 322464 255721 322464 366542 322464 408015 322464 169734 322464 361955 322464 348151 322464 161990 322464 419765 322464 258241 322464 125504 322464 104882 322464 377466 322464 363400 322464 ...
output:
998729 998728 998728 998728 998729 998729 998729 998729 998727 998729 998729 998729 998729 998728 998729 998729 998729 998729 998729 998729 998729 998728 998728 998729 998728 998729 998728 998729 998728 998729 998729 998729 998729 998729 998729 998729 998729 998729 998728 998729 998729 998727 998728...
result:
ok 420792 lines
Test #64:
score: 0
Accepted
time: 819ms
memory: 87008kb
input:
1000000 346039 221822 221822 221822 240356 221822 296775 221822 180352 221822 238652 221822 138916 221822 56855 221822 328419 221822 162954 221822 233110 221822 299574 221822 204286 221822 49163 221822 77068 221822 324949 221822 151997 221822 76636 221822 224473 221822 227523 221822 33025 221822 765...
output:
998553 998553 998553 998553 998552 998553 998551 998553 998552 998553 998553 998552 998553 998552 998553 998553 998550 998553 998553 998552 998553 998553 998553 998553 998553 998553 998552 998553 998551 998553 998553 998552 998553 998553 998553 998553 998553 998553 998552 998553 998553 998553 998553...
result:
ok 346039 lines
Test #65:
score: 0
Accepted
time: 666ms
memory: 74268kb
input:
1000000 156661 25329 25329 25329 72101 25329 42326 25329 30793 25329 89993 25329 8978 25329 63921 25329 21665 25329 23283 25329 84131 25329 40123 25329 139679 25329 14167 25329 86150 25329 44969 25329 37018 25329 84736 25329 112689 25329 35879 25329 90614 25329 115370 25329 6677 25329 107431 25329 9...
output:
998189 998189 998189 998189 998187 998189 998189 998189 998189 998189 998189 998189 998189 998189 998189 998189 998189 998189 998189 998188 998189 998188 998189 998189 998189 998189 998189 998189 998189 998189 998189 998189 998189 998189 998188 998189 998189 998189 998189 998189 998189 998189 998188...
result:
ok 156661 lines
Extra Test:
score: 0
Extra Test Passed