QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#596513#9432. Permutationucup-team3727#AC ✓283ms3976kbC++203.6kb2024-09-28 15:56:242024-09-28 15:56:24

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
1
0
1
2
0
2
0
2

output:

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

result:

ok Accepted

Test #2:

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

input:

1000
2
1
2
0
1
1
2
0
1
2
1
0
0
1
2
1
1
0
1
0
1
2
2
1
1
0
2
0
0
0
2
1
0
2
1
2
2
2
2
0
1
1
0
2
0
2
1
2
1
0
0
2
0
1
1
1
0
0
2
1
1
1
2
0
1
1
0
1
0
2
0
0
2
0
0
0
2
2
0
0
0
2
1
1
1
2
1
0
0
1
2
1
0
2
2
1
0
2
1
2
1
1
0
2
1
1
1
2
1
1
0
2
0
0
0
1
1
1
0
2
0
1
2
0
0
0
1
1
2
1
2
1
2
1
2
2
0
0
2
0
2
0
2
1
2
1
1
0...

output:

0 384 887 778 916 794 336 387 493 650 422 363 28 691 60 764 927 541 427 173 737 212 369 568 430 783 531 863 124 68 136 930 803 23 59 70 168 394 457 12 43 230 374 422 920 785 538 199 325 316 371 414 527 92 981 957 874 863 171 997 282 306 926 85 328 337 506 847 730 314 858 125 896 583 546 815 368 435 ...

result:

ok Accepted

Test #3:

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

input:

1

output:

1 1

result:

ok Accepted

Test #4:

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

input:

2
2
1
1
1
1
0
2

output:

0 2 1
0 2 2
0 2 2
0 1 1
0 2 2
0 1 2
0 2 1
1 2 1

result:

ok Accepted

Test #5:

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

input:

3
0
2
0

output:

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

result:

ok Accepted

Test #6:

score: 0
Accepted
time: 0ms
memory: 3796kb

input:

4
1
2
0
0
0
2
2

output:

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

result:

ok Accepted

Test #7:

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

input:

6
1
0
1
0
1
0
1
0
0
1
0
2

output:

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

result:

ok Accepted

Test #8:

score: 0
Accepted
time: 0ms
memory: 3636kb

input:

7
1
2
1
1
2
1
0
1
0
2
0
2
0
2
0
2
2

output:

0 2 5 3 6 2 4 4
0 3 2 4 3 6 7 5
0 7 1 4 2 3 3 4
0 1 6 3 3 6 6 7
0 2 6 6 1 4 6 4
0 3 2 1 3 3 2 5
0 6 1 7 4 7 3 3
0 2 2 2 2 7 7 7
0 6 6 6 6 3 3 3
0 1 1 1 1 4 4 4
0 5 5 5 5 2 2 2
0 3 3 1 1 7 3 3
0 2 2 7 7 7 3 3
0 3 7 7 4 7 3 3
0 6 1 1 2 7 3 3
0 6 1 7 4 6 6 4
0 6 1 7 4 6 5 3
1 3 7 2 1 6 5 4

result:

ok Accepted

Test #9:

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

input:

8
2
1
1
0
2
1
2
1
0
2
2
0
2
2
2
2
2

output:

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

result:

ok Accepted

Test #10:

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

input:

9
0
1
2
1
1
1
1
0
2
2
2
2
2
2
2
0
2

output:

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

result:

ok Accepted

Test #11:

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

input:

10
2
1
0
1
2
2
0
1
2
2
0
1
0
0
2
2
2
1
0
2
2

output:

0 4 7 8 6 4 6 7 3 10 2
0 3 8 1 10 4 7 1 7 3 7
0 2 9 8 10 3 1 3 4 8 6
0 3 3 3 3 3 10 10 10 10 10
0 7 7 7 7 7 5 5 5 5 5
0 1 1 1 1 1 6 6 6 6 6
0 4 4 4 4 4 9 9 9 9 9
0 2 2 2 2 2 8 8 8 8 8
0 3 3 3 3 3 2 2 2 2 2
0 7 7 7 1 1 1 3 4 8 6
0 9 9 9 3 3 1 3 4 8 6
0 7 7 3 10 3 1 3 4 8 6
0 10 10 7 10 3 1 3 4 8 6
0 ...

result:

ok Accepted

Test #12:

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

input:

11
2
0
1
1
2
2
0
1
0
1
2
1
2
0
2
2
2
1
0
0
0
2
2

output:

0 7 11 7 3 2 5 1 7 4 2 9
0 8 6 4 8 5 10 11 3 1 11 9
0 5 5 5 5 5 5 9 9 9 9 9
0 6 6 6 6 6 6 8 8 8 8 8
0 3 3 3 3 3 3 4 4 4 4 4
0 7 7 7 7 7 7 11 11 11 11 11
0 2 2 2 2 2 2 10 10 10 10 10
0 1 1 1 1 1 1 5 5 5 5 5
0 6 6 6 6 6 6 1 1 1 1 1
0 3 3 3 7 7 7 11 3 1 11 9
0 10 10 10 1 1 1 11 3 1 11 9
0 5 5 5 9 9 9 1...

result:

ok Accepted

Test #13:

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

input:

12
2
2
1
1
1
1
1
1
3
0
2
2
2
0
0
2
2
2
2
1
0
2
1
0
0
0
2
2
0
2
1
0
0

output:

0 8 11 10 8 6 8 11 1 10 2 3 8
0 3 8 12 11 1 7 5 5 12 9 4 10
0 3 3 3 8 8 8 6 7 7 7 6 4
0 2 5 8 11 10 10 10 12 9 2 3 9
0 12 7 6 11 8 9 9 10 3 3 5 2
0 10 10 9 4 9 6 11 10 2 6 1 4
0 7 10 3 4 3 9 4 3 8 1 1 3
0 9 1 4 12 3 8 1 1 9 1 8 5
0 11 7 7 12 4 11 3 11 12 10 6 3
0 10 1 5 9 2 9 3 2 10 6 5 12
0 3 3 3 3...

result:

ok Accepted

Test #14:

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

input:

13
0
1
1
2
2
2
1
1
1
0
2
1
2
0
0
0
2
0
0
0
2
2
0
1
0
2
2
0

output:

0 1 10 12 5 2 2 13 4 2 8 3 4 1
0 8 8 8 8 8 8 8 2 2 2 2 2 2
0 7 7 7 7 7 7 7 13 13 13 13 13 13
0 1 1 1 1 1 1 1 11 11 11 11 11 11
0 4 4 4 4 4 4 4 6 6 6 6 6 6
0 10 10 10 10 10 10 10 12 12 12 12 12 12
0 5 5 5 5 5 5 5 9 9 9 9 9 9
0 3 3 3 3 3 3 3 8 8 8 8 8 8
0 7 7 7 7 7 7 7 5 5 5 5 5 5
0 3 3 3 3 3 3 3 7 7 ...

result:

ok Accepted

Test #15:

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

input:

14
2
1
2
1
1
2
2
1
1
0
1
1
2
1
1
0
2
2
0
0
2
1
0
2
2
0
0
1
0
0
1
1
0
2
0
2
2
0
1
0
2

output:

0 2 5 10 6 2 4 11 3 2 4 3 6 7 12
0 14 1 11 9 3 3 4 1 6 10 3 13 13 14
0 2 6 6 1 11 13 4 10 2 1 10 3 2 12
0 6 8 7 4 7 3 10 9 4 13 8 9 9 10
0 5 5 9 4 10 14 5 6 11 6 13 12 4 8
0 13 4 3 4 11 10 5 1 10 1 8 11 13 1
0 5 5 8 10 9 2 13 5 13 1 8 9 5 7
0 5 8 12 1 11 1 2 6 8 7 4 1 7 9
0 12 3 7 14 8 14 7 2 13 4 4...

result:

ok Accepted

Test #16:

score: 0
Accepted
time: 0ms
memory: 3568kb

input:

15
3
0
0
2
2
1
1
1
1
1
0
0
1
2
2
1
2
0
0
2
0
0
0
0
0
1
0
1
2
2
2
0
0
0
2

output:

0 14 2 13 11 9 11 2 13 10 2 3 8 6 5 9
0 2 1 7 8 2 12 9 13 10 3 6 3 14 8 11
0 3 3 3 3 3 3 3 3 10 10 10 10 10 10 10
0 7 7 7 7 7 7 7 7 5 5 5 5 5 5 5
0 1 1 1 1 1 1 1 1 14 14 14 14 14 14 14
0 4 4 4 4 4 4 4 4 9 9 9 9 9 9 9
0 2 2 2 2 2 2 2 2 12 12 12 12 12 12 12
0 11 11 11 11 11 11 11 11 13 13 13 13 13 13 ...

result:

ok Accepted

Test #17:

score: 0
Accepted
time: 268ms
memory: 3664kb

input:

975
4
1
1
1
0
1
1
2
0
0
2
2
1
1
1
0
1
2
0
0
2
0
0
1
1
1
0
2
0
1
2
0
2
1
1
1
1
1
1
2
1
1
0
1
1
0
1
1
0
0
0
1
2
1
2
2
2
2
2
0
0
1
2
1
1
1
2
1
1
1
0
2
0
1
0
1
1
2
1
0
2
1
2
2
1
1
0
1
1
0
2
1
1
1
1
1
0
1
1
1
2
0
1
1
1
0
1
0
2
0
1
1
1
2
1
1
1
1
1
0
1
2
1
1
1
2
2
2
1
0
1
2
1
1
0
2
0
1
0
0
1
2
1
1
2
0
2
1
...

output:

0 209 62 103 941 444 236 962 43 925 47 588 953 66 785 39 2 166 427 323 662 762 594 43 355 108 6 588 524 518 161 855 403 223 634 45 343 869 32 62 818 730 649 472 795 135 188 474 300 291 796 639 77 92 681 432 199 363 696 722 557 856 601 960 103 912 681 122 805 389 183 325 796 508 796 615 643 660 765 6...

result:

ok Accepted

Test #18:

score: 0
Accepted
time: 269ms
memory: 3720kb

input:

976
0
0
2
1
2
2
1
1
1
2
1
2
0
1
1
0
1
0
0
0
0
1
2
0
0
1
2
1
0
2
0
2
1
1
0
1
1
0
0
1
0
1
0
0
1
1
1
0
1
0
0
1
2
1
0
0
1
0
0
1
0
1
0
2
2
1
2
0
2
2
2
1
2
0
1
2
0
1
1
1
1
1
1
0
1
1
1
1
1
1
1
2
2
1
2
0
0
0
0
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
2
1
0
1
0
2
0
2
1
0
1
0
1
1
1
1
1
1
1
0
1
1
2
1
0
1
0
0
0
2
0
2
1
0
...

output:

0 152 55 858 116 130 416 475 365 90 878 251 780 835 204 132 407 541 691 757 905 972 473 344 558 519 187 687 964 244 608 330 763 663 579 270 184 18 745 916 107 38 190 278 872 761 778 671 325 860 451 622 855 316 965 437 834 543 515 821 178 146 174 941 808 145 602 383 162 738 322 637 168 879 914 63 664...

result:

ok Accepted

Test #19:

score: 0
Accepted
time: 257ms
memory: 3720kb

input:

977
0
0
0
2
1
1
1
2
1
0
1
2
2
2
1
2
0
1
0
0
1
2
2
1
1
1
0
1
1
1
0
0
2
1
1
1
1
0
1
2
1
1
1
1
1
1
1
1
1
1
2
2
1
1
0
1
0
2
2
0
0
2
1
1
2
1
1
2
2
1
1
1
0
1
0
2
2
1
1
1
0
1
1
2
0
1
1
0
1
1
0
1
0
2
0
1
0
1
1
2
2
0
1
2
0
2
1
1
2
1
1
1
1
1
1
2
0
1
1
1
1
2
1
1
2
2
0
1
1
0
2
1
1
2
2
0
1
1
1
2
2
0
1
2
2
2
0
1
...

output:

0 956 851 264 939 22 511 523 247 507 303 114 514 321 962 615 63 855 285 854 957 279 471 288 483 661 224 395 919 570 87 165 26 938 883 442 437 416 965 161 922 745 274 913 88 713 29 606 590 768 482 48 69 431 335 552 114 36 424 55 83 510 219 109 470 580 28 384 18 470 544 418 693 295 353 780 31 836 863 ...

result:

ok Accepted

Test #20:

score: 0
Accepted
time: 247ms
memory: 3924kb

input:

978
1
2
2
0
1
0
1
1
2
2
0
0
2
0
1
0
2
0
2
0
2
2
1
1
0
0
0
1
1
1
0
2
1
1
2
1
1
1
1
2
1
1
1
1
0
1
2
2
2
1
0
2
0
1
2
2
2
2
1
2
2
1
2
1
1
0
1
1
1
1
2
1
2
0
1
0
1
1
1
2
2
2
2
2
1
2
1
2
2
2
1
1
1
1
1
2
0
2
0
1
1
1
1
1
1
1
2
2
2
1
1
2
2
0
1
1
1
1
0
1
2
1
1
1
1
1
1
0
0
1
2
1
1
1
1
1
1
1
1
0
1
1
2
2
1
2
0
1
...

output:

0 656 491 262 470 108 518 125 655 220 266 171 146 471 122 498 911 121 175 611 809 636 585 850 118 531 111 687 386 506 548 354 133 61 565 552 118 104 677 722 323 892 892 418 384 963 866 267 105 12 877 864 647 434 735 765 964 795 423 371 272 970 724 405 52 261 906 119 364 554 840 637 418 703 76 801 68...

result:

ok Accepted

Test #21:

score: 0
Accepted
time: 253ms
memory: 3724kb

input:

979
1
2
0
2
1
1
0
2
1
1
1
1
0
0
1
1
1
1
0
2
1
1
1
1
1
1
1
1
1
1
1
1
0
2
1
1
1
1
0
0
2
2
2
1
0
2
1
0
0
1
1
1
2
0
2
1
1
1
2
1
2
0
2
1
1
0
0
1
2
0
2
1
2
0
1
2
1
1
2
1
0
2
1
1
2
2
2
1
2
0
0
1
1
0
0
0
1
0
2
2
1
2
0
0
2
0
1
0
2
1
2
1
1
1
1
1
1
0
0
1
1
2
1
0
2
1
1
2
2
0
0
1
0
2
0
2
1
1
1
0
1
0
1
0
1
2
1
2
...

output:

0 216 924 843 652 376 434 254 601 202 761 416 646 303 609 745 5 285 352 25 452 88 812 72 430 126 821 584 341 37 33 891 96 957 598 591 197 52 845 641 253 470 77 742 772 529 352 621 813 547 645 130 634 322 201 85 447 865 512 787 745 544 698 841 521 161 296 561 212 5 222 309 319 142 71 111 671 266 575 ...

result:

ok Accepted

Test #22:

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

input:

980
0
2
1
2
2
1
1
2
1
2
1
0
0
0
0
1
1
1
1
1
0
2
1
2
2
2
2
0
2
1
2
1
2
2
1
1
1
0
0
1
0
1
1
1
2
1
0
2
1
1
1
0
2
1
0
2
0
1
0
1
0
1
2
0
1
2
1
0
2
1
1
1
1
1
0
0
0
1
0
1
1
2
1
1
2
1
2
0
1
2
0
0
1
0
0
1
0
0
1
0
2
0
1
2
0
2
0
1
1
0
0
2
2
2
1
1
2
1
0
0
1
2
0
2
2
0
0
1
0
1
1
0
1
2
1
1
0
0
0
1
2
1
0
1
2
1
2
1
...

output:

0 604 187 38 496 814 256 907 73 450 802 843 48 791 460 364 267 361 807 73 857 592 169 888 430 423 391 83 784 128 496 790 883 683 979 550 668 254 477 892 703 450 754 902 260 385 438 679 745 416 751 774 27 92 681 457 514 243 691 317 522 206 126 425 888 277 146 727 530 774 638 405 396 563 326 655 948 9...

result:

ok Accepted

Test #23:

score: 0
Accepted
time: 273ms
memory: 3612kb

input:

981
3
3
1
2
2
1
3
1
1
0
1
1
1
1
1
1
0
1
2
1
1
1
2
0
1
1
1
0
2
0
0
2
2
1
0
1
2
2
2
1
2
2
0
0
1
1
0
2
2
0
1
0
1
0
1
1
0
1
2
1
1
1
0
1
1
1
1
1
0
1
2
0
2
1
0
1
1
0
2
1
1
0
0
1
2
2
1
2
1
2
0
1
2
2
0
1
0
1
1
0
1
0
1
1
2
0
1
1
1
1
2
0
2
2
2
1
2
1
1
2
0
2
1
2
0
2
1
0
1
1
1
1
0
1
1
2
2
1
0
0
0
0
1
1
0
0
0
1
...

output:

0 830 233 775 971 429 962 119 40 961 380 465 302 951 647 321 707 340 550 755 56 189 612 358 106 441 774 162 734 767 956 42 523 208 724 420 544 704 539 491 683 826 955 892 795 528 140 429 867 597 202 831 785 722 207 891 181 888 960 914 581 934 955 123 160 606 450 611 328 896 120 919 649 1 829 462 529...

result:

ok Accepted

Test #24:

score: 0
Accepted
time: 242ms
memory: 3616kb

input:

982
0
1
2
2
1
2
1
0
2
2
1
0
1
0
1
1
2
1
2
2
1
0
1
1
0
1
1
2
1
2
1
2
0
1
0
0
0
1
2
2
2
1
2
1
1
1
1
1
0
1
0
1
1
1
0
2
2
1
0
0
1
2
1
1
1
1
2
1
0
0
2
2
1
2
1
1
2
1
1
2
1
1
2
0
2
1
2
1
1
2
2
2
2
1
2
1
0
1
0
2
1
2
0
0
1
1
0
0
1
1
1
0
0
2
1
2
1
2
1
0
2
1
2
1
2
2
0
2
1
1
2
0
0
2
1
1
2
1
1
1
2
1
2
2
1
1
0
1
...

output:

0 882 77 102 104 188 588 827 493 750 468 255 420 777 182 604 331 213 551 107 1 840 177 440 428 177 3 821 188 960 428 602 965 505 809 192 798 414 37 414 181 610 668 706 404 955 434 841 185 108 947 292 947 248 731 393 424 839 337 611 922 764 230 905 286 163 220 207 576 362 620 863 96 411 586 499 384 1...

result:

ok Accepted

Test #25:

score: 0
Accepted
time: 268ms
memory: 3664kb

input:

983
0
2
0
1
2
2
2
2
2
1
2
2
1
2
0
1
1
1
2
1
1
1
1
2
0
0
1
1
1
2
1
1
0
1
1
0
0
2
0
0
1
0
0
1
0
1
2
0
1
1
0
0
2
1
0
0
1
2
1
2
1
0
2
0
1
2
0
2
2
2
2
1
0
1
1
1
1
0
1
1
1
1
1
2
1
1
1
1
0
1
1
0
1
1
1
0
1
1
0
0
2
2
2
1
1
1
2
1
1
1
2
1
1
2
2
1
2
1
0
2
1
2
0
1
2
0
2
0
0
1
0
0
2
2
2
1
0
1
2
1
1
1
0
1
1
0
2
1
...

output:

0 748 696 953 829 79 111 82 440 794 77 207 393 263 39 218 107 954 801 89 686 582 824 151 404 611 35 94 126 692 872 501 234 585 248 840 441 358 922 658 168 776 864 338 55 680 334 923 650 912 28 131 510 630 281 914 257 93 785 382 562 673 882 796 274 908 430 492 282 146 166 228 700 807 565 754 504 676 ...

result:

ok Accepted

Test #26:

score: 0
Accepted
time: 246ms
memory: 3664kb

input:

984
0
0
1
2
0
0
0
1
1
0
0
2
1
2
1
2
0
2
1
1
0
1
1
1
1
2
2
1
1
2
2
1
1
0
1
2
1
2
0
1
1
1
1
2
0
2
1
1
1
0
1
1
1
2
0
1
2
1
1
2
1
1
2
2
1
1
0
0
1
0
1
0
0
2
0
2
1
0
0
2
0
1
1
1
2
0
0
1
1
1
1
1
0
0
2
1
2
0
2
1
0
2
2
1
1
1
0
1
0
1
2
2
1
1
1
1
0
0
2
1
1
1
1
1
1
1
0
1
2
1
1
1
0
0
2
2
1
0
0
0
1
1
0
0
2
1
1
1
...

output:

0 416 119 370 188 90 512 827 853 106 182 315 212 387 212 132 23 589 307 701 137 396 585 472 22 759 867 927 548 932 320 714 283 439 19 390 448 530 233 236 635 334 550 766 720 681 818 663 285 60 379 342 455 884 813 477 658 615 339 221 482 658 934 765 112 873 90 479 418 242 714 973 496 199 754 231 880 ...

result:

ok Accepted

Test #27:

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

input:

985
1
1
2
1
1
0
1
0
2
0
1
0
1
1
1
1
1
1
1
1
1
0
1
1
0
1
1
0
1
2
1
2
1
1
0
0
1
1
1
1
0
2
1
1
1
2
2
2
0
1
1
0
1
1
1
2
1
2
1
2
2
1
1
2
2
1
1
1
1
0
2
1
2
2
0
2
1
1
1
1
1
1
0
1
1
1
0
0
1
1
2
1
0
1
1
0
0
0
2
1
1
0
1
1
1
2
1
1
1
1
2
2
0
1
0
1
1
2
2
1
2
1
1
1
0
1
1
1
1
0
1
1
2
2
1
1
1
1
1
0
1
2
1
1
0
1
2
2
...

output:

0 859 307 308 136 209 806 107 738 650 777 573 853 161 695 334 67 91 42 958 312 282 439 418 255 618 526 368 469 683 736 250 118 58 119 800 813 924 907 127 588 260 699 17 420 955 898 49 60 501 21 919 782 22 351 52 639 438 966 122 682 716 371 800 773 52 176 162 975 644 288 140 466 548 156 885 518 615 4...

result:

ok Accepted

Test #28:

score: 0
Accepted
time: 258ms
memory: 3768kb

input:

986
0
1
1
1
1
2
2
0
0
2
1
2
1
0
1
1
1
1
0
1
1
0
2
1
2
2
1
1
0
1
0
0
2
2
1
2
0
1
1
2
1
2
1
0
2
0
2
0
0
1
1
1
2
1
1
1
2
2
1
0
0
2
1
2
1
2
1
0
1
0
2
2
0
1
2
2
1
2
2
1
2
1
2
2
0
1
1
1
2
2
0
1
2
1
0
1
1
1
1
0
1
2
1
1
1
1
1
1
0
2
0
0
1
1
0
1
0
0
1
0
2
1
0
1
1
0
1
1
0
1
1
1
2
1
2
2
0
0
0
0
2
0
2
1
1
1
1
1
...

output:

0 96 271 758 664 424 4 871 83 454 870 975 338 565 496 812 227 437 983 857 219 240 383 972 108 185 975 383 872 916 148 86 713 419 545 92 544 548 963 328 15 548 316 54 126 513 568 55 949 266 911 870 505 10 855 613 194 545 697 79 176 844 164 889 276 411 682 521 958 360 848 675 610 865 728 735 392 11 49...

result:

ok Accepted

Test #29:

score: 0
Accepted
time: 267ms
memory: 3668kb

input:

987
0
1
1
2
1
1
0
1
0
2
1
1
2
1
0
0
0
2
1
1
0
1
0
1
2
1
2
0
0
1
2
1
2
2
1
1
0
1
0
1
0
2
0
0
1
1
1
0
1
1
1
1
1
0
0
1
1
2
2
0
0
1
1
2
0
1
1
0
1
2
0
2
0
2
2
2
1
1
1
2
1
1
1
1
1
1
0
2
1
2
1
0
0
0
1
2
1
1
0
0
1
1
1
2
2
0
1
1
1
1
2
1
0
1
2
1
1
2
2
1
2
1
1
0
0
1
1
1
2
2
1
2
2
0
0
0
1
1
1
1
2
0
0
2
2
1
1
2
...

output:

0 86 5 724 776 723 74 158 850 499 452 528 629 609 593 567 491 634 163 395 836 270 414 160 556 444 237 972 770 632 524 216 85 529 307 228 619 380 386 836 878 205 376 874 813 336 809 672 969 339 79 186 608 848 345 177 304 936 516 86 935 52 301 33 580 963 615 566 355 368 414 601 928 157 487 753 493 663...

result:

ok Accepted

Test #30:

score: 0
Accepted
time: 263ms
memory: 3920kb

input:

988
0
2
1
2
1
1
0
0
0
1
0
1
0
2
0
2
1
1
1
1
1
0
1
0
1
0
2
1
1
1
0
1
2
1
0
0
1
2
2
1
1
2
1
0
1
0
2
1
0
0
1
1
0
1
0
0
2
1
1
2
2
1
1
1
0
0
0
0
1
2
1
1
1
0
2
2
0
1
1
1
2
2
1
2
1
1
0
2
1
0
1
2
1
2
1
1
2
1
0
0
1
0
2
1
1
1
1
0
2
1
1
0
1
2
1
0
0
0
1
1
1
1
1
1
1
0
2
1
0
0
0
1
1
0
0
1
0
0
1
2
0
1
1
1
2
1
1
1
...

output:

0 820 491 194 460 106 28 923 69 782 502 211 732 287 980 572 847 673 531 557 181 372 529 940 602 407 279 159 160 804 876 634 195 379 387 214 44 414 149 660 207 210 870 498 496 421 630 903 105 720 471 834 103 560 785 705 966 623 423 137 986 310 770 193 688 717 954 291 142 662 950 897 432 391 406 927 8...

result:

ok Accepted

Test #31:

score: 0
Accepted
time: 266ms
memory: 3764kb

input:

989
0
1
1
2
1
0
0
2
1
1
0
1
2
1
1
1
1
1
1
0
2
1
2
1
1
1
1
1
1
2
1
1
0
0
1
0
1
0
2
1
1
1
2
1
0
1
0
0
1
1
2
2
1
0
0
1
1
0
1
1
2
2
1
1
1
0
2
1
1
1
1
1
0
2
1
0
1
2
0
1
1
1
1
2
1
1
1
2
1
2
1
0
0
2
1
1
1
2
1
2
1
1
1
1
1
1
1
1
1
0
2
2
1
0
0
2
0
2
0
2
1
1
1
2
0
0
1
1
1
2
2
1
2
1
2
0
0
1
2
2
2
0
1
2
2
1
1
1
...

output:

0 311 737 145 693 536 852 199 692 311 25 18 638 582 662 815 294 545 103 354 220 546 725 348 234 71 109 905 28 431 212 345 45 949 782 41 788 644 240 783 954 557 800 895 149 765 25 736 320 420 100 833 965 129 191 210 199 592 418 226 326 629 570 371 588 656 704 679 310 247 472 568 108 575 473 256 351 7...

result:

ok Accepted

Test #32:

score: 0
Accepted
time: 255ms
memory: 3664kb

input:

990
1
2
2
0
0
1
1
0
0
1
1
1
1
0
2
2
1
0
2
1
0
0
1
1
1
2
1
0
1
1
1
1
1
0
1
1
1
0
0
1
1
2
2
1
0
1
1
0
0
1
1
2
0
1
1
0
2
1
0
2
2
1
1
2
1
2
0
1
1
2
1
2
1
0
0
0
1
0
2
1
2
0
1
1
0
1
1
1
2
0
0
1
1
1
1
1
0
1
0
1
0
1
1
1
2
2
2
2
2
0
2
2
1
2
1
1
1
1
2
2
2
1
1
1
1
0
2
2
1
0
1
0
0
1
2
1
2
2
0
1
1
0
1
1
0
1
0
0
...

output:

0 524 737 568 476 24 566 947 733 70 2 933 338 501 620 294 797 241 847 773 947 792 9 358 430 423 711 243 374 488 506 330 613 253 499 690 868 74 647 212 143 250 154 82 750 375 968 159 615 426 931 174 227 542 531 657 964 843 501 347 932 16 676 555 268 777 846 737 850 104 948 595 946 703 676 705 88 255 ...

result:

ok Accepted

Test #33:

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

input:

991
0
2
1
1
2
1
0
0
0
0
1
1
1
2
1
0
1
0
1
1
1
2
1
1
2
2
2
2
1
1
2
1
1
1
1
2
1
1
0
1
1
0
0
0
2
1
2
1
0
2
1
1
1
2
1
2
0
1
1
2
0
0
0
1
1
2
1
0
1
0
1
2
1
1
0
1
0
0
1
2
2
1
1
2
0
0
2
1
1
1
1
2
1
1
1
2
1
1
2
0
1
0
1
1
0
1
1
1
0
2
1
1
2
2
0
1
1
1
2
1
0
0
1
0
1
2
2
0
2
0
2
0
1
1
0
2
2
2
1
2
1
0
2
1
2
0
2
2
...

output:

0 459 485 463 788 537 155 194 180 56 427 971 814 38 848 976 365 743 775 823 374 119 357 970 190 472 100 149 207 963 767 583 899 261 523 173 275 677 367 923 732 271 902 32 308 236 486 151 978 738 973 830 856 808 808 55 288 385 672 494 825 447 85 733 707 86 383 459 762 227 390 972 967 769 12 283 14 96...

