QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#115307 | #2570. Maximal Subsequence | whatever | AC ✓ | 155ms | 34360kb | C++17 | 2.4kb | 2023-06-25 16:30:05 | 2023-06-25 16:30:07 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
mt19937_64 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define rep(i, a, b) for (int i = (a), I = (b); i <= I; ++i)
#define per(i, a, b) for (int i = (a), I = (b); i >= I; --i)
using i64 = long long;
using pii = pair<int, int>;
template<typename T> void up(T &x, T y) { if (x < y) x = y; }
template<typename T> void down(T &x, T y) { if (x > y) x = y; }
const int N = 500005;
int n, a[N], b[N], m, f[N], c[N], sz[N], l[N], r[N], ptr[N];
vector<int> seq[N];
bool vis[N];
void modify(int p, int x) {
for (; p <= m; p += p & -p) up(c[p], x);
}
int query(int p) {
int res = 0;
for (; p; p -= p & -p) up(res, c[p]);
return res;
}
bool check(int i, int j) {
return i < j && a[i] < a[j];
}
int main() {
ios::sync_with_stdio(0), cin.tie(0);
cin >> n;
rep(i, 1, n) {
cin >> a[i];
b[++m] = a[i];
}
sort(b + 1, b + m + 1);
m = unique(b + 1, b + m + 1) - b - 1;
rep(i, 1, n) {
a[i] = lower_bound(b + 1, b + m + 1, a[i]) - b;
f[i] = query(a[i] - 1) + 1;
modify(a[i], f[i]);
seq[f[i]].push_back(i);
}
int D = *max_element(f + 1, f + n + 1);
sz[D] = seq[D].size();
per(d, D - 1, 1) {
int p1 = 0, p2 = -1;
vector<int> tmp;
for (auto i : seq[d]) {
while (p1 < sz[d + 1] && seq[d + 1][p1] < i) ++p1;
while (p2 + 1 < sz[d + 1] && a[seq[d + 1][p2 + 1]] > a[i]) ++p2;
// cerr << "? " << i << " " << p1 << " " << p2 << "\n";
l[i] = p1, r[i] = p2;
if (l[i] <= r[i]) tmp.push_back(i);
}
seq[d] = tmp;
sz[d] = seq[d].size();
}
int ans = 0;
while (1) {
bool flag = true;
per(d, D, 1) {
while (ptr[d] < sz[d]) {
int i = seq[d][ptr[d]];
if (vis[i] || r[i] < ptr[d + 1]) ++ptr[d];
else break;
}
// cerr << "? " << d << " " << ptr[d] << " " << sz[d] << "\n";
if (ptr[d] == sz[d]) {
flag = false;
break;
}
}
if (!flag) break;
rep(d, 1, D) {
int i = seq[d][ptr[d]];
vis[i] = true;
if (d < D) up(ptr[d + 1], l[i]);
}
++ans;
}
cout << n - ans << "\n";
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 3ms
memory: 25244kb
input:
3 2 1 3
output:
2
result:
ok 1 number(s): "2"
Test #2:
score: 0
Accepted
time: 1ms
memory: 21380kb
input:
4 4 3 2 1
output:
0
result:
ok 1 number(s): "0"
Test #3:
score: 0
Accepted
time: 1ms
memory: 24940kb
input:
4 2 1 4 3
output:
2
result:
ok 1 number(s): "2"
Test #4:
score: 0
Accepted
time: 5ms
memory: 26136kb
input:
6 4 6 5 2 1 3
output:
4
result:
ok 1 number(s): "4"
Test #5:
score: 0
Accepted
time: 5ms
memory: 25348kb
input:
4 3 4 1 2
output:
2
result:
ok 1 number(s): "2"
Test #6:
score: 0
Accepted
time: 1ms
memory: 25992kb
input:
10 10 9 10 8 8 5 4 7 3 6
output:
7
result:
ok 1 number(s): "7"
Test #7:
score: 0
Accepted
time: 1ms
memory: 24776kb
input:
10 3 9 10 8 7 6 5 4 2 1
output:
9
result:
ok 1 number(s): "9"
Test #8:
score: 0
Accepted
time: 6ms
memory: 25272kb
input:
10 1 1 4 9 2 9 3 4 6 6
output:
9
result:
ok 1 number(s): "9"
Test #9:
score: 0
Accepted
time: 5ms
memory: 26020kb
input:
10 3 2 6 5 10 1 9 8 4 7
output:
7
result:
ok 1 number(s): "7"
Test #10:
score: 0
Accepted
time: 0ms
memory: 25944kb
input:
100 49 41 94 4 55 84 65 90 57 37 52 100 69 30 86 72 82 63 96 51 20 39 78 79 32 27 50 5 33 54 56 60 30 51 24 21 65 55 36 81 5 4 67 42 21 59 7 18 31 6 36 50 98 59 90 85 72 23 47 6 60 16 7 17 34 100 10 3 30 59 70 45 37 88 18 18 96 45 12 86 50 3 96 55 35 71 66 92 39 48 96 33 47 18 65 40 17 45 44 75
output:
99
result:
ok 1 number(s): "99"
Test #11:
score: 0
Accepted
time: 1ms
memory: 25536kb
input:
100 42 80 72 41 37 58 85 47 81 55 35 53 51 22 48 39 38 60 57 54 11 77 9 52 50 49 67 61 7 78 79 45 44 70 75 43 66 21 25 69 19 18 62 59 34 6 68 5 14 33 4 65 84 83 90 32 89 64 3 71 46 13 29 96 36 20 63 12 17 2 31 23 76 56 1 16 27 94 8 82 86 74 93 98 30 97 28 26 91 40 24 73 88 10 99 15 92 87 100 95
output:
99
result:
ok 1 number(s): "99"
Test #12:
score: 0
Accepted
time: 5ms
memory: 26656kb
input:
100 20 54 69 51 85 46 20 62 30 74 74 79 73 68 57 28 3 95 63 33 94 6 41 2 12 67 65 48 59 25 82 91 75 71 74 53 39 10 91 74 80 83 47 18 4 10 78 39 61 56 84 44 23 10 17 83 21 8 55 96 41 7 3 92 55 91 36 59 22 66 79 81 60 87 97 17 97 72 28 49 79 64 55 64 37 70 97 8 71 16 38 76 72 97 30 8 57 3 76 59
output:
99
result:
ok 1 number(s): "99"
Test #13:
score: 0
Accepted
time: 3ms
memory: 26056kb
input:
100 22 32 18 17 16 15 27 14 13 12 34 62 56 11 10 71 67 58 69 9 8 53 7 65 6 24 68 61 55 64 54 70 46 77 39 23 47 93 75 21 79 63 57 94 52 50 5 4 60 49 20 30 43 41 98 40 80 95 48 51 31 42 97 96 28 78 45 100 89 36 85 19 84 26 83 90 25 44 88 72 92 66 3 29 38 59 91 37 33 87 2 99 82 74 86 73 81 76 35 1
output:
99
result:
ok 1 number(s): "99"
Test #14:
score: 0
Accepted
time: 3ms
memory: 26056kb
input:
1000 819 920 775 572 849 296 520 348 244 466 439 291 274 574 906 753 890 107 195 314 259 233 979 941 132 280 922 29 489 439 392 676 613 30 144 843 266 532 975 644 450 770 609 336 890 853 309 361 418 992 84 834 646 568 837 425 768 566 220 460 715 265 551 801 849 121 944 940 551 709 646 653 164 318 83...
output:
999
result:
ok 1 number(s): "999"
Test #15:
score: 0
Accepted
time: 3ms
memory: 24776kb
input:
1000 361 377 489 507 362 575 549 537 333 492 263 353 397 518 381 240 427 547 375 360 565 338 327 554 405 542 519 435 582 577 466 573 224 420 174 571 567 563 334 606 331 555 428 426 167 303 300 687 383 409 430 572 413 410 286 271 162 357 376 301 320 229 526 704 152 423 196 562 742 414 738 501 616 343...
output:
997
result:
ok 1 number(s): "997"
Test #16:
score: 0
Accepted
time: 0ms
memory: 25164kb
input:
1000 55 769 603 85 241 474 961 559 563 916 590 261 260 693 428 853 681 398 962 883 346 51 969 333 59 725 224 543 229 451 441 280 106 796 265 875 988 590 659 760 198 251 670 576 754 279 467 748 953 195 624 350 54 117 503 598 604 870 175 326 523 82 778 151 327 523 502 282 729 647 285 792 868 14 988 60...
output:
999
result:
ok 1 number(s): "999"
Test #17:
score: 0
Accepted
time: 3ms
memory: 26740kb
input:
1000 314 313 290 366 455 307 470 468 294 293 513 604 292 490 450 379 291 674 665 632 452 699 649 675 462 428 698 435 609 708 608 706 369 590 289 678 432 246 424 488 677 676 654 669 673 671 618 370 473 334 512 418 655 198 417 373 647 371 652 650 340 610 352 344 339 338 666 281 619 335 622 481 621 333...
output:
998
result:
ok 1 number(s): "998"
Test #18:
score: 0
Accepted
time: 3ms
memory: 26296kb
input:
10000 1717 6659 2714 3414 9689 9082 1018 9346 4430 1519 8736 8849 5249 7323 5875 5573 3283 1686 3325 4530 6956 8049 4767 6449 4867 8637 6509 783 8759 3394 7246 971 633 6169 3981 9563 6559 3346 2379 103 5715 8527 6154 6093 7634 8215 435 9884 2222 4708 6449 5609 7965 8261 3956 6765 5191 8797 2736 5700...
output:
9999
result:
ok 1 number(s): "9999"
Test #19:
score: 0
Accepted
time: 7ms
memory: 24892kb
input:
10000 2869 2784 2620 2612 2498 2259 3364 3659 3066 2297 3670 2216 3711 3973 3669 4190 2231 2221 4141 3668 4121 3865 2218 3667 3823 3687 3660 2217 3967 3516 4101 2085 2139 3495 3666 3664 3724 2101 4004 2098 3663 3469 2092 3103 3569 2034 2660 3675 2572 2055 1975 2475 3589 3577 3991 3576 2006 3990 2283...
output:
9999
result:
ok 1 number(s): "9999"
Test #20:
score: 0
Accepted
time: 3ms
memory: 25560kb
input:
10000 1740 7536 2016 4858 6731 3728 9017 8060 8734 5054 1531 952 6559 2970 5968 4926 4170 8837 1879 8114 1553 7014 6261 6716 1289 3350 2927 5369 1675 1364 3474 5223 6004 6051 7131 2509 6613 4087 5951 2737 9459 7500 84 4048 8904 3983 9878 329 3776 9234 787 6146 1789 4444 6111 2978 9604 8903 9681 3653...
output:
9999
result:
ok 1 number(s): "9999"
Test #21:
score: 0
Accepted
time: 3ms
memory: 26352kb
input:
10000 3203 2415 3106 2365 2741 2918 2164 1671 1573 2700 2882 3190 3109 3329 2696 2742 3186 1564 2468 2791 2752 3129 2748 2579 2395 1901 1448 1751 2693 1408 2649 2537 3382 2496 2621 3700 3814 1322 988 875 4028 3870 3860 3255 2222 3250 1616 2457 3037 3543 844 2867 777 3826 2448 2187 2080 3824 2691 359...
output:
9999
result:
ok 1 number(s): "9999"
Test #22:
score: 0
Accepted
time: 18ms
memory: 27572kb
input:
100000 87749 50818 8453 11057 62629 70852 87583 27268 80014 39398 39511 47072 9574 4670 41469 33430 46505 22041 80471 81835 5509 11125 89116 99993 7453 84742 68858 92109 65383 41205 86032 6315 95278 93500 72917 87046 73456 47211 40783 86408 87264 70342 18173 6352 83717 26853 64110 32463 85658 43347 ...
output:
99999
result:
ok 1 number(s): "99999"
Test #23:
score: 0
Accepted
time: 20ms
memory: 27420kb
input:
100000 19962 19268 22022 21871 18198 24722 19221 16798 26580 25698 26869 27777 26516 22500 26591 25945 28210 18779 16777 26301 17425 29028 16486 24412 28531 24812 24564 20540 16788 30218 20347 16746 28425 16622 28321 24443 18958 28222 18371 19126 24907 18924 16528 24663 28355 28214 13942 26241 12784...
output:
99999
result:
ok 1 number(s): "99999"
Test #24:
score: 0
Accepted
time: 23ms
memory: 26652kb
input:
100000 88792 97162 34236 1274 68523 13712 47564 79427 97313 86268 12260 21212 46131 90716 1487 39829 78975 6979 24315 80132 64454 55398 67739 35200 32493 44416 71752 64614 6620 8431 21724 57493 81794 65428 32437 93393 87278 35191 86200 68163 43799 83041 68556 69303 36758 55745 31067 36188 24167 3306...
output:
99999
result:
ok 1 number(s): "99999"
Test #25:
score: 0
Accepted
time: 18ms
memory: 27300kb
input:
100000 21244 22880 21672 22418 20285 19702 22707 22656 22320 19249 22390 22156 22185 20776 21403 22289 19282 22062 22088 20359 18963 22085 22029 22039 20124 22037 22036 22033 18118 17676 20983 16935 21832 19234 18645 18249 23425 22395 18376 24627 23499 13573 20174 25261 18260 23051 11439 10986 17943...
output:
99999
result:
ok 1 number(s): "99999"
Test #26:
score: 0
Accepted
time: 149ms
memory: 31432kb
input:
500000 253528 305623 102228 172691 314079 478080 19515 252289 498033 131990 382476 74481 66251 98569 253713 29582 386624 262525 427622 280022 158038 410058 382139 177497 387049 393275 384086 319421 315656 85744 113166 208061 62259 278972 392785 446661 219235 45927 498879 435064 382498 156653 494860 ...
output:
499999
result:
ok 1 number(s): "499999"
Test #27:
score: 0
Accepted
time: 129ms
memory: 31512kb
input:
500000 75809 80913 77342 82005 76731 85128 87130 80092 81854 81234 88678 76456 72826 68356 76312 76315 72724 83575 65258 78189 77261 62660 87640 61268 63149 84109 58354 60984 81788 58580 50796 46700 81128 46471 82989 54161 51082 47828 66911 81824 62587 81703 62575 44939 84731 61835 81451 46647 81337...
output:
499996
result:
ok 1 number(s): "499996"
Test #28:
score: 0
Accepted
time: 155ms
memory: 32976kb
input:
500000 383417 181772 98656 168913 121969 440285 244784 136500 62620 228463 393870 492155 264194 32417 28663 289382 437138 461140 467304 109530 67420 319920 29126 204479 91510 496063 98615 188288 415224 191949 430695 278478 298687 50958 204453 418142 313549 256408 223427 7366 477479 280516 258105 965...
output:
499999
result:
ok 1 number(s): "499999"
Test #29:
score: 0
Accepted
time: 124ms
memory: 32944kb
input:
500000 66162 67153 59307 59212 66470 75301 74086 71913 60963 76837 56295 77088 65327 76993 76991 55469 79119 71986 81193 81287 56731 53647 70925 81220 72045 53987 70425 80674 69803 82346 65310 53827 81554 66539 42176 65683 79369 82092 73229 81565 81626 39102 47280 72032 81576 81499 60624 76283 81316...
output:
499999
result:
ok 1 number(s): "499999"
Test #30:
score: 0
Accepted
time: 122ms
memory: 31204kb
input:
500000 73972 74211 74106 71752 73212 77269 73913 73452 63910 68293 67699 76772 57294 71407 77634 65168 69122 52515 75633 65047 81284 82145 76037 75866 75834 51899 75670 84033 83032 82012 60483 65374 75652 75645 50455 82017 63992 81519 84137 75640 83563 81513 49945 75639 85354 79959 66098 79996 77764...
output:
499999
result:
ok 1 number(s): "499999"
Test #31:
score: 0
Accepted
time: 129ms
memory: 31236kb
input:
500000 78984 74883 74194 58707 74787 63980 60211 53995 46620 54237 76150 84208 78335 41992 86982 78487 47531 85877 78451 73025 71918 76031 40729 37647 77102 87130 44355 93483 57698 34574 76123 55897 96583 75086 75977 93141 87313 33867 32687 96903 32394 41339 38313 98979 93486 98041 70143 100716 7853...
output:
499999
result:
ok 1 number(s): "499999"
Test #32:
score: 0
Accepted
time: 75ms
memory: 31520kb
input:
500000 17036 16080 16635 17192 15635 16171 17211 15646 17206 14474 17194 15486 16774 14034 17816 15902 18506 18515 18029 19349 11614 17160 18675 15037 15576 9046 17986 17947 18387 8535 15003 19290 18429 8364 19812 17545 17860 8113 17663 15434 17648 18345 18298 19451 18396 19003 18169 18925 17247 192...
output:
497321
result:
ok 1 number(s): "497321"
Test #33:
score: 0
Accepted
time: 71ms
memory: 32332kb
input:
500000 13228 13661 14252 13253 14588 14517 14245 13853 14196 12902 13567 14253 13030 12693 12084 13391 12734 14278 11561 14264 14256 14255 13865 13339 14254 13332 13337 13335 13261 13611 13162 12382 14852 14840 9799 14049 15003 14505 14151 15175 13920 13398 12135 15262 13172 13374 9714 13016 15040 1...
output:
496841
result:
ok 1 number(s): "496841"
Test #34:
score: 0
Accepted
time: 128ms
memory: 32932kb
input:
500000 74732 72778 68455 66299 64735 79785 83692 65554 51051 70910 70653 82144 69661 65572 61488 82223 74926 73535 84158 63909 58520 84783 61325 50756 46811 75643 53509 80831 74727 72635 80661 80428 74038 73599 72653 74836 83924 66724 66821 65110 77878 82990 75751 63970 83505 70913 63760 51192 64722...
output:
499990
result:
ok 1 number(s): "499990"
Test #35:
score: 0
Accepted
time: 127ms
memory: 32136kb
input:
500000 74264 73500 82780 85897 69465 83992 64795 65511 87849 82203 88353 88083 81878 64930 64916 76622 64843 88002 64837 63413 92104 87891 58757 94624 87859 51179 90863 90214 47058 63296 68721 90909 90383 90974 83042 67841 93736 90355 91390 55506 90353 91033 90267 48403 90385 90543 48076 87365 90318...
output:
499988
result:
ok 1 number(s): "499988"
Test #36:
score: 0
Accepted
time: 134ms
memory: 32276kb
input:
500000 69235 66295 69128 67973 65147 63872 59425 67050 80364 81174 63648 80608 81262 80689 60197 57245 84332 56685 82585 77291 82411 68595 70052 69985 57543 60620 79260 68864 82537 56774 78884 56756 56672 82446 79865 76603 55226 55576 55230 55229 69324 54958 66967 65783 55173 84396 55126 55195 83909...
output:
499999
result:
ok 1 number(s): "499999"
Test #37:
score: 0
Accepted
time: 130ms
memory: 33092kb
input:
500000 75895 69186 79318 73203 81265 66863 85280 57606 82029 79577 56374 81293 55778 43603 80404 40982 71625 85394 82075 74229 78525 86931 84486 75926 73530 36505 32794 82330 75302 84252 72195 82156 74575 31572 73181 73073 71769 84187 83771 72907 31495 79649 80867 29295 88263 85864 85014 70696 80047...
output:
499999
result:
ok 1 number(s): "499999"
Test #38:
score: 0
Accepted
time: 120ms
memory: 32844kb
input:
500000 75243 74464 72548 71832 63449 72135 60124 68651 72659 71470 64964 55605 64688 70998 49986 48976 44907 75895 77029 63457 78173 75766 42078 40586 39713 76756 69270 76597 78113 65851 65816 64555 34956 76305 71425 61934 73867 67505 72538 78555 78288 81063 79230 80119 63472 78537 64115 78471 79415...
output:
499999
result:
ok 1 number(s): "499999"
Test #39:
score: 0
Accepted
time: 127ms
memory: 32312kb
input:
500000 72604 75144 73977 74709 79065 54074 76326 75942 77900 77827 51420 69069 77438 60894 70238 71136 69138 65444 75715 78481 63308 72754 72571 72215 61979 47900 46991 66978 60850 82976 78061 66457 55124 85975 84308 75042 71591 56765 72056 46634 61332 55761 80259 83300 83264 81316 59030 81258 80213...
output:
499999
result:
ok 1 number(s): "499999"
Test #40:
score: 0
Accepted
time: 124ms
memory: 33136kb
input:
500000 64913 61603 63057 58633 67502 70113 61970 69415 67096 69225 51738 66547 65442 67580 50032 66970 48232 57169 71680 65957 65837 55053 72359 46660 73154 52743 67949 63869 44359 64735 40465 35054 67389 72058 33888 43883 73126 72256 59391 61626 61857 54936 43818 48135 50060 72221 54918 48941 72679...
output:
499999
result:
ok 1 number(s): "499999"
Test #41:
score: 0
Accepted
time: 134ms
memory: 33228kb
input:
500000 66418 49631 67987 70030 73725 78938 45219 81751 73390 79292 68019 76936 78023 78739 78076 71299 69797 78058 77385 51707 77566 51446 81688 81171 83216 78222 45554 77787 59020 77437 74722 77397 77681 76004 84981 77571 44763 77498 44539 76877 66535 77071 63762 76542 85563 76836 72452 71813 76598...
output:
499999
result:
ok 1 number(s): "499999"
Test #42:
score: 0
Accepted
time: 123ms
memory: 32476kb
input:
500000 59161 69541 58875 46382 40080 66558 62164 61872 38282 34497 60745 71073 77763 59975 51335 81077 82442 30978 30177 72732 71448 49051 41162 84149 63993 25710 81958 22046 18998 38782 68749 81975 17336 62791 37977 36930 84941 16680 86969 76561 88218 14746 87916 71178 48292 72391 27109 54127 49828...
output:
499999
result:
ok 1 number(s): "499999"
Test #43:
score: 0
Accepted
time: 139ms
memory: 32964kb
input:
500000 63908 55861 65525 60365 59797 66896 64486 61948 53448 52026 66260 60763 60193 58081 72207 73817 71884 47759 47194 78482 80949 71661 79692 51788 81417 79722 48871 56692 79709 66309 47945 79152 79407 47777 47510 62476 77411 76997 47275 60221 61052 69439 50688 66168 47212 73851 79327 79179 52884...
output:
499999
result:
ok 1 number(s): "499999"
Test #44:
score: 0
Accepted
time: 123ms
memory: 32000kb
input:
500000 58353 55599 52980 44702 55255 51623 41493 36384 58166 57241 42562 38419 36854 34152 36446 55467 44595 35583 63485 56376 28810 37391 28775 48702 27852 34493 36344 30627 24186 61332 24484 45185 24454 24325 67488 20448 17657 57932 14921 61334 43762 63750 60928 23559 43319 62573 22952 57192 65258...
output:
499999
result:
ok 1 number(s): "499999"
Test #45:
score: 0
Accepted
time: 112ms
memory: 32368kb
input:
500000 66966 75662 51141 66087 62715 62274 50767 47107 39571 70599 75648 71370 70789 69276 62336 77655 62330 64817 62289 78707 34997 60466 78021 77903 58199 77774 34377 80147 33199 64762 79755 78841 32120 78255 29618 21798 62888 77792 77779 62858 77777 20251 77776 62392 77748 62358 77688 77659 77697...
output:
499999
result:
ok 1 number(s): "499999"
Test #46:
score: 0
Accepted
time: 134ms
memory: 31956kb
input:
500000 81914 89878 90472 90121 88530 86620 93382 74214 95276 89589 75332 61231 74813 93926 92200 50308 91125 46529 41626 85190 96750 95586 94814 96108 95611 92718 95209 94850 39746 67368 97483 97494 94848 94024 35681 96034 91614 27820 26801 94155 65586 83323 78290 24304 98238 60897 44473 97826 91760...
output:
499999
result:
ok 1 number(s): "499999"
Test #47:
score: 0
Accepted
time: 122ms
memory: 33116kb
input:
500000 70304 65082 79607 58958 58488 85116 81948 53923 86007 46178 80657 67885 65734 65609 71622 65757 39086 65652 86686 88438 55617 38230 88608 86278 90383 87131 50056 86035 90376 28080 87857 91414 86242 47977 58774 40132 86034 86710 91012 72582 86040 26211 90614 90390 91687 85041 25169 38697 64304...
output:
499999
result:
ok 1 number(s): "499999"
Test #48:
score: 0
Accepted
time: 53ms
memory: 31748kb
input:
500000 1485 1496 1551 1489 1547 1488 1523 1511 1617 1625 1495 1493 1426 1491 1622 1414 1618 1413 1460 1528 1613 1630 1650 1500 1626 1246 1494 1475 1481 1682 1526 1546 1711 1479 1562 1463 1708 1512 1472 1520 1465 1462 1685 1461 1651 1464 1684 1647 1433 1507 1614 1681 1370 1513 1556 1434 1629 1478 165...
output:
478471
result:
ok 1 number(s): "478471"
Test #49:
score: 0
Accepted
time: 59ms
memory: 31900kb
input:
500000 1768 1739 1839 1846 1856 1850 1842 1738 1813 1890 1851 1653 1843 1818 1556 1822 1889 1915 1868 1819 1844 1817 1909 1867 1683 1804 1870 1869 1580 1849 1806 1759 1532 1845 1728 1335 1833 1621 1905 1808 1824 1589 1582 1811 1785 1899 1787 1554 1707 1576 1797 1406 1628 1825 1253 1799 1820 1809 111...
output:
480402
result:
ok 1 number(s): "480402"
Test #50:
score: 0
Accepted
time: 76ms
memory: 32216kb
input:
500000 4709 4967 4588 5253 5315 5156 5118 4400 4951 4919 5258 4939 5454 4924 4922 5245 5164 5358 5410 4296 5482 5447 5392 5293 5439 5430 5402 5143 3929 5559 4945 5265 3912 5613 5586 5396 4921 3895 4920 5393 5237 5039 4647 5481 4980 4619 5566 5456 4970 3455 4755 5398 4634 5489 5631 4826 5712 5254 462...
output:
491662
result:
ok 1 number(s): "491662"
Test #51:
score: 0
Accepted
time: 69ms
memory: 31980kb
input:
500000 4005 3845 3766 3821 3791 3790 3776 3582 3519 3881 3868 3586 3920 3883 3877 3534 3874 3987 2980 3873 3522 3918 3872 3350 3869 2935 3901 3896 3539 3880 3446 3875 2814 3867 4089 4108 4318 3838 3857 4100 3054 2797 2719 3193 4098 4127 4096 4123 3853 3073 3066 3779 4322 4103 2651 4093 4149 2610 381...
output:
491089
result:
ok 1 number(s): "491089"
Test #52:
score: 0
Accepted
time: 73ms
memory: 31976kb
input:
500000 10379 10786 10586 10617 10601 10444 10641 10629 10626 10587 9894 10624 10580 10604 10533 9961 10817 10956 10147 9238 8763 10646 10839 9927 10210 10117 10128 10104 10126 7038 9950 10705 10657 10122 6982 10120 10649 9532 10100 6845 10648 9982 8544 7967 5832 9963 10685 10921 11103 5815 5747 9952...
output:
495554
result:
ok 1 number(s): "495554"
Test #53:
score: 0
Accepted
time: 61ms
memory: 32040kb
input:
500000 11496 11053 10988 11610 10930 11269 11131 10206 11580 11066 11182 9522 9170 11157 10530 10978 9893 9628 10848 9410 11179 9227 10552 11667 8539 8527 9726 8271 8591 8517 11134 11441 8111 7898 11298 8915 7035 11150 11145 11727 11137 8393 8902 11818 11624 7026 11932 12307 8851 11861 8838 11842 11...
output:
495781
result:
ok 1 number(s): "495781"
Test #54:
score: 0
Accepted
time: 91ms
memory: 32676kb
input:
500000 30507 31963 29468 28756 30588 32309 32073 32194 31853 31912 31896 33490 33661 33518 33508 32129 31861 31860 29759 25175 32003 33228 30884 30367 30306 32915 34238 31997 32416 22419 34815 34281 32344 33957 34247 30881 31287 30843 34206 34052 31099 34132 33344 30390 32529 31888 32127 32125 34068...
output:
498709
result:
ok 1 number(s): "498709"
Test #55:
score: 0
Accepted
time: 84ms
memory: 31116kb
input:
500000 25902 24169 22541 28539 29997 21889 27971 23834 27827 23890 24913 21995 23416 28122 30017 20447 24824 31942 31063 32637 27932 30224 23002 33281 22683 20887 20543 22534 33031 20947 20515 33863 20325 22979 20514 22942 20734 31703 31108 20557 33276 20521 20520 20500 33135 30857 30027 30026 21437...
output:
498844
result:
ok 1 number(s): "498844"
Test #56:
score: 0
Accepted
time: 1ms
memory: 24960kb
input:
69 29 24 52 33 32 41 6 34 18 58 56 48 44 19 31 38 24 53 24 23 32 5 27 53 9 19 41 17 52 43 65 44 10 47 37 28 23 22 26 23 21 24 28 40 35 15 52 45 20 26 68 48 40 61 23 2 35 41 36 47 32 64 36 61 13 54 6 43 1
output:
67
result:
ok 1 number(s): "67"
Test #57:
score: 0
Accepted
time: 1ms
memory: 25048kb
input:
22 9 4 9 20 3 1 5 22 14 21 14 15 14 3 19 4 10 19 14 8 11 7
output:
20
result:
ok 1 number(s): "20"
Test #58:
score: 0
Accepted
time: 40ms
memory: 28952kb
input:
288539 7623 7477 8325 5505 4462 7631 4265 8194 8156 8583 8780 7845 7247 6914 8058 8939 8838 8785 8006 8784 7846 5442 3860 3449 5427 9005 7536 8347 3199 5289 7774 4981 4749 8976 8743 7421 8346 8927 2673 8769 2551 7637 8767 9302 8660 9270 8712 7875 9543 2431 2162 4005 6366 8737 8718 5762 9023 8852 875...
output:
286240
result:
ok 1 number(s): "286240"
Test #59:
score: 0
Accepted
time: 25ms
memory: 29208kb
input:
318037 354 361 372 364 353 375 371 369 357 385 389 333 366 289 387 269 358 340 352 392 396 242 386 395 348 347 240 384 368 377 394 390 393 238 367 382 362 381 380 360 341 379 236 280 378 299 359 391 373 363 388 376 349 322 339 231 226 287 374 342 332 221 319 383 256 217 355 370 365 261 356 331 254 3...
output:
278746
result:
ok 1 number(s): "278746"
Test #60:
score: 0
Accepted
time: 25ms
memory: 28960kb
input:
277552 179 187 183 182 180 172 192 176 193 181 189 188 194 178 186 175 177 184 166 123 143 167 174 191 127 158 124 107 109 171 169 104 162 96 151 91 160 196 156 190 170 87 195 150 155 84 106 185 168 165 142 152 102 163 173 94 154 164 149 153 161 112 148 137 77 103 145 159 90 97 157 76 144 147 146 83...
output:
231895
result:
ok 1 number(s): "231895"
Test #61:
score: 0
Accepted
time: 60ms
memory: 31164kb
input:
500000 484 494 501 509 512 495 402 507 410 505 510 503 408 407 496 406 508 481 502 500 499 479 405 404 530 498 492 488 474 403 401 448 531 483 529 445 513 536 538 537 489 520 486 303 441 541 432 524 470 399 447 540 539 523 522 468 416 521 517 519 532 301 535 514 396 518 473 534 395 452 467 462 393 5...
output:
451082
result:
ok 1 number(s): "451082"
Test #62:
score: 0
Accepted
time: 65ms
memory: 31712kb
input:
500000 2118 2558 2323 2018 2294 2751 2760 2241 2793 1776 2227 3008 2767 2221 2762 3038 1577 3134 2900 2161 3053 1444 2761 2966 3180 2131 2755 2936 3146 3017 2787 1997 2754 2790 2752 2981 2958 3153 1425 3021 3027 2783 2756 2697 3082 3024 2724 2705 2999 3313 3354 1886 1830 1424 2789 3345 1819 1741 306...
output:
489052
result:
ok 1 number(s): "489052"
Test #63:
score: 0
Accepted
time: 67ms
memory: 32372kb
input:
500000 3529 4447 4564 4534 4501 4676 3248 4608 4520 4623 3132 4513 4502 2956 2881 4621 4598 2805 4448 4584 4381 4530 4474 4453 4450 2777 4491 3680 4449 4536 4277 2752 4540 4478 4495 4516 3509 4507 4460 4567 4456 3684 3636 3621 4455 4485 4469 4475 4702 4541 4454 4452 3271 4583 3445 4451 4479 4709 469...
output:
492765
result:
ok 1 number(s): "492765"
Test #64:
score: 0
Accepted
time: 1ms
memory: 26044kb
input:
58 40 8 10 6 3 44 8 16 30 41 31 54 56 57 20 36 21 35 41 46 56 37 45 26 8 31 27 56 45 25 41 49 11 39 55 34 4 11 47 51 2 16 34 18 27 1 20 23 2 36 47 7 13 25 30 10 4 33
output:
56
result:
ok 1 number(s): "56"
Test #65:
score: 0
Accepted
time: 96ms
memory: 32320kb
input:
500000 209065 209064 209063 209062 209061 209060 209059 209058 209057 209056 209055 209054 209053 209052 209051 209050 209049 209048 209047 412431 412430 412429 412428 412427 412426 412425 412424 412423 412422 412421 412420 412419 412418 412417 412416 412415 412414 412413 412412 412411 412410 412409...
output:
499982
result:
ok 1 number(s): "499982"
Test #66:
score: 0
Accepted
time: 82ms
memory: 32088kb
input:
500000 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 376973 376972 376971 376970 376969 376968 376967 376966 376965 376964 376963 376962 376961 376960 376959 376958 378436 378437 378438 378439 378440 378441 3784...
output:
499982
result:
ok 1 number(s): "499982"
Test #67:
score: 0
Accepted
time: 72ms
memory: 32000kb
input:
500000 12573 12572 12571 12570 12569 12568 367899 367898 367897 367896 367895 367894 367893 367892 367891 367890 367889 367888 367887 367886 367885 367884 367883 367882 375530 375529 375528 375527 375526 375525 375524 375523 375522 375521 375520 375519 375518 376212 376213 376214 376215 376216 37621...
output:
499976
result:
ok 1 number(s): "499976"
Test #68:
score: 0
Accepted
time: 101ms
memory: 32972kb
input:
500000 286633 286632 286631 286630 286629 286628 364987 364986 364985 364984 364983 364982 364981 364980 364979 364978 364977 364976 364975 364974 364973 364972 364971 364970 364969 364968 364967 383526 383525 383524 383523 383522 383521 383520 383519 383518 383517 383516 383515 383514 383513 383512...
output:
499992
result:
ok 1 number(s): "499992"
Test #69:
score: 0
Accepted
time: 6ms
memory: 26932kb
input:
22 9 4 9 20 3 1 5 22 14 21 14 15 14 3 19 4 10 19 14 8 11 7
output:
20
result:
ok 1 number(s): "20"
Test #70:
score: 0
Accepted
time: 39ms
memory: 28740kb
input:
288539 7623 7477 8325 5505 4462 7631 4265 8194 8156 8583 8780 7845 7247 6914 8058 8939 8838 8785 8006 8784 7846 5442 3860 3449 5427 9005 7536 8347 3199 5289 7774 4981 4749 8976 8743 7421 8346 8927 2673 8769 2551 7637 8767 9302 8660 9270 8712 7875 9543 2431 2162 4005 6366 8737 8718 5762 9023 8852 875...
output:
286240
result:
ok 1 number(s): "286240"
Test #71:
score: 0
Accepted
time: 25ms
memory: 29016kb
input:
318037 354 361 372 364 353 375 371 369 357 385 389 333 366 289 387 269 358 340 352 392 396 242 386 395 348 347 240 384 368 377 394 390 393 238 367 382 362 381 380 360 341 379 236 280 378 299 359 391 373 363 388 376 349 322 339 231 226 287 374 342 332 221 319 383 256 217 355 370 365 261 356 331 254 3...
output:
278746
result:
ok 1 number(s): "278746"
Test #72:
score: 0
Accepted
time: 99ms
memory: 32412kb
input:
500000 286633 286632 286631 286630 286629 286628 364987 364986 364985 364984 364983 364982 364981 364980 364979 364978 364977 364976 364975 364974 364973 364972 364971 364970 364969 364968 364967 383526 383525 383524 383523 383522 383521 383520 383519 383518 383517 383516 383515 383514 383513 383512...
output:
499992
result:
ok 1 number(s): "499992"
Test #73:
score: 0
Accepted
time: 80ms
memory: 32500kb
input:
500000 499980 499982 499981 499983 499984 499985 499987 499986 499988 499989 499991 499990 499993 499992 499994 499995 499997 499996 499999 499998 500000 499958 499957 499956 499959 499961 499960 499962 499964 499963 499966 499965 499967 499968 499970 499969 499971 499973 499972 499974 499976 499975...
output:
477799
result:
ok 1 number(s): "477799"
Test #74:
score: 0
Accepted
time: 75ms
memory: 32056kb
input:
500000 499979 499980 499981 499982 499983 499984 499985 499987 499986 499988 499989 499990 499991 499992 499993 499994 499995 499996 499997 499998 500000 499999 499950 499952 499951 499953 499954 499956 499955 499957 499958 499960 499959 499961 499963 499962 499965 499964 499966 499967 499969 499968...
output:
483348
result:
ok 1 number(s): "483348"
Test #75:
score: 0
Accepted
time: 87ms
memory: 31976kb
input:
500000 499945 499944 499958 499957 499956 499955 499954 499953 499952 499951 499950 499949 499948 499947 499946 499959 499961 499960 499962 499964 499963 499965 499967 499966 499968 499970 499969 499972 499971 499973 499974 499976 499975 499978 499977 499979 499981 499980 499982 499983 499985 499984...
output:
488896
result:
ok 1 number(s): "488896"
Test #76:
score: 0
Accepted
time: 72ms
memory: 33168kb
input:
500000 499848 499847 499846 499845 499844 499843 499842 499841 499840 499839 499838 499837 499836 499835 499834 499833 499832 499831 499830 499829 499828 499827 499826 499825 499824 499823 499822 499821 499820 499819 499818 499817 499816 499815 499814 499813 499812 499811 499853 499852 499851 499850...
output:
496674
result:
ok 1 number(s): "496674"
Test #77:
score: 0
Accepted
time: 82ms
memory: 34360kb
input:
500000 499711 499712 499714 499713 499715 499716 499717 499718 499719 499720 499721 499722 499723 499724 499725 499726 499727 499728 499729 499730 499731 499732 499733 499734 499736 499735 499738 499737 499739 499741 499740 499742 499744 499743 499745 499746 499748 499747 499749 499751 499750 499753...
output:
498321
result:
ok 1 number(s): "498321"
Test #78:
score: 0
Accepted
time: 88ms
memory: 33276kb
input:
500000 498886 498887 498888 498889 498890 498891 498892 498893 498894 498895 498896 498897 498898 498899 498900 498901 498902 498903 498904 498905 498906 498907 498908 498909 498910 498911 498912 498913 498914 498915 498916 498917 498918 498919 498920 498921 498922 498923 498924 498925 498926 498927...
output:
499664
result:
ok 1 number(s): "499664"
Test #79:
score: 0
Accepted
time: 78ms
memory: 34068kb
input:
500000 487830 487831 487832 487833 487834 487835 487836 487837 487838 487839 487840 487841 487842 487843 487844 487845 487846 487847 487848 487849 487850 487851 487852 487853 487854 487855 487856 487857 487858 487859 487860 487861 487862 487863 487864 487865 487866 487867 487868 487869 487870 487871...
output:
499967
result:
ok 1 number(s): "499967"
Test #80:
score: 0
Accepted
time: 76ms
memory: 33300kb
input:
500000 499998 500000 499999 499996 499997 499994 499995 499992 499993 499990 499989 499988 499991 499986 499985 499987 499981 499984 499983 499982 499978 499977 499980 499979 499975 499974 499973 499976 499971 499972 499968 499970 499969 499965 499967 499966 499963 499964 499961 499962 499957 499960...
output:
314935
result:
ok 1 number(s): "314935"
Test #81:
score: 0
Accepted
time: 71ms
memory: 34020kb
input:
500000 499997 499998 500000 499999 499993 499994 499996 499995 499990 499991 499992 499987 499988 499989 499984 499985 499986 499981 499982 499983 499977 499979 499978 499980 499974 499975 499976 499971 499972 499973 499967 499966 499965 499969 499968 499970 499961 499960 499959 499962 499964 499963...
output:
388933
result:
ok 1 number(s): "388933"
Test #82:
score: 0
Accepted
time: 78ms
memory: 32912kb
input:
500000 499996 499995 499997 499999 499998 500000 499991 499992 499993 499994 499986 499985 499984 499987 499988 499990 499989 499980 499981 499982 499983 499976 499977 499978 499979 499971 499970 499972 499973 499975 499974 499965 499967 499966 499968 499969 499961 499962 499963 499964 499956 499955...
output:
416613
result:
ok 1 number(s): "416613"