QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#597029#9432. Permutationucup-team159#AC ✓316ms3920kbC++234.5kb2024-09-28 16:54:372024-09-28 16:54:42

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3496kb

input:

5
3
2
0
2
0
0
0
2
0
2

output:

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

result:

ok Accepted

Test #2:

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

input:

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

output:

0 296 248 941 173 146 372 289 435 621 23 600 865 655 402 738 419 833 162 754 633 508 676 666 266 261 548 643 363 779 245 772 827 331 575 563 899 950 22 26 430 602 971 708 473 349 239 945 366 542 649 137 308 539 124 619 200 187 850 188 657 680 13 660 459 300 573 700 393 260 946 848 84 987 457 675 241...

result:

ok Accepted

Test #3:

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

input:

1

output:

1 1

result:

ok Accepted

Test #4:

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

input:

2
0
0

output:

0 1 2
0 1 2
1 2 1

result:

ok Accepted

Test #5:

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

input:

3
0
1
1
0
0

output:

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

result:

ok Accepted

Test #6:

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

input:

4
0
2
0
2
0

output:

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

result:

ok Accepted

Test #7:

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

input:

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

output:

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

result:

ok Accepted

Test #8:

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

input:

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

output:

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

result:

ok Accepted

Test #9:

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

input:

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

output:

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

result:

ok Accepted

Test #10:

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

input:

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

output:

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

result:

ok Accepted

Test #11:

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

input:

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

output:

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

result:

ok Accepted

Test #12:

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

input:

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

output:

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

result:

ok Accepted

Test #13:

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

input:

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

output:

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

result:

ok Accepted

Test #14:

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

input:

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

output:

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

result:

ok Accepted

Test #15:

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

input:

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

output:

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

result:

ok Accepted

Test #16:

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

input:

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

output:

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

result:

ok Accepted

Test #17:

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

input:

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

output:

0 971 932 600 637 319 223 1 610 166 369 859 681 438 772 139 291 200 90 12 136 751 649 732 142 431 683 119 232 513 228 874 300 787 478 702 742 870 390 880 619 197 46 337 542 255 59 554 233 219 275 318 873 904 660 698 852 312 408 668 736 774 39 765 89 92 729 267 122 53 237 94 692 225 206 81 699 372 26...

result:

ok Accepted

Test #18:

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

input:

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

output:

0 251 396 707 512 241 935 172 941 449 507 633 278 153 369 675 316 214 124 740 841 421 618 128 860 836 436 827 66 844 129 191 149 508 391 954 53 803 751 228 257 846 139 461 111 444 30 28 127 551 729 2 418 326 515 944 678 378 361 184 186 958 733 719 554 372 424 788 830 964 226 374 536 660 311 147 454 ...

result:

ok Accepted

Test #19:

score: 0
Accepted
time: 293ms
memory: 3608kb

input:

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

output:

0 704 610 461 281 246 204 33 440 464 322 51 138 518 536 730 804 530 8 511 439 771 25 202 824 632 517 134 660 685 688 565 767 379 831 242 481 468 247 241 803 802 126 970 840 61 887 135 758 186 763 734 969 479 720 751 19 34 703 561 878 689 127 262 50 661 710 141 818 974 757 665 695 537 211 733 864 74 ...

result:

ok Accepted

Test #20:

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

input:

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

output:

0 577 949 866 434 680 958 3 232 648 13 713 924 801 519 132 594 109 535 353 845 576 853 602 655 307 145 831 896 736 214 522 959 834 496 674 450 690 228 839 404 248 899 381 773 961 62 153 243 817 469 838 321 620 671 920 725 205 408 136 193 814 922 387 660 556 246 844 693 234 304 640 82 64 50 414 508 5...

result:

ok Accepted

Test #21:

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

input:

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

output:

0 978 859 976 132 113 281 94 6 40 493 350 846 335 894 719 363 176 966 106 466 577 943 713 888 133 843 854 820 838 712 314 777 380 12 495 95 910 951 90 170 615 701 323 751 906 768 326 774 295 53 568 30 475 655 229 662 741 403 612 257 188 856 455 625 357 111 558 438 773 223 674 861 186 748 263 702 214...

result:

ok Accepted

Test #22:

score: 0
Accepted
time: 277ms
memory: 3608kb

input:

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

output:

0 776 69 64 168 910 861 135 75 91 774 887 851 825 763 953 620 439 959 489 349 974 746 591 213 314 931 715 287 101 571 980 149 656 262 452 284 442 214 481 866 978 47 385 544 196 513 917 236 224 131 506 690 708 618 368 633 850 615 414 582 842 661 247 588 833 181 87 937 156 925 436 362 238 277 939 222 ...