result:

ok Accepted

Test #34:

score: 0
Accepted
time: 266ms
memory: 3896kb

input:

992
0
1
2
1
0
0
0
2
1
2
2
1
1
2
2
0
0
2
1
2
1
0
2
1
0
2
0
1
1
1
1
0
1
2
2
1
1
1
1
2
1
2
1
2
0
2
1
1
0
0
1
2
1
0
1
2
1
1
1
2
2
1
0
1
1
1
2
1
2
1
1
1
0
1
1
1
1
2
1
1
2
2
0
1
0
0
2
0
1
1
1
1
2
1
1
1
2
1
2
2
0
0
1
1
1
0
0
1
1
2
1
1
2
0
1
2
1
1
0
0
2
2
0
1
0
1
2
1
2
1
0
1
2
0
2
1
0
1
2
1
1
2
1
0
2
1
1
1
...

output:

0 104 967 810 628 82 608 907 13 266 302 123 76 179 348 868 967 61 867 501 473 508 777 200 494 215 251 623 516 852 992 106 891 967 851 462 984 466 377 932 731 614 62 742 792 345 554 703 405 364 211 814 871 924 21 373 146 207 931 661 2 930 766 893 904 561 298 831 34 610 770 701 168 767 450 959 120 939...

result:

ok Accepted

Test #35:

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

input:

993
0
0
2
2
0
0
1
0
2
0
0
2
1
1
0
1
0
0
2
2
1
2
2
2
1
1
1
1
2
0
1
1
2
2
1
2
2
0
1
0
1
1
1
1
1
0
1
1
1
1
2
0
1
0
2
0
0
2
1
1
2
1
0
1
1
1
1
2
1
2
1
1
0
0
1
1
1
0
1
1
1
0
1
1
1
2
1
0
2
1
2
0
1
1
1
2
2
2
2
1
2
1
2
1
2
0
1
1
1
1
2
1
1
1
1
0
0
2
1
2
1
1
0
0
1
0
2
2
0
1
1
1
1
2
0
1
0
2
1
1
2
2
1
1
0
1
1
0
...

output:

0 440 194 607 977 630 932 107 223 697 611 366 98 921 104 948 608 169 121 797 245 969 273 28 340 642 168 672 308 140 185 876 577 379 487 558 13 425 665 233 128 280 598 223 207 699 176 813 867 294 616 117 269 887 144 609 535 309 285 842 446 469 724 30 847 216 585 857 640 254 96 766 532 691 988 738 397...

result:

ok Accepted

Test #36:

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

input:

994
1
1
1
1
1
2
1
0
1
0
1
1
2
0
0
2
0
1
2
1
1
1
1
1
2
1
0
0
1
0
1
2
0
1
1
1
2
1
1
0
1
1
0
0
2
0
1
1
2
1
2
1
2
1
1
0
1
0
1
2
1
1
1
1
0
0
2
1
1
0
1
1
0
1
1
0
2
2
1
0
1
0
1
0
0
0
1
2
0
1
2
2
2
1
2
0
1
1
0
1
1
2
1
2
2
0
2
0
1
1
1
1
2
2
2
1
2
0
1
0
2
1
1
1
1
1
1
2
1
1
1
1
1
1
1
2
2
1
1
2
2
1
0
2
1
1
1
2
...

output:

0 464 145 836 832 184 130 767 801 352 354 703 874 273 110 210 267 67 513 717 675 508 827 454 710 759 839 293 574 800 328 902 939 473 419 452 332 548 225 808 899 254 516 454 526 301 340 469 367 528 191 718 41 694 177 751 458 691 719 37 172 52 938 117 524 39 244 531 586 144 344 167 74 535 620 599 836 ...

result:

ok Accepted

Test #37:

score: 0
Accepted
time: 260ms
memory: 3728kb

input:

995
1
0
1
1
2
2
1
1
2
1
2
1
1
1
0
1
2
0
0
1
1
0
2
2
1
2
1
1
0
0
1
1
1
1
0
0
1
2
2
0
2
0
0
1
1
1
2
0
1
1
1
1
1
2
2
0
0
2
0
1
1
1
1
1
0
0
1
0
1
1
1
1
2
0
0
1
1
1
0
0
1
1
1
2
0
2
1
1
2
1
0
1
0
0
0
0
2
1
0
1
1
0
2
1
1
2
0
1
1
1
1
0
1
2
1
2
1
1
0
0
0
1
1
2
1
0
1
1
1
1
1
1
2
2
1
1
1
0
1
1
2
1
2
1
1
1
1
0
...

output:

0 164 817 493 181 719 186 897 743 220 517 133 408 216 360 629 927 741 47 258 762 117 449 483 600 563 271 478 319 833 426 175 973 248 644 135 943 829 37 667 53 530 799 437 745 140 48 654 880 71 911 624 187 342 111 787 904 358 246 227 172 671 401 150 918 27 261 842 855 274 513 885 781 293 326 530 433 ...

result:

ok Accepted

Test #38:

score: 0
Accepted
time: 262ms
memory: 3680kb

input:

996
1
3
1
0
2
2
0
1
1
1
2
1
1
1
0
1
1
2
1
1
1
2
1
0
0
0
1
2
0
1
0
2
1
2
0
0
0
1
1
2
2
1
2
1
0
1
1
0
2
2
1
2
0
1
1
1
1
2
2
1
0
2
0
0
0
1
0
2
1
1
1
2
1
2
1
1
1
1
1
0
1
1
1
2
1
2
0
0
1
1
0
1
0
0
1
0
1
0
1
1
2
1
2
1
1
1
0
1
2
1
1
2
0
2
1
1
0
1
1
1
0
0
2
1
2
2
0
1
2
2
1
2
1
1
1
2
2
2
0
0
1
1
2
1
0
1
0
2
...

output:

0 524 215 562 8 234 104 491 37 298 98 639 680 747 848 204 587 193 703 413 497 792 129 112 994 51 447 231 536 224 476 678 667 691 163 594 844 266 89 800 563 106 442 166 852 213 290 363 405 912 775 822 707 824 933 705 874 303 855 413 446 334 94 117 28 177 630 791 442 638 594 925 664 955 94 519 172 303...

result:

ok Accepted

Test #39:

score: 0
Accepted
time: 262ms
memory: 3756kb

input:

997
0
1
0
2
2
1
1
1
0
1
2
1
1
1
2
2
1
2
1
1
1
1
1
0
1
1
0
0
0
2
1
2
1
1
0
0
1
0
2
0
1
1
2
0
1
1
1
0
1
1
1
1
1
1
2
0
0
0
2
1
1
1
1
1
1
2
1
1
2
0
1
2
1
1
2
0
1
1
2
0
2
2
2
0
1
0
0
1
2
0
1
0
1
2
0
2
1
1
2
0
0
2
1
1
2
0
1
1
1
0
1
1
1
0
1
1
2
0
1
2
0
0
0
1
1
1
1
0
1
1
1
1
2
2
0
0
1
1
0
2
1
1
0
1
0
1
2
1
...

output:

0 538 324 37 304 708 878 540 665 583 85 224 687 866 571 914 229 405 481 185 868 542 861 335 886 217 367 546 228 952 475 414 9 799 964 826 26 844 369 207 429 967 430 632 835 517 66 581 921 63 765 309 604 146 643 493 362 526 555 589 994 32 5 6 830 486 348 372 332 233 578 278 717 524 909 554 44 491 651...

result:

ok Accepted

Test #40:

score: 0
Accepted
time: 280ms
memory: 3664kb

input:

998
0
0
1
2
1
1
1
1
1
1
1
0
2
1
1
1
2
2
1
1
1
1
2
1
1
1
0
2
2
1
1
1
1
0
2
2
2
1
1
1
1
0
1
1
1
0
2
1
0
2
1
0
1
0
1
0
2
2
2
2
1
0
0
2
1
0
2
1
2
1
2
1
1
0
2
1
1
0
2
0
2
1
0
1
0
1
0
0
2
1
1
0
0
2
1
1
2
1
0
2
2
0
1
1
0
0
1
0
2
0
1
0
1
0
1
0
1
0
0
1
1
1
1
2
2
1
1
2
1
1
1
1
2
1
1
1
1
0
1
2
1
2
1
2
2
0
2
0
...

output:

0 194 143 902 62 136 512 43 625 74 472 875 420 567 518 754 839 373 367 569 871 362 649 154 264 63 25 425 390 14 420 372 983 563 53 822 476 564 865 878 637 116 754 834 682 51 368 301 423 512 869 74 873 298 227 139 360 29 341 749 818 760 122 803 324 951 404 577 516 48 456 931 940 987 766 623 40 911 70...

result:

ok Accepted

Test #41:

score: 0
Accepted
time: 281ms
memory: 3660kb

input:

999
0
1
2
0
1
2
1
2
0
2
0
1
1
0
1
1
1
1
0
1
1
2
1
1
1
1
2
2
1
1
2
1
2
2
0
2
0
0
0
0
1
1
0
1
1
1
1
1
1
1
0
2
1
1
2
0
0
2
2
0
0
0
1
2
2
2
1
0
1
2
0
1
1
1
0
1
1
0
0
1
0
0
0
0
0
1
2
1
0
0
1
1
1
2
1
1
1
1
1
1
1
0
2
1
1
0
2
0
2
1
0
1
2
2
1
0
1
2
2
2
0
1
1
1
1
0
2
1
0
1
1
1
0
1
0
2
1
2
2
1
1
1
0
1
1
1
1
1
...

output:

0 479 665 154 269 501 998 992 904 763 254 591 869 843 683 708 410 88 352 566 497 252 486 565 115 585 414 864 23 389 308 546 586 973 418 573 193 416 566 815 179 538 406 766 381 807 194 510 894 264 76 111 515 281 675 630 865 807 213 887 914 520 433 501 493 570 792 404 985 77 219 883 334 343 649 714 15...

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed