QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#865328#8838. Jesse's JobsuoAC ✓283ms19472kbC++201.0kb2025-01-21 16:46:062025-01-21 16:46:06

Judging History

你现在查看的是最新测评结果

  • [2025-01-21 16:46:06]
  • 评测
  • 测评结果:AC
  • 用时:283ms
  • 内存:19472kb
  • [2025-01-21 16:46:06]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define all(a) (a).begin(), (a).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n); i >= 0; i--)

void solve() {
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) {
        cin >> a[i];
        a[i]--;
    }

    vector<int> pos{0};
    int i = 0;
    while (a[i] != 0) {
        i = a[i];
        pos.push_back(i);
    }

    if (pos.size() < n) {
        cout << n << "\n";
        cout << pos.size() << "\n";
        rep(i, pos.size()) cout << pos[i] + 1 << " ";
        cout << "\n";
    } else {
        vector<int> ans(0);
        for (auto i : pos) {
            ans.push_back(i);
            if (a[i] == 1) break;
        }
        cout << n - 2 << "\n";
        cout << ans.size() << "\n";
        rep(i, ans.size()) cout << ans[i] + 1 << " ";
        cout << "\n";
    }
}

int main() {
    int t;
    cin >> t;
    while (t > 0) {
        t--;
        solve();
    }
}

这程序好像有点Bug,我给组数据试试?

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3584kb

input:

3
2
2 1
4
2 1 4 3
6
3 5 4 2 6 1

output:

0
1
1 
4
2
1 2 
4
3
1 3 4 

result:

ok Correct (3 test cases)

Test #2:

score: 0
Accepted
time: 1ms
memory: 3584kb

input:

872
6
1 5 2 6 3 4
6
5 2 1 3 4 6
4
2 1 3 4
6
2 3 1 4 5 6
6
4 5 1 6 2 3
6
6 2 3 1 4 5
5
2 1 3 4 5
6
1 2 6 4 3 5
4
2 1 4 3
6
1 6 4 2 5 3
6
6 1 3 5 4 2
6
2 1 4 5 6 3
6
3 4 1 5 6 2
6
4 1 5 3 2 6
6
5 2 1 6 3 4
6
4 1 6 2 5 3
6
5 1 3 6 2 4
6
6 2 5 4 3 1
6
6 2 5 3 1 4
6
5 2 4 1 3 6
6
6 1 3 2 4 5
6
2 3 4 6 5 ...

output:

6
1
1 
6
4
1 5 4 3 
4
2
1 2 
6
3
1 2 3 
6
4
1 4 6 3 
6
4
1 6 5 4 
5
2
1 2 
6
1
1 
4
2
1 2 
6
1
1 
6
3
1 6 2 
6
2
1 2 
6
2
1 3 
6
5
1 4 3 5 2 
6
3
1 5 3 
6
3
1 4 2 
6
3
1 5 2 
6
2
1 6 
6
5
1 6 4 3 5 
6
4
1 5 3 4 
6
5
1 6 5 4 2 
6
5
1 2 3 4 6 
6
5
1 5 3 2 6 
6
2
1 4 
4
2
1 4 
6
2
1 3 
6
1
1 
6
1
1 
6
...

result:

ok Correct (872 test cases)

Test #3:

score: 0
Accepted
time: 68ms
memory: 3456kb

input:

46232
7
2 1 7 5 3 6 4
7
5 6 2 4 7 1 3
4
3 4 2 1
7
4 5 1 6 3 7 2
8
4 2 6 5 1 7 3 8
8
3 4 8 7 1 2 5 6
7
6 2 4 3 7 5 1
8
8 1 3 2 7 5 4 6
8
6 5 4 2 1 3 8 7
8
8 3 5 6 2 7 4 1
8
7 3 6 1 8 5 4 2
8
2 3 4 5 8 6 7 1
8
5 8 2 4 7 3 6 1
8
3 4 8 2 7 6 1 5
8
2 8 3 5 7 6 1 4
8
8 4 5 7 6 1 3 2
8
5 2 6 3 4 8 1 7
8
2 ...

output:

7
2
1 2 
7
6
1 5 7 3 2 6 
2
2
1 3 
5
4
1 4 6 7 
8
3
1 4 5 
6
4
1 3 8 6 
7
4
1 6 5 7 
8
7
1 8 6 5 7 4 2 
8
6
1 6 3 4 2 5 
8
2
1 8 
8
3
1 7 4 
8
6
1 2 3 4 5 8 
8
7
1 5 7 6 3 2 8 
8
5
1 3 8 5 7 
8
6
1 2 8 4 5 7 
6
2
1 8 
8
7
1 5 4 3 6 8 7 
8
6
1 2 4 7 6 8 
6
5
1 5 6 4 7 
7
1
1 
8
7
1 2 6 8 4 3 5 
4
2
1...

result:

ok Correct (46232 test cases)

Test #4:

score: 0
Accepted
time: 202ms
memory: 7072kb

input:

1
999995
992870 210969 579550 405695 249895 436695 476463 929789 907510 311379 340877 491996 59204 996443 681309 483046 760005 905577 711115 275827 697004 450345 678866 276460 310113 542672 27 914370 232581 624905 590395 136666 628293 731656 670994 184745 662928 389422 848680 447853 325275 979617 82...

output:

999995
3
1 992870 132245 

result:

ok Correct (1 test case)

Test #5:

score: 0
Accepted
time: 211ms
memory: 7120kb

input:

1
999999
132956 959208 556000 604257 627699 841942 392337 85216 596714 941258 128586 471931 589450 975529 945897 459533 603544 562877 170464 568730 134581 853340 114919 588755 677661 246220 410344 431559 600933 71503 340747 300767 956226 134024 377489 953726 922690 597383 328440 183077 305496 911409...

output:

999999
3
1 132956 709905 

result:

ok Correct (1 test case)

Test #6:

score: 0
Accepted
time: 261ms
memory: 19400kb

input:

1
999995
151304 350332 773183 104266 183633 346263 526539 191085 531746 355173 883744 387959 24944 911448 969746 652626 567671 859523 590384 980797 692606 699234 873314 30142 292030 794805 784083 528201 66334 787834 981995 233166 953602 312617 136612 832397 103749 244552 955161 491539 668517 866412 ...

output:

999993
575603
1 151304 547748 131911 114129 508047 506316 174977 323655 694739 923940 945730 76561 147441 971861 957568 901161 48008 383906 281931 197187 916221 975522 477637 729551 516585 722808 984170 255714 749122 721695 482155 622025 427030 680059 609735 285614 325439 117357 313717 464421 800647...

result:

ok Correct (1 test case)

Test #7:

score: 0
Accepted
time: 243ms
memory: 13464kb

input:

1
999995
754675 577330 167544 259206 764547 604199 151690 344752 277381 570149 789585 58013 915739 880076 94361 336806 247836 105018 84016 247471 4769 103273 849777 222635 73036 568675 835749 659559 134752 378968 614868 318761 242558 316551 909010 766039 66636 944423 502413 379540 334867 442430 3581...

output:

999993
248640
1 754675 313906 132348 387810 952199 922335 529651 896324 854522 165938 559503 40055 811665 66013 313992 970304 906164 487821 912766 610564 559500 563298 118367 773778 597690 416950 42502 956499 678337 303088 154427 178070 453367 659247 302239 400860 67645 264550 440914 565556 568496 1...

result:

ok Correct (1 test case)

Test #8:

score: 0
Accepted
time: 237ms
memory: 13460kb

input:

1
999997
638443 340278 112988 154978 902464 863990 24951 545820 871596 953644 803226 311894 360567 370837 708113 752941 671099 747784 462442 500613 130353 230987 95163 706571 204796 78466 465187 922223 33915 565546 999951 229649 30926 322281 791450 25472 253758 656076 139756 169438 627450 419553 662...

output:

999995
93416
1 638443 164441 56069 410580 179015 405782 980464 156213 525790 504671 904084 825208 884042 52260 666329 841954 297065 864955 225626 438460 207125 200498 835922 270703 434300 673967 311466 239574 493334 10084 247229 421083 890714 941796 464426 873972 395436 208049 954808 828473 555519 6...

result:

ok Correct (1 test case)

Test #9:

score: 0
Accepted
time: 283ms
memory: 19472kb

input:

1
999995
297456 504173 513434 848530 682896 583103 149312 357353 350343 698138 651957 146466 893734 433768 572877 193129 373010 693311 916549 645436 432909 753385 69552 502685 172598 942736 523297 72546 304608 959938 963545 317586 861185 4757 575504 991291 605063 958836 977410 935343 795146 487641 4...

output:

999993
975738
1 297456 816234 980986 157905 41424 121995 133118 756679 116595 324668 437304 185465 34152 961605 495254 521531 532515 557673 97884 6690 677086 500737 632867 476267 910139 6391 354595 533269 680822 196935 182629 999194 199042 151589 885344 589174 665153 225575 93689 701979 921515 98154...

result:

ok Correct (1 test case)

Test #10:

score: 0
Accepted
time: 235ms
memory: 13436kb

input:

1
999997
393410 49035 524264 818845 10675 897541 34937 372076 874521 588800 365704 524415 502318 615599 936210 899872 770986 805250 323839 327072 759952 778190 672074 80915 838961 198598 435412 403740 681793 305974 418478 862081 285680 469837 371537 47760 710084 733248 556199 534111 827640 185961 15...

output:

999995
175986
1 393410 677966 858458 590217 983587 87422 653715 362052 152042 248713 756267 436834 776852 59943 812700 54451 647189 231474 375767 329958 135120 703557 4805 219454 785595 594940 984600 241571 992007 43082 785554 164805 817710 548965 305410 374588 658975 68683 473110 113325 697917 4785...

result:

ok Correct (1 test case)

Test #11:

score: 0
Accepted
time: 250ms
memory: 13528kb

input:

1
999995
944829 184022 584189 44931 382020 646738 472283 116610 935974 570355 788773 241934 738294 626043 874067 603890 741968 138232 528117 609827 426413 419495 494434 809342 94243 198801 749308 766492 505446 969921 372479 49158 138897 702882 55890 776117 638050 57623 553563 26230 261953 942379 323...

output:

999995
615755
1 944829 901098 440213 858182 803178 357552 391822 645998 521221 444493 252619 105756 299033 384714 66307 807053 347227 665153 239739 958397 114215 984084 740744 854803 348806 30930 539813 236415 697244 888838 278536 727643 637406 327802 788129 388955 779522 603502 524686 791631 263706...

result:

ok Correct (1 test case)

Test #12:

score: 0
Accepted
time: 223ms
memory: 8268kb

input:

1
999999
598262 800757 858000 406327 119516 823023 136708 66880 148616 782590 436276 634080 888631 385137 494685 559597 48898 394580 171289 165715 938954 65280 200097 979879 391676 910854 438015 851434 265045 970989 839032 423528 871701 483523 345346 38471 822315 350679 808315 546586 571575 164651 5...

output:

999999
223686
1 598262 549306 685850 445796 589155 597972 962586 134232 10421 488572 213640 804780 181853 963899 294247 61854 781638 729983 636736 949347 973873 361612 950887 837677 823940 935487 704660 730545 775457 757232 819028 601772 315092 607546 509153 385891 590792 314061 410747 684409 340880...

result:

ok Correct (1 test case)

Test #13:

score: 0
Accepted
time: 200ms
memory: 7116kb

input:

1
1000000
598176 2 63866 853014 5 6 686653 726076 9 397868 120096 12 13 447613 15 436733 17 182004 648030 20 124194 832356 344678 690075 25 26 726062 188011 923659 186941 954310 572295 587076 812134 82682 711573 958279 38 39 468598 162778 901628 43 809521 2070 46 47 48 49 50 51 52 325011 54 25970 56...

output:

1000000
4
1 598176 528316 68573 

result:

ok Correct (1 test case)

Test #14:

score: 0
Accepted
time: 221ms
memory: 10984kb

input:

2
619118
90164 2 219107 200440 451939 315958 296133 128808 361248 514958 293002 401184 585660 73556 339209 203156 17 577263 82815 251835 183546 82364 114031 602717 287196 143720 558967 161047 390820 607835 111226 280058 442965 418626 493748 47866 37 200343 120407 142723 210686 463387 241093 267981 6...

output:

619118
5
1 90164 72357 126352 371938 
380880
330021
1 151406 350204 348895 286157 304343 126202 221809 164924 254809 117063 114658 246444 1823 353055 88438 306600 281399 228224 89967 374357 154121 37900 27362 84213 119786 17364 212013 373500 258955 93227 167945 315968 166001 29260 11729 27804 93801 ...

result:

ok Correct (2 test cases)

Test #15:

score: 0
Accepted
time: 265ms
memory: 19100kb

input:

2
871966
640387 80368 797023 563489 243737 145675 666994 194975 345691 400793 759442 834454 700191 155844 197144 501576 600382 261210 793976 226333 19611 744069 297287 792632 93572 679779 815401 787937 163361 733542 573758 828483 852527 319904 29935 314322 835905 162819 523183 200165 788848 105889 3...

output:

871964
744250
1 640387 419069 13657 842828 412216 364921 819899 434808 509409 525477 116919 306344 104793 468777 781395 564517 114646 263593 615121 662962 226505 270335 540044 14177 190237 159125 411283 139049 320404 502343 344493 727099 89053 688046 355913 191840 293994 46366 660144 613887 827572 1...

result:

ok Correct (2 test cases)

Test #16:

score: 0
Accepted
time: 211ms
memory: 6732kb

input:

2
179437
1479 9605 87967 117977 50718 124360 86016 23899 2164 121051 31984 111829 154715 103812 19392 150824 3279 29525 118899 166055 173839 84587 67983 165471 40345 84143 139004 28367 177911 97764 54397 17288 114719 31659 47051 43374 114708 176309 23080 263 61101 36573 121923 3933 59064 138745 1745...

output:

179437
164999
1 1479 1212 116183 152711 55998 140542 44435 15755 111818 96747 157939 89587 74916 18004 97889 144951 160534 8311 99348 170841 156242 40202 33732 122114 167161 136323 117350 96734 97742 37564 109043 93889 35141 76363 56738 163915 155467 55532 22596 52331 62922 70097 151780 14668 41450 ...

result:

ok Correct (2 test cases)

Test #17:

score: 0
Accepted
time: 232ms
memory: 11668kb

input:

2
540838
339723 335565 400530 207472 333626 271857 83193 354471 304426 107298 68880 28174 375466 377530 26552 223667 368807 121965 73505 8051 219826 252618 302264 348616 21753 500246 465806 40657 430533 515835 254703 169778 376049 161368 391583 240544 287407 223447 539945 31310 347440 25163 44388 23...

output:

540836
64426
1 339723 355278 83369 403423 473952 427099 439493 122995 61881 374193 23983 220060 320441 211397 401924 21102 354342 307321 215763 523514 350597 390114 157297 324793 185452 229601 84750 26060 465934 462748 138279 451524 54964 472896 146362 54097 523014 322350 407785 457477 158684 533076...

result:

ok Correct (2 test cases)

Test #18:

score: 0
Accepted
time: 219ms
memory: 9164kb

input:

2
497030
477095 353052 110488 62624 382398 356033 176110 42359 288859 381691 402812 311733 6680 117699 215708 199588 227701 458407 160923 368755 228412 144228 248902 131632 7233 351435 43586 343018 121832 457067 75824 213631 122509 151990 103507 49550 287165 469293 26080 359949 50162 169739 445205 2...

output:

497028
219447
1 477095 345849 63410 116808 4977 413002 153285 296860 130486 478232 101566 68059 72751 388194 240163 433888 431456 398721 100152 188954 127138 273679 371401 254819 21887 207379 340108 456733 421539 351080 475185 243433 259094 474514 189404 466916 107384 141913 480161 196224 357996 164...

result:

ok Correct (2 test cases)

Test #19:

score: 0
Accepted
time: 203ms
memory: 6480kb

input:

2
822732
29287 712896 467621 551925 605914 290051 411219 269073 619834 772162 172440 383504 630320 443652 578479 807814 412463 476979 369375 377844 41836 737690 23087 194699 740146 8822 367784 560638 701544 169089 202563 30635 220889 371087 671729 612139 377535 305328 698138 367284 672392 476535 520...

output:

822732
28
1 29287 395378 397399 816429 660029 494403 278945 470159 694817 38956 352230 803284 668628 315122 76272 393843 764953 765403 522673 732455 185693 451452 364139 71308 149659 147757 262293 
177267
7
1 40601 129472 148819 24752 97023 159537 

result:

ok Correct (2 test cases)

Test #20:

score: 0
Accepted
time: 228ms
memory: 13500kb

input:

2
460272
454054 51480 38683 115398 246110 33086 10813 306840 336274 367523 322862 291532 96801 63208 136745 428732 96626 121548 453987 35765 208212 1237 292191 409419 421453 50914 60023 155411 47120 43293 376415 328933 180727 435025 237800 132813 242453 425910 312549 441028 21561 199562 16012 203563...

output:

460270
4106
1 454054 208960 57508 287604 454123 353854 228612 225238 451533 113993 444046 176662 409100 210496 284075 264192 273871 91904 140490 411469 232638 363533 121573 290976 369339 276707 218882 442248 133511 132176 55972 172741 443380 235548 165349 313804 296488 265641 39130 339275 38858 1078...

result:

ok Correct (2 test cases)

Test #21:

score: 0
Accepted
time: 227ms
memory: 8648kb

input:

2
573212
502447 60739 35524 340096 559656 317717 390986 419402 200695 412082 338708 486839 358901 349946 208819 215676 448624 294970 353816 558368 468745 174716 108705 207369 127513 400809 335513 569335 227194 33670 276388 252531 281759 434404 346682 225672 414370 314322 328803 404120 379519 417237 ...

output:

573212
230888
1 502447 95419 382902 141432 354132 548678 157281 431873 366372 34773 271166 340193 374234 398564 47022 184121 76415 531721 453463 573090 288500 22465 139762 72325 235707 82902 257002 405572 102343 460978 250940 328013 509784 218287 269214 310439 275468 445758 285460 180200 471003 2674...

result:

ok Correct (2 test cases)

Test #22:

score: 0
Accepted
time: 236ms
memory: 12580kb

input:

2
774297
108974 50475 447709 425891 132886 772611 547329 490982 724938 684343 650803 770154 639926 683026 155527 222186 252543 398558 421690 349432 624529 475206 337242 474437 12910 613008 175661 704682 506522 57865 448281 617815 726872 258282 103986 746352 747239 758541 67119 122989 57274 608936 51...

output:

774295
232557
1 108974 100892 74764 428932 359915 204889 379447 220126 18046 431945 156377 364888 761818 585132 72000 104447 84436 680306 99221 662612 763759 544717 75865 270771 458204 610581 717705 407162 367239 642698 534554 239846 166549 144307 329947 7798 533457 36071 234244 59536 232826 584143 ...

result:

ok Correct (2 test cases)

Test #23:

score: 0
Accepted
time: 234ms
memory: 7204kb

input:

2
721006
48267 555562 323543 507153 673309 477678 564069 236534 99971 415431 339298 351214 652600 357260 266582 284090 343443 180581 230580 589676 218752 145102 373144 348717 33025 414010 606244 527527 230772 372204 229293 478539 280102 227109 288272 406071 430834 568583 131577 36051 612152 435912 5...

output:

721006
231889
1 48267 330418 555357 353372 17397 272076 597273 475718 294467 310187 7416 484536 228241 267981 473594 418346 53291 399429 386563 588979 525176 341690 163069 334416 433958 615850 101978 230277 386673 349160 339953 85421 372150 252589 695240 414376 564190 618727 551244 451901 611842 628...

result:

ok Correct (2 test cases)

Test #24:

score: 0
Accepted
time: 195ms
memory: 5452kb

input:

3
545686
1 2 401203 4 5 6 165600 8 445568 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 446391 26 27 362780 88147 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 356219 46 47 48 49 46762 51 52 53 54 55 56 57 351417 59 60 61 62 63 64 103030 66 67 68 69 311162 71 72 4279 74 75 76 269885 78 79 80 81 82 83 ...

output:

545686
1
1 
56348
1
1 
397964
2
1 323996 

result:

ok Correct (3 test cases)

Test #25:

score: 0
Accepted
time: 210ms
memory: 5708kb

input:

4
177794
116760 126345 61744 6423 73151 2731 131887 142812 45535 26266 160534 48561 46707 145258 161542 86204 28673 79542 22836 116287 39853 135713 1662 26830 75441 48100 129513 140270 157643 76862 11156 64117 85828 171178 171517 43834 105739 112222 88849 58094 89488 74017 154290 49730 32336 138033 ...

output:

177792
99183
1 116760 156336 7867 26623 37682 59775 88061 44969 7961 54974 14238 38887 94649 11051 54523 18210 1961 85527 25917 49663 176392 105565 137883 84496 15648 86693 158089 24184 110524 27518 60765 3463 101768 63103 171221 48773 160112 112533 44301 65316 38879 113619 48463 58873 100203 42172 ...

result:

ok Correct (4 test cases)

Test #26:

score: 0
Accepted
time: 205ms
memory: 4940kb

input:

5
213494
86293 124376 72303 131709 28537 160682 1999 52197 74061 49878 136369 117055 163227 11573 100962 79061 105131 151536 25877 200627 29619 202729 204613 65640 13252 161348 16508 123670 74012 155482 40701 159748 183865 155427 52718 177607 129463 105128 83403 162172 151011 30908 8325 48754 63326 ...

output:

213494
123193
1 86293 146426 192357 136989 51846 80154 213198 176646 32940 7248 198877 32568 145268 142772 121124 197130 68703 147387 159200 180480 133665 139527 138755 188025 26032 172354 80166 53780 180392 33596 133384 8642 87216 211498 40668 113041 196154 70817 117091 126197 171160 175538 199 139...

result:

ok Correct (5 test cases)

Test #27:

score: 0
Accepted
time: 212ms
memory: 7696kb

input:

6
26394
1 1215 3 4 5 24633 7 8 11778 10 11 12 13 14 5403 2544 17 18 19 20 23730 22 23 16710 25 26 27 28 29 30 31 32 33 34 3567 36 37 38 39 40 41 42 43 44 364 46 47 21776 49 50 51 52 53 54 55 56 57 58 59 60 61 1369 8692 64 65 66 67 68 22957 14395 71 72 73 74 75 10243 77 78 79 80 81 82 83 84 85 86 87 ...

output:

26394
1
1 
65210
51012
1 53945 64685 58411 40098 6573 15270 2044 46638 10570 20079 33910 18747 51792 18688 191 61109 7633 48386 28643 26536 62713 55354 20958 4794 39449 44518 3741 54051 42950 17443 9977 19182 108 46940 44601 56708 62527 59387 26005 51326 13228 48091 62331 7478 18239 3383 53476 44537...

result:

ok Correct (6 test cases)

Test #28:

score: 0
Accepted
time: 210ms
memory: 8316kb

input:

7
105897
99466 56858 13176 19677 49543 74294 36661 1750 64564 6861 39471 20190 21648 30576 40921 32804 15152 57806 22290 46119 79303 99325 59755 28096 76343 55125 43104 30393 3109 79375 21997 36664 31939 60892 1757 39089 7231 57529 97367 21270 64721 17484 88564 23295 89496 7807 64697 63015 36852 964...

output:

105895
82005
1 99466 59790 43319 74359 58411 39534 30059 50490 44272 49237 90145 15512 46881 67912 60674 99240 44555 77515 88688 87040 43128 31290 84022 56925 101604 10990 66413 59151 76338 10509 104723 91195 4555 52424 14251 82202 39587 32179 19808 86281 69148 23491 38945 20353 61420 6284 82609 342...

result:

ok Correct (7 test cases)

Test #29:

score: 0
Accepted
time: 244ms
memory: 18256kb

input:

8
655573
280037 629341 195685 410686 212960 223124 294040 473175 642842 158457 217624 411159 514317 392527 332779 269690 596618 22836 121459 61417 173388 430829 242368 383295 391008 624812 412752 409701 394824 23117 414100 167745 628770 55271 369282 258340 410194 278282 246019 654232 466891 206876 6...

output:

655571
651124
1 280037 317465 590699 21718 292316 473634 80902 52845 384744 111420 359289 129332 312775 581690 25240 585418 161633 474865 214656 16431 552130 36091 451587 334882 526651 349136 575029 553815 35584 545387 140322 20817 231343 596030 31774 78020 106577 635738 51613 30372 387656 618887 55...

result:

ok Correct (8 test cases)

Test #30:

score: 0
Accepted
time: 210ms
memory: 6428kb

input:

9
156834
98965 14780 120378 149355 126891 59457 4795 90461 75117 103508 146543 19614 96195 138074 34392 132536 151731 27879 122330 110570 105983 62666 82304 85612 89102 110379 133919 136883 93088 130 80437 64387 125468 66299 127375 106845 148866 122581 146942 79402 88517 33795 65669 151196 20516 129...

output:

156832
61305
1 98965 56329 54530 66607 91048 28662 73750 68398 117278 112408 148196 19633 32317 130405 122169 121924 103133 16070 68141 115454 30726 75447 46783 5748 17997 79504 97491 17680 39583 133206 71518 120037 75470 82096 122245 56701 81854 67866 52605 92854 102304 132953 99901 50030 80297 661...

result:

ok Correct (9 test cases)

Test #31:

score: 0
Accepted
time: 194ms
memory: 5144kb

input:

10
27108
12251 14046 9345 4485 22465 10296 16423 15823 22158 23553 20145 24845 3037 23757 22085 24324 4642 21497 1515 17922 16505 231 22129 10913 18238 19004 15819 15153 25370 3415 2962 16681 9141 18239 4201 25492 6588 26567 20895 14232 15085 15440 5224 19846 1441 5712 21781 10381 19212 4778 23405 2...

output:

27108
3726
1 12251 25631 13234 24460 25589 5960 2331 1805 2858 14534 26518 4907 5776 1041 8586 10326 7596 8942 26689 6349 12585 20799 9869 25002 2375 15648 26186 25855 12656 5211 10540 25389 26286 5272 25369 16321 1855 22927 20548 19798 25673 5145 26647 22215 17976 6676 18329 2313 9963 19325 17519 1...

result:

ok Correct (10 test cases)

Test #32:

score: 0
Accepted
time: 212ms
memory: 6388kb

input:

11
10121
1609 8225 3 7626 4830 3706 7 9725 9 3514 9859 3768 8643 14 2140 1019 17 7606 7595 20 4036 423 23 24 25 26 681 5514 5633 8870 31 9490 33 7430 9531 36 5983 38 1567 1679 10071 1964 5533 44 6277 3017 2324 48 49 185 51 52 53 54 7239 6434 6954 58 10087 60 9646 4584 63 238 2529 9590 2236 3626 7069...

output:

10121
4
1 1609 1158 10105 
57561
47240
1 1438 5323 43285 7229 30732 13840 19181 6057 56756 4205 22850 4913 33622 57116 49875 21301 9086 23393 6310 9543 37827 44503 41052 22319 10934 56017 28932 30230 19709 21102 44803 27897 6924 47543 19263 10606 27315 41937 36013 18339 20684 23796 44685 7515 21248 ...

result:

ok Correct (11 test cases)

Test #33:

score: 0
Accepted
time: 198ms
memory: 4940kb

input:

12
16649
11155 12810 936 54 6251 4345 10231 4297 8233 12448 7106 15979 5445 1497 2625 14856 15107 8593 13351 12197 6494 7865 855 14793 15484 9520 4085 8643 13501 13498 7099 8283 10068 11357 14365 1015 9496 2255 13123 9035 14304 3334 2734 264 14875 8060 13275 4699 11075 15215 11769 9559 5925 7899 835...

output:

16647
16149
1 11155 5300 3592 2339 4200 8572 7829 3473 951 12695 2698 14293 8042 14739 6006 15774 5830 6859 14787 10500 7898 9146 13835 13171 9618 14422 5296 13408 12171 12651 7903 8958 9938 2057 15779 13911 3861 15407 14942 11473 10208 14684 15298 3216 14592 8895 1421 298 7756 3687 10592 5847 12327...

result:

ok Correct (12 test cases)

Test #34:

score: 0
Accepted
time: 202ms
memory: 5744kb

input:

13
6728
2113 1374 5019 2228 1829 3510 5713 6376 1406 5942 944 4469 6680 5398 2818 6715 6669 31 4001 1353 486 1571 3035 1023 5376 1188 3142 4188 4445 6674 3549 6082 6193 4338 2278 1867 1605 2518 4572 5916 3324 573 2387 5787 4424 2774 2377 244 3395 2090 2834 5820 2061 2598 1641 6595 3421 6083 141 1287...

output:

6726
921
1 2113 5560 5146 4141 2943 5739 4280 5794 3830 6043 4158 4906 4042 5639 3593 673 4 2228 4684 4801 4991 2390 2763 4932 4375 2996 4593 4797 1322 5849 3404 847 4845 5630 5008 4009 2711 3003 462 5764 5927 1736 3184 1280 3709 1547 2540 4505 487 843 286 5733 4631 4892 4941 1372 594 483 2345 6277 ...

result:

ok Correct (13 test cases)

Test #35:

score: 0
Accepted
time: 201ms
memory: 5232kb

input:

14
43977
39227 39513 25799 1059 24319 33994 34051 23007 42142 14145 24603 14551 27798 10157 15921 37338 29244 35818 27242 12317 35610 9794 28060 16357 953 34772 21796 9362 23305 38598 12695 6109 39961 40574 18163 28736 2663 43130 28933 23085 32855 40362 15298 38030 911 4266 43778 21570 40936 18045 2...

output:

43977
42098
1 39227 17565 3571 4965 33164 42405 5593 3185 13886 3138 11984 13994 7715 35432 4369 24562 15897 35565 8845 17790 42686 27940 25408 9977 4020 3922 36281 21208 34519 888 8634 33363 2053 36122 27755 2039 37920 20835 20254 8659 13612 27110 2174 29683 31713 25483 24474 30481 23031 35653 4518...

result:

ok Correct (14 test cases)

Test #36:

score: 0
Accepted
time: 208ms
memory: 5420kb

input:

15
22691
18515 13639 8461 19888 15608 6077 7438 6395 2205 10400 13195 6263 6510 19774 13070 8618 22478 19728 9997 19439 15510 4551 11327 21146 5723 19847 14050 1301 22614 582 16280 9311 8076 16276 17400 5995 1570 10809 14519 2466 3889 6614 11038 21049 20891 15545 5214 8025 3608 18277 19146 12939 198...

output:

22691
20327
1 18515 13089 9917 7373 1125 10626 10889 307 18099 155 20059 11647 13456 5533 17766 6295 3573 12441 21156 21036 5038 10216 17671 20938 21782 2393 10955 15382 22605 15605 12634 22111 12733 22467 8041 2318 5438 5850 19278 7141 5510 7780 18751 21055 20666 16344 3770 20392 6992 10756 5042 61...

result:

ok Correct (15 test cases)

Test #37:

score: 0
Accepted
time: 184ms
memory: 4016kb

input:

100
23654
22787 18095 12121 14924 13636 6778 12319 21262 12320 20261 14452 22619 19152 5702 16830 23437 12988 13172 4743 17669 9201 17800 17213 17716 12208 48 11741 20985 12814 8159 9945 15226 21758 19066 12663 6183 12511 1451 1398 4121 10107 2531 21175 13685 13609 12476 13225 194 11556 21948 19973 ...

output:

23652
4986
1 22787 21566 14396 12461 21009 13899 5736 20584 21332 18481 9861 22290 9584 6642 15169 19043 12786 9474 5756 22229 5349 22843 17611 522 15021 21750 15820 243 22204 12269 10876 18150 14135 12759 5841 21465 16066 431 18403 21100 22185 5863 22211 10274 10113 21354 16812 10012 3109 8256 8322...

result:

ok Correct (100 test cases)

Test #38:

score: 0
Accepted
time: 190ms
memory: 3960kb

input:

101
6514
1768 3066 2179 5896 2818 3154 1066 4703 6437 3404 5852 3162 233 2458 5697 6379 4616 6305 5937 761 6294 956 1755 839 4349 4886 2427 742 274 1472 1135 4621 252 945 4651 6199 6086 3159 3666 4998 2868 5593 3042 5063 5280 6219 965 4958 5702 4821 5047 2756 2475 1865 3187 6406 5376 3963 1635 251 2...

output:

6512
2364
1 1768 3640 817 573 4959 1331 2491 5456 5266 363 2640 1795 4039 3106 47 965 2778 6099 5953 4742 4323 3392 2237 2616 6189 6393 3426 3583 5823 929 80 1124 6197 3605 984 1679 6157 2076 2659 1489 5231 901 3463 1077 5172 2621 2089 2223 960 5149 3669 1318 2249 2503 1651 2828 4851 305 5142 1311 1...

result:

ok Correct (101 test cases)

Test #39:

score: 0
Accepted
time: 187ms
memory: 4012kb

input:

102
9439
672 9317 8375 2012 1784 2441 7317 6585 6999 173 3592 7490 4031 8049 1018 5891 5229 3760 8209 3009 3640 336 3308 6807 8681 1905 2701 7773 2177 1025 5433 6303 8381 2792 5911 6377 7144 4980 4940 6734 4034 1404 2779 6338 1055 3945 6486 7301 6146 6633 6287 386 7296 5607 7091 8100 6052 2184 239 6...

output:

9439
3389
1 672 5233 8443 6960 2669 3878 342 8329 5150 6853 1250 378 149 2551 8669 6413 6902 2155 6376 1625 3487 5369 2931 2700 3773 6208 9342 2106 5538 2496 9285 8585 3075 86 9017 7061 1699 360 364 7418 3599 6983 321 5283 9202 4194 5899 8819 65 1490 7762 5575 1175 1041 5731 6957 4123 6797 2952 1191...

result:

ok Correct (102 test cases)

Test #40:

score: 0
Accepted
time: 186ms
memory: 3968kb

input:

103
12107
9761 10604 10321 5219 3927 10286 8879 8384 10550 369 781 1883 504 7455 4697 11319 9748 6183 3622 3388 981 1736 7417 8448 6910 2236 4621 5041 1309 7236 6140 10163 8047 7845 2001 1104 4202 6777 7436 11358 11674 6113 11962 4244 1479 2619 2379 2530 11293 5259 832 968 7340 5197 10305 1352 5039 ...

output:

12105
6769
1 9761 12084 1237 7803 6970 1402 11355 11507 5038 10639 9885 6190 9483 10874 3628 3919 6938 9561 2618 1468 9095 10394 6559 3803 1909 5483 3095 1902 7867 10895 762 1713 9494 9586 9531 9893 7151 11434 7936 723 220 8967 8753 5802 9462 2449 2077 9487 2406 11371 625 9587 9201 7774 8509 9369 59...

result:

ok Correct (103 test cases)

Test #41:

score: 0
Accepted
time: 191ms
memory: 4060kb

input:

104
4175
320 1408 816 351 2298 854 1058 3748 3899 1240 3363 3498 3759 1805 2492 1509 1339 2194 1646 4102 498 3331 3166 2735 3584 2671 2621 3905 2177 1309 26 4112 2512 1265 3430 3967 2122 1368 894 3211 631 3257 2019 1731 1059 3113 1057 926 814 588 3200 1740 314 3695 3956 2619 1713 1120 451 2624 1594 ...

output:

4175
2577
1 320 1656 936 1327 2757 100 649 3728 566 4173 4122 1472 2797 4040 3018 4031 2773 811 4097 2203 1134 3439 1268 2266 681 3272 1305 717 486 4032 2535 3485 2261 8 3748 2867 1728 1726 2430 686 2502 1630 2640 3660 367 2925 1019 2742 1944 2903 2906 954 215 2843 3304 3429 359 425 893 147 121 2758...

result:

ok Correct (104 test cases)

Test #42:

score: 0
Accepted
time: 193ms
memory: 4044kb

input:

105
14987
11417 10364 5035 7062 312 4482 10545 2287 11370 6618 482 10039 9140 2052 10823 8130 3170 7162 14023 7496 10534 2411 8258 9897 5992 2114 11161 13956 5492 7430 9168 7941 5700 9316 10074 12364 8804 838 9724 4552 6827 8430 2094 8726 3117 13446 1797 12496 11358 6483 6753 3 8201 2136 11926 5468 ...

output:

14985
5588
1 11417 11721 12820 13197 10727 13715 7420 4508 936 5556 4737 3598 471 4130 2621 7508 4479 317 11276 10826 10380 3842 13647 5316 3278 10299 13247 4839 3526 6452 2413 12881 7124 4684 2564 6175 4510 13302 8051 7968 14489 10323 6173 3909 4974 4132 511 2903 3649 541 12596 13331 6858 5969 4956...

result:

ok Correct (105 test cases)

Test #43:

score: 0
Accepted
time: 164ms
memory: 3712kb

input:

1000
437
49 113 265 174 401 88 6 27 422 96 216 11 419 402 82 45 142 269 306 62 103 296 414 355 37 276 245 290 86 400 207 235 413 348 425 437 76 160 327 75 208 33 377 219 236 182 273 326 338 48 203 131 279 157 260 238 343 394 316 246 134 329 20 300 225 202 28 340 395 351 201 341 421 5 167 26 61 398 1...

output:

437
78
1 49 338 73 421 317 99 392 247 291 171 295 117 92 393 177 319 217 373 294 72 341 405 84 137 78 398 304 408 311 293 325 249 379 332 350 228 170 404 314 101 150 176 189 158 94 162 168 376 197 384 432 427 95 278 282 356 227 310 321 188 67 28 290 125 124 211 375 289 90 140 24 355 229 148 120 346 ...

result:

ok Correct (1000 test cases)

Test #44:

score: 0
Accepted
time: 170ms
memory: 3584kb

input:

1001
194
106 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 72 20 21 22 23 24 25 111 27 28 29 30 31 60 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 32 61 62 63 64 65 66 67 68 69 70 71 19 73 74 90 76 77 78 79 80 81 82 83 84 85 86 137 88 89 75 91 92 101 94 95 96 159 98 ...

output:

194
2
1 106 
1427
806
1 1333 31 1078 50 907 478 919 422 727 276 447 228 855 988 350 146 403 1082 818 267 160 246 559 500 399 880 1277 262 1172 1411 1282 1199 280 680 724 1269 1135 976 1094 989 1173 439 644 531 462 752 194 965 419 166 1176 1232 795 591 721 842 452 207 1000 579 109 182 173 455 307 408...

result:

ok Correct (1001 test cases)

Test #45:

score: 0
Accepted
time: 164ms
memory: 3712kb

input:

1002
1577
646 403 1536 766 972 169 815 856 1495 732 592 1386 236 640 336 608 535 1216 1332 539 408 1119 1131 1362 948 122 495 1033 556 975 241 513 438 674 1353 920 1245 765 166 883 1276 125 1415 469 1350 930 1117 1197 473 4 859 1448 1491 406 117 1110 437 898 965 1543 949 428 1550 672 1380 505 334 71...

output:

1575
317
1 646 61 949 398 356 1148 918 1228 571 1172 924 998 388 951 1254 868 489 1235 1289 1370 528 63 1550 554 682 278 1377 607 666 733 120 1327 1329 667 171 1018 21 408 1241 41 1276 1234 411 282 839 143 485 318 579 1189 785 685 210 615 134 959 1456 509 1151 1505 1180 1035 1529 1135 229 440 425 45...

result:

ok Correct (1002 test cases)

Test #46:

score: 0
Accepted
time: 164ms
memory: 3712kb

input:

1003
1215
897 2 63 860 5 572 7 1053 31 352 411 71 368 690 1067 536 553 756 398 20 21 22 992 299 25 26 175 28 29 30 9 367 140 832 35 1157 156 511 1195 639 877 42 43 496 45 386 535 581 49 50 51 1149 935 69 774 56 57 744 914 1174 147 207 666 64 978 172 959 976 54 879 1205 72 1142 1081 174 76 1000 823 7...

output:

1215
3
1 897 866 
311
34
1 128 227 176 185 305 168 268 79 311 201 221 237 9 120 58 174 78 307 310 74 149 61 161 102 276 226 125 222 263 31 288 177 106 
5538
4414
1 4115 3113 2816 2796 77 2343 5526 4956 442 121 3530 2399 4754 4801 1236 2131 3653 4919 1206 4040 1319 1393 5427 2559 1283 1372 5252 3591 ...

result:

ok Correct (1003 test cases)

Test #47:

score: 0
Accepted
time: 165ms
memory: 3712kb

input:

1004
929
30 489 88 6 192 602 97 480 803 906 308 697 248 586 39 215 828 878 793 46 512 902 136 747 620 898 292 731 323 282 457 621 222 689 41 885 560 190 504 246 904 721 405 252 399 631 117 235 854 617 114 307 176 208 172 751 715 111 867 11 588 831 448 8 288 453 100 263 408 836 702 319 630 671 333 89...

output:

927
772
1 30 282 568 551 505 889 534 221 887 230 13 248 628 744 451 624 863 549 20 46 631 900 853 293 290 669 188 127 383 849 139 717 574 496 156 417 905 846 220 820 884 707 584 152 694 304 265 180 464 91 597 182 444 162 539 433 699 439 703 116 352 616 690 271 852 101 55 172 374 477 827 309 378 387 ...

result:

ok Correct (1004 test cases)

Test #48:

score: 0
Accepted
time: 164ms
memory: 3456kb

input:

1005
1634
506 1610 352 1251 1632 261 1334 1551 809 884 339 199 732 633 959 259 894 1499 968 1280 1335 107 1123 1615 1348 1437 1372 235 227 471 1159 1462 509 642 811 1505 1204 1054 618 203 1328 562 45 166 1421 567 1439 1516 772 1554 84 257 868 1203 1500 919 734 1303 425 1132 1583 1269 110 1133 901 31...

output:

1634
1367
1 506 1311 17 894 345 104 561 1327 49 772 1361 98 1515 122 1426 1596 239 495 1470 441 657 338 482 1015 907 812 353 336 1570 1019 850 1028 843 1422 979 576 1200 1480 927 550 719 841 428 474 287 1543 60 1132 898 950 28 235 144 1613 1083 623 1184 1271 1150 1224 645 1078 961 801 1069 503 1317 ...

result:

ok Correct (1005 test cases)

Test #49:

score: 0
Accepted
time: 156ms
memory: 3584kb

input:

10000
105
41 65 3 58 21 57 92 14 90 8 64 63 81 105 91 103 66 88 4 49 44 101 7 85 2 42 51 97 104 75 73 89 36 61 54 33 100 60 5 76 52 56 18 59 45 34 80 29 48 23 26 62 40 87 15 95 93 35 39 32 46 38 25 37 102 79 68 47 69 10 98 70 96 9 30 78 77 53 6 13 27 82 84 83 24 86 19 1 43 74 28 50 72 94 67 31 55 71...

output:

105
11
1 41 52 62 38 60 32 89 43 18 88 
112
69
1 66 22 103 29 110 70 34 90 24 44 63 28 75 78 69 49 79 8 108 59 50 67 39 101 5 77 100 97 111 48 36 4 37 9 12 23 7 10 80 26 95 107 84 99 32 18 72 83 56 53 55 54 41 73 30 6 93 15 46 87 2 51 42 35 112 25 89 105 
96
19
1 33 74 22 9 36 35 44 6 65 37 64 3 55 ...

result:

ok Correct (10000 test cases)

Test #50:

score: 0
Accepted
time: 154ms
memory: 3584kb

input:

10001
2
2 1
8
2 1 4 5 8 7 3 6
93
21 8 25 10 78 45 12 79 62 68 87 18 72 43 73 19 91 85 16 70 88 35 77 75 39 4 3 52 67 53 60 57 74 26 66 15 2 56 40 13 6 7 64 23 41 76 17 55 42 83 38 84 50 24 81 37 49 32 30 44 90 20 63 33 22 27 5 46 80 82 71 59 61 14 86 93 31 1 51 92 58 9 65 28 48 54 11 29 89 36 47 69 ...

output:

0
1
1 
8
2
1 2 
93
7
1 21 88 29 67 5 78 
196
73
1 35 104 162 46 10 198 63 94 169 183 193 148 66 50 100 58 154 83 103 77 143 11 153 116 16 23 89 28 142 71 178 117 189 126 95 60 43 157 67 156 190 155 150 26 123 165 17 47 87 14 105 141 144 54 37 15 176 184 44 56 188 119 55 86 131 136 140 78 82 124 40 3...

result:

ok Correct (10001 test cases)

Test #51:

score: 0
Accepted
time: 149ms
memory: 3584kb

input:

10002
115
45 111 54 25 19 113 13 78 71 11 98 79 18 114 77 60 56 95 93 110 27 84 7 34 35 22 99 32 9 29 108 48 17 31 3 24 4 16 51 38 112 55 91 61 74 83 97 75 89 104 103 21 66 92 105 10 101 33 5 59 57 44 28 109 70 23 50 41 42 67 26 102 63 62 37 20 76 40 106 8 49 73 6 100 58 47 2 1 14 107 69 46 85 15 80...

output:

113
110
1 45 74 62 44 61 57 101 52 21 27 99 72 102 86 47 97 65 70 67 50 104 96 12 79 106 43 91 69 42 55 105 82 73 63 28 32 48 75 37 4 25 35 3 54 92 46 83 6 113 30 29 9 71 26 22 84 100 64 109 53 66 23 7 13 18 95 80 8 78 40 38 16 60 59 5 19 93 85 58 33 17 56 10 11 98 68 41 112 115 81 49 89 14 114 36 2...

result:

ok Correct (10002 test cases)

Test #52:

score: 0
Accepted
time: 151ms
memory: 3584kb

input:

10003
77
73 58 54 34 2 12 66 36 7 77 30 11 14 68 18 72 23 27 35 31 39 52 67 42 8 49 48 20 33 3 53 44 40 24 6 41 5 19 16 25 45 43 57 60 64 59 65 32 63 71 22 13 70 61 15 47 9 38 37 26 51 17 76 56 50 62 10 4 46 74 1 75 69 21 55 29 28
48
4 38 44 46 45 41 23 20 17 48 36 43 31 10 13 35 1 14 9 37 26 3 34 1...

output:

75
7
1 73 69 46 59 37 5 
46
14
1 4 46 21 26 6 41 42 5 45 28 47 12 43 
86
1
1 
62
37
1 53 55 41 7 61 9 56 17 10 31 23 34 50 37 28 6 42 5 35 63 18 38 51 27 44 11 30 46 60 64 22 14 20 19 59 47 
128
66
1 64 49 101 42 79 118 115 66 111 3 127 87 113 46 57 20 17 53 26 112 103 50 82 31 63 125 121 23 81 93 8...

result:

ok Correct (10003 test cases)

Test #53:

score: 0
Accepted
time: 147ms
memory: 3584kb

input:

10004
479
97 469 357 341 363 83 458 333 432 335 68 169 250 245 252 54 176 153 45 12 143 355 479 63 407 128 159 16 184 118 313 180 367 455 289 409 191 392 80 179 201 261 221 418 324 255 326 389 470 1 23 277 385 408 117 353 434 158 325 249 24 279 137 228 457 425 50 90 426 38 290 3 416 126 98 265 188 2...

output:

479
465
1 97 77 188 58 158 446 384 370 318 33 367 400 113 366 362 247 438 365 251 435 69 426 27 159 220 25 407 66 425 110 257 43 221 419 282 431 259 108 185 164 244 165 413 136 404 22 355 133 21 143 81 163 304 453 147 89 373 427 101 459 412 269 478 433 321 319 198 82 349 314 93 301 232 372 437 327 3...

result:

ok Correct (10004 test cases)

Test #54:

score: 0
Accepted
time: 158ms
memory: 3584kb

input:

10005
182
29 174 120 65 88 104 150 103 138 28 161 85 137 81 53 76 16 10 74 97 127 164 96 92 172 162 159 102 143 182 67 117 27 20 181 107 146 147 61 77 108 155 132 130 158 75 55 110 98 166 21 59 134 176 4 167 133 83 135 48 46 34 69 60 24 54 32 94 37 171 40 101 44 43 30 36 8 105 111 73 84 124 163 22 1...

output:

180
34
1 29 143 112 57 133 154 123 91 170 3 120 68 94 142 26 162 149 157 70 171 168 64 60 48 110 5 88 39 61 46 75 30 182 
33
18
1 30 20 29 17 33 18 24 21 23 27 12 25 31 13 16 7 2 
74
44
1 55 5 51 37 53 22 17 59 14 47 26 3 7 52 20 28 29 38 33 34 8 62 39 23 56 75 54 35 71 18 58 44 30 36 67 16 50 70 24...

result:

ok Correct (10005 test cases)

Test #55:

score: 0
Accepted
time: 188ms
memory: 3584kb

input:

99995
16
9 12 2 1 6 10 13 15 7 8 14 3 11 4 5 16
10
7 1 3 9 10 8 4 2 5 6
11
3 11 2 10 4 1 8 9 5 6 7
13
8 5 9 4 12 11 3 1 13 2 10 7 6
3
2 1 3
5
2 5 1 3 4
10
9 5 2 3 10 4 8 1 6 7
2
2 1
38
33 26 25 3 14 12 16 13 34 8 32 10 20 17 29 18 11 37 22 7 15 4 1 23 21 6 30 19 27 38 9 24 28 5 36 2 31 35
4
3 2 1 4
...

output:

16
7
1 9 7 13 11 14 4 
10
9
1 7 4 9 5 10 6 8 2 
9
2
1 3 
13
2
1 8 
3
2
1 2 
3
1
1 
8
5
1 9 6 4 3 
0
1
1 
36
16
1 33 28 19 22 4 3 25 21 15 29 27 30 38 35 36 
4
2
1 3 
11
6
1 5 4 7 11 12 
7
3
1 4 5 
6
1
1 
8
6
1 9 10 5 8 3 
4
3
1 6 5 
10
1
1 
7
1
1 
3
2
1 2 
11
1
1 
12
5
1 12 3 11 7 
5
6
1 5 4 3 6 7 
...

result:

ok Correct (99995 test cases)

Test #56:

score: 0
Accepted
time: 187ms
memory: 3584kb

input:

99996
30
30 18 15 22 6 7 21 12 20 28 29 10 25 27 17 1 26 24 8 19 4 14 9 13 5 2 23 11 16 3
2
1 2
10
4 2 1 5 7 9 10 8 6 3
2
2 1
3
2 3 1
15
5 11 4 6 15 13 10 14 12 9 1 2 8 7 3
11
3 5 10 4 2 6 8 7 9 1 11
2
2 1
6
4 5 3 1 2 6
3
1 2 3
2
2 1
7
5 3 4 1 6 7 2
3
2 3 1
2
2 1
13
11 3 7 6 13 2 10 1 5 12 9 8 4
10
...

output:

28
6
1 30 3 15 17 26 
2
1
1 
10
6
1 4 5 7 10 3 
0
1
1 
1
1
1 
13
13
1 5 15 3 4 6 13 8 14 7 10 9 12 
11
3
1 3 10 
0
1
1 
6
2
1 4 
3
1
1 
0
1
1 
5
4
1 5 6 7 
1
1
1 
0
1
1 
11
7
1 11 9 5 13 4 6 
10
1
1 
13
1
1 
14
12
1 10 8 11 16 4 13 9 12 3 5 6 
3
1
1 
6
7
1 6 5 7 8 3 4 
0
1
1 
10
11
1 6 7 8 10 11 9 1...

result:

ok Correct (99996 test cases)

Test #57:

score: 0
Accepted
time: 181ms
memory: 3584kb

input:

99997
7
1 3 6 4 2 5 7
29
13 4 17 24 1 21 6 26 25 20 5 28 15 9 2 18 8 29 16 14 12 3 22 27 23 7 19 11 10
5
3 2 4 1 5
22
1 11 5 7 3 14 4 9 15 10 17 12 13 6 8 16 22 18 19 21 20 2
8
1 2 3 4 5 6 8 7
13
10 13 2 9 3 12 8 11 1 6 4 5 7
3
2 1 3
14
8 1 11 7 10 9 12 13 2 14 5 6 3 4
14
5 7 8 13 3 11 12 6 2 14 9 1...

output:

7
1
1 
27
3
1 13 15 
5
3
1 3 4 
22
1
1 
8
1
1 
11
6
1 10 6 12 5 3 
3
2
1 2 
12
13
1 8 13 3 11 5 10 14 4 7 12 6 9 
14
10
1 5 3 8 6 11 9 2 7 12 
1
2
1 3 
11
2
1 10 
6
5
1 5 7 4 8 
3
2
1 3 
13
1
1 
4
1
1 
4
2
1 4 
10
6
1 4 6 3 7 10 
1
1
1 
8
2
1 10 
6
7
1 3 7 4 6 8 5 
9
9
1 4 11 5 7 9 6 3 10 
7
2
1 3 
...

result:

ok Correct (99997 test cases)

Test #58:

score: 0
Accepted
time: 180ms
memory: 3584kb

input:

99998
6
1 2 3 6 5 4
2
1 2
4
1 2 3 4
6
1 5 3 6 4 2
5
3 2 1 4 5
21
15 6 14 12 3 1 9 5 13 17 16 20 7 11 4 19 21 2 8 18 10
7
1 2 3 4 7 6 5
3
3 1 2
3
2 3 1
3
1 2 3
2
1 2
5
3 4 5 1 2
6
1 2 3 4 5 6
7
4 1 2 7 3 5 6
3
1 2 3
7
6 3 7 5 2 4 1
2
2 1
5
4 3 2 1 5
11
6 7 8 2 11 9 3 5 4 1 10
3
1 2 3
18
2 11 17 9 3 1...

output:

6
1
1 
2
1
1 
4
1
1 
6
1
1 
5
2
1 3 
21
8
1 15 4 12 20 18 2 6 
7
1
1 
1
2
1 3 
1
1
1 
3
1
1 
2
1
1 
3
3
1 3 5 
6
1
1 
5
6
1 4 7 6 5 3 
3
1
1 
5
4
1 6 4 5 
0
1
1 
5
2
1 4 
9
4
1 6 9 4 
3
1
1 
16
1
1 
26
4
1 24 19 16 
2
3
1 3 4 
5
4
1 2 5 3 
0
1
1 
9
7
1 6 5 3 7 9 8 
10
1
1 
3
1
1 
2
2
1 3 
4
1
1 
5
1...

result:

ok Correct (99998 test cases)

Test #59:

score: 0
Accepted
time: 171ms
memory: 3584kb

input:

99999
10
5 8 1 9 3 4 7 6 10 2
6
4 5 2 3 6 1
8
5 2 4 3 8 6 1 7
3
3 1 2
10
9 6 5 4 10 1 3 7 2 8
8
3 8 2 4 1 7 5 6
10
9 3 8 2 1 4 6 10 7 5
7
7 3 6 5 1 4 2
22
13 3 6 9 20 7 19 14 10 11 15 18 4 2 22 5 17 16 1 8 21 12
3
2 1 3
4
2 1 4 3
17
8 17 14 9 6 1 7 15 12 2 10 4 5 3 16 13 11
3
3 1 2
7
3 7 4 5 1 2 6
1...

output:

10
3
1 5 3 
4
3
1 4 3 
8
4
1 5 8 7 
1
2
1 3 
10
4
1 9 2 6 
8
7
1 3 2 8 6 7 5 
8
5
1 9 7 6 4 
5
2
1 7 
22
20
1 13 4 9 10 11 15 22 12 18 16 5 20 8 14 2 3 6 7 19 
3
2
1 2 
4
2
1 2 
17
7
1 8 15 16 13 5 6 
1
2
1 3 
7
4
1 3 4 5 
10
10
1 11 5 9 3 7 6 12 8 10 
6
5
1 3 6 5 8 
3
1
1 
16
7
1 17 8 4 18 3 11 
39...

result:

ok Correct (99999 test cases)

Test #60:

score: 0
Accepted
time: 195ms
memory: 3584kb

input:

100000
36
11 19 5 16 29 17 18 15 7 24 3 34 9 20 31 21 28 12 36 2 23 32 26 27 13 33 1 25 8 4 30 6 35 10 14 22
10
5 3 1 4 10 2 8 7 9 6
5
1 2 5 3 4
6
6 3 1 5 2 4
10
10 7 2 9 5 8 6 3 1 4
8
6 1 5 7 2 8 3 4
2
1 2
12
1 3 6 4 11 2 10 7 8 12 5 9
6
6 3 5 2 1 4
4
3 4 2 1
24
19 5 12 7 14 8 9 21 3 11 18 24 2 17 ...

output:

34
18
1 11 3 5 29 8 15 31 30 4 16 21 23 26 33 35 14 20 
10
6
1 5 10 6 2 3 
5
1
1 
4
4
1 6 4 5 
10
4
1 10 4 9 
6
7
1 6 8 4 7 3 5 
2
1
1 
12
1
1 
4
3
1 6 4 
2
2
1 3 
24
9
1 19 15 4 7 9 3 12 24 
6
1
1 
7
1
1 
8
3
1 4 9 
1
1
1 
3
1
1 
4
1
1 
2
1
1 
2
1
1 
13
7
1 11 7 15 5 14 12 
6
2
1 7 
10
5
1 6 3 2 9 ...

result:

ok Correct (100000 test cases)

Extra Test:

score: 0
Extra Test Passed