result:

ok Accepted

Test #23:

score: 0
Accepted
time: 297ms
memory: 3856kb

input:

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

output:

0 913 692 977 908 198 376 592 442 264 445 534 878 209 503 871 959 712 151 208 177 148 739 270 703 659 551 122 476 824 256 206 119 88 416 233 123 29 212 388 945 189 731 586 18 539 223 935 896 764 579 919 287 363 597 842 515 449 667 160 356 491 164 453 266 354 819 25 81 517 40 653 774 598 398 169 53 2...

result:

ok Accepted

Test #24:

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

input:

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

output:

0 822 858 738 285 198 967 331 466 384 88 10 627 575 233 522 554 779 586 567 941 270 658 717 158 769 57 128 260 185 454 206 51 381 91 411 232 143 711 631 730 806 234 175 134 829 448 184 246 303 712 878 257 513 315 302 125 797 633 647 584 272 587 358 410 310 103 228 17 604 901 862 982 510 169 121 746 ...

result:

ok Accepted

Test #25:

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

input:

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

output:

0 885 666 927 880 789 463 53 278 179 186 624 299 741 84 348 215 623 815 818 447 355 429 814 472 260 379 792 378 392 219 661 844 108 807 128 575 946 769 297 520 484 87 461 929 728 563 478 616 909 585 790 914 24 817 760 692 346 597 967 147 130 90 750 647 801 816 959 791 483 705 611 779 281 234 948 37 ...

result:

ok Accepted

Test #26:

score: 0
Accepted
time: 311ms
memory: 3884kb

input:

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

output:

0 659 27 698 222 584 658 193 2 452 310 350 890 37 826 347 9 616 654 240 553 325 349 74 372 756 84 145 602 324 811 335 907 640 302 964 564 555 706 116 11 104 435 481 621 16 148 955 637 495 692 505 336 221 737 729 59 747 362 365 617 473 286 635 508 458 50 669 772 301 439 167 677 486 219 265 69 245 576...

result:

ok Accepted

Test #27:

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

input:

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

output:

0 605 370 483 137 547 546 805 918 725 912 413 40 915 631 8 170 91 858 641 602 327 344 381 233 158 698 564 734 916 20 735 690 169 320 234 802 257 702 264 541 464 569 390 612 644 770 884 47 423 400 224 207 686 759 302 103 876 187 561 773 345 407 443 737 227 300 627 330 167 621 816 256 436 317 323 202 ...

result:

ok Accepted

Test #28:

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

input:

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

output:

0 14 831 619 129 545 690 905 819 206 157 506 485 800 214 698 433 561 40 669 980 635 610 783 568 625 7 302 252 170 856 591 255 215 218 575 825 228 6 611 70 888 684 699 360 861 880 656 648 872 298 617 313 686 490 53 481 586 971 351 361 303 265 636 590 979 876 629 712 99 865 516 843 73 465 87 3 592 725...

result:

ok Accepted

Test #29:

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

input:

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

output:

0 385 59 329 548 518 678 222 172 824 457 212 137 987 265 580 836 327 126 176 92 734 37 463 541 444 17 183 702 85 945 838 230 557 840 18 192 864 964 698 412 539 874 677 681 796 78 894 506 104 427 716 954 937 706 882 367 34 841 90 859 690 335 334 522 418 231 406 470 249 536 254 97 387 441 867 588 107 ...

result:

ok Accepted

Test #30:

score: 0
Accepted
time: 310ms
memory: 3608kb

input:

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

output:

0 330 734 518 281 909 176 930 569 691 906 912 472 843 671 680 774 468 610 221 958 311 423 686 184 233 306 495 118 728 698 655 548 255 158 782 412 182 528 898 540 498 892 157 522 358 787 317 753 617 598 576 833 438 130 484 966 125 908 56 298 662 956 487 8 147 988 737 120 6 877 418 38 931 43 629 801 1...

result:

ok Accepted

Test #31:

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

input:

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

output:

0 876 557 239 87 73 975 949 10 811 270 664 172 1 747 653 173 160 769 99 231 315 677 535 601 110 903 862 890 265 258 276 591 195 849 225 15 143 466 509 194 632 612 901 381 211 446 730 243 298 464 420 574 502 95 969 98 92 970 899 796 775 190 116 505 82 542 806 627 327 145 471 435 75 419 916 732 303 44...

result:

ok Accepted

Test #32:

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

input:

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

output:

0 656 52 619 357 811 398 506 374 697 263 784 844 727 297 28 640 47 652 164 77 384 553 208 391 695 43 340 742 484 481 387 986 498 11 438 258 69 350 772 161 217 316 852 146 564 677 792 869 268 138 935 834 439 790 858 743 116 820 414 145 486 706 48 33 942 23 577 214 658 711 94 908 509 284 868 174 930 7...

result:

ok Accepted

Test #33:

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

input:

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

output:

0 431 444 817 887 680 379 904 932 134 277 980 495 807 905 139 119 346 771 90 163 186 105 688 130 519 520 32 583 436 328 830 343 606 104 348 652 650 778 107 859 179 102 482 549 6 109 802 609 453 380 472 767 686 820 264 458 324 92 515 912 148 58 923 665 574 9 363 41 30 255 83 756 31 656 718 944 902 62...

result:

ok Accepted

Test #34:

score: 0
Accepted
time: 308ms
memory: 3600kb

input:

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

output:

0 374 236 960 110 723 680 174 560 367 176 956 690 789 329 673 448 961 969 880 271 911 871 886 846 745 539 148 605 532 983 724 300 327 219 782 588 684 831 420 206 12 774 255 929 711 198 565 101 590 485 528 47 357 743 217 963 919 891 593 933 735 630 797 948 687 720 224 710 965 194 371 195 830 136 338 ...

result:

ok Accepted

Test #35:

score: 0
Accepted
time: 294ms
memory: 3856kb

input:

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

output:

0 611 899 872 240 788 163 607 972 724 904 314 247 459 829 894 358 517 293 419 601 633 415 431 782 916 192 400 580 466 499 241 544 51 955 222 269 569 487 489 963 35 650 289 295 793 158 658 697 744 301 944 494 508 888 703 255 276 98 386 747 779 64 195 937 511 761 282 161 227 755 967 691 388 96 987 977...

result:

ok Accepted

Test #36:

score: 0
Accepted
time: 294ms
memory: 3716kb

input:

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

output:

0 372 724 558 487 830 439 692 447 219 29 982 837 425 442 8 407 787 875 512 292 326 370 852 103 318 961 528 813 346 986 811 653 303 757 245 342 231 727 469 706 450 884 635 579 492 851 576 611 188 604 4 361 482 595 287 533 594 778 922 160 506 755 433 650 59 669 521 827 299 619 547 765 581 584 704 686 ...

result:

ok Accepted

Test #37:

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

input:

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

output:

0 3 922 167 132 846 224 17 85 986 162 816 197 244 673 731 33 42 734 865 618 96 352 880 812 649 71 419 150 38 537 910 876 205 220 836 475 307 701 243 255 385 342 183 740 565 189 319 917 227 675 190 942 240 474 867 725 780 790 644 995 464 944 641 904 103 882 484 637 897 173 566 259 209 639 938 868 689...

result:

ok Accepted

Test #38:

score: 0
Accepted
time: 301ms
memory: 3684kb

input:

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

output:

0 357 443 809 633 15 417 641 210 35 942 264 773 753 908 960 988 520 469 851 278 449 136 467 16 911 226 962 801 822 532 338 945 329 90 500 583 463 512 404 983 805 797 92 898 488 560 221 45 359 152 26 836 150 608 421 913 750 669 172 862 103 220 581 21 770 785 280 900 495 179 324 937 642 892 690 757 84...

result:

ok Accepted

Test #39:

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

input:

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

output:

0 951 969 208 60 920 7 852 681 173 485 943 340 794 574 56 235 317 309 223 229 496 903 24 541 871 277 283 398 291 58 522 289 940 885 116 614 829 606 82 39 607 252 366 663 595 799 72 121 568 345 275 758 368 476 759 791 282 123 807 696 11 94 295 962 222 182 139 848 742 67 294 684 604 824 328 751 664 53...

result:

ok Accepted

Test #40:

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

input:

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

output:

0 128 360 452 557 40 949 259 763 173 778 647 491 746 855 891 768 503 608 424 129 410 639 342 336 43 426 576 852 521 74 333 745 968 930 517 171 931 246 946 984 659 309 750 214 854 51 844 225 24 696 392 148 236 298 692 462 660 523 747 528 81 149 749 179 384 650 109 759 756 758 785 251 787 564 613 365 ...

result:

ok Accepted

Test #41:

score: 0
Accepted
time: 306ms
memory: 3852kb

input:

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

output:

0 147 696 938 893 222 623 154 242 585 437 271 196 731 856 547 514 713 346 410 593 800 685 378 929 310 85 179 816 5 904 733 778 16 509 473 917 828 803 441 447 906 402 608 852 296 788 777 214 436 400 206 606 67 340 96 549 684 714 678 890 669 248 668 305 269 370 712 896 171 494 255 756 946 604 746 704 ...

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed