QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#598865#9432. Permutationucup-team5101#AC ✓333ms4172kbC++144.2kb2024-09-28 23:47:002024-09-28 23:47:00

详细

Test #1:

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

input:

5
1
1
1
0
0
1
0
2
0

output:

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

result:

ok Accepted

Test #2:

score: 0
Accepted
time: 333ms
memory: 4168kb

input:

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

output:

0 363 515 540 740 970 651 461 773 892 426 438 886 677 631 731 652 984 82 467 456 673 922 752 843 990 918 261 491 156 536 762 319 372 578 977 184 322 280 504 449 511 715 97 254 912 917 11 224 30 294 960 499 919 165 727 560 972 265 861 962 337 198 959 238 75 328 846 581 331 496 847 214 761 464 87 478 ...

result:

ok Accepted

Test #3:

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

input:

1

output:

1 1

result:

ok Accepted

Test #4:

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

input:

2
2
0
2

output:

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

result:

ok Accepted

Test #5:

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

input:

3
1
0
1
1
2

output:

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

result:

ok Accepted

Test #6:

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

input:

4
0
1
1
0
0

output:

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

result:

ok Accepted

Test #7:

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

input:

6
0
2
1
0
1
1
1
1
2
0

output:

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

result:

ok Accepted

Test #8:

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

input:

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

output:

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

result:

ok Accepted

Test #9:

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

input:

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

output:

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

result:

ok Accepted

Test #10:

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

input:

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

output:

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

result:

ok Accepted

Test #11:

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

input:

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

output:

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

result:

ok Accepted

Test #12:

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

input:

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

output:

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

result:

ok Accepted

Test #13:

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

input:

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

output:

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

result:

ok Accepted

Test #14:

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

input:

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

output:

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

result:

ok Accepted

Test #15:

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

input:

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

output:

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

result:

ok Accepted

Test #16:

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

input:

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

output:

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

result:

ok Accepted

Test #17:

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

input:

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

output:

0 861 588 170 565 183 961 606 279 207 773 118 753 793 259 281 725 369 112 323 131 411 445 726 523 461 225 706 98 222 138 933 53 4 393 154 873 822 541 662 542 362 528 948 44 566 109 43 819 538 9 845 875 400 155 397 483 376 354 915 409 384 217 968 201 591 519 802 273 377 252 17 345 200 695 652 330 390...

result:

ok Accepted

Test #18:

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

input:

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

output:

0 499 456 379 587 779 168 124 663 199 485 201 213 217 481 885 939 479 459 172 43 489 771 872 233 968 329 518 95 492 475 598 549 163 305 591 24 222 890 103 48 912 721 808 390 9 44 878 279 919 635 673 304 39 693 571 296 174 880 708 595 131 540 112 63 237 488 948 937 423 119 139 286 846 529 272 711 943...

result:

ok Accepted

Test #19:

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

input:

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

output:

0 245 871 846 323 236 225 631 40 132 937 233 273 392 712 924 488 838 411 6 583 102 451 544 117 518 475 929 209 510 509 885 504 589 276 710 975 18 34 901 916 472 911 362 918 250 642 768 700 464 839 380 116 124 756 326 417 514 403 364 342 28 114 421 181 173 2 781 684 322 422 237 22 936 909 563 131 390...

result:

ok Accepted

Test #20:

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

input:

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

output:

0 801 221 793 704 481 242 166 22 131 606 674 388 27 953 15 497 135 651 709 587 256 82 851 451 897 642 567 658 524 368 24 961 902 86 858 872 338 974 355 176 517 763 771 777 936 557 954 632 324 17 854 378 321 239 90 412 773 876 907 464 398 147 55 250 715 845 283 491 358 679 431 631 437 591 967 150 449...

result:

ok Accepted

Test #21:

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

input:

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

output:

0 119 725 898 17 899 889 636 917 595 888 439 85 279 801 685 744 12 80 650 117 333 854 509 844 458 159 969 599 676 654 712 66 960 972 687 587 339 497 325 503 226 376 100 73 501 558 951 771 139 551 575 640 770 4 315 65 408 858 498 571 396 971 309 734 631 241 521 884 617 15 62 471 879 836 519 406 620 4...

result:

ok Accepted

Test #22:

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

input:

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

output:

0 183 29 579 408 363 472 873 968 564 33 694 524 728 570 154 532 603 864 257 964 715 349 606 379 343 620 446 53 101 315 403 91 31 785 645 665 764 690 677 695 247 783 165 186 80 494 583 190 610 112 296 767 611 547 289 862 92 241 104 126 345 38 464 466 287 891 879 789 383 960 152 809 724 559 337 973 66...

result:

ok Accepted

Test #23:

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

input:

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

output:

0 680 336 698 561 616 89 398 651 571 413 388 628 850 349 149 161 673 385 700 920 5 134 936 105 949 975 694 121 944 150 457 570 397 611 281 678 172 205 234 433 428 13 377 2 448 19 758 804 526 664 305 924 260 40 687 355 696 635 542 777 922 567 603 106 861 720 898 462 6 640 34 251 475 607 813 92 278 71...

result:

ok Accepted

Test #24:

score: 0
Accepted
time: 302ms
memory: 3840kb

input:

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

output:

0 428 699 504 952 426 321 406 385 475 110 152 610 513 739 937 167 441 869 623 716 793 633 598 841 150 74 166 223 828 596 711 7 291 402 508 622 876 587 107 658 85 678 626 140 501 833 325 102 413 619 424 359 544 740 682 109 365 870 693 691 27 539 862 175 603 125 414 723 588 938 575 43 336 181 909 380 ...

result:

ok Accepted

Test #25:

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

input:

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

output:

0 782 203 924 600 699 888 766 371 700 890 845 107 978 926 645 651 370 458 609 171 30 180 350 201 217 847 694 550 836 954 914 475 7 784 16 88 539 692 434 23 736 614 429 341 118 629 654 353 388 876 820 925 268 829 262 726 258 438 383 898 788 450 89 368 507 147 331 298 557 521 868 929 348 641 639 979 1...

result:

ok Accepted

Test #26:

score: 0
Accepted
time: 298ms
memory: 4156kb

input:

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

output:

0 239 978 159 933 723 5 588 656 353 824 666 198 652 881 834 924 360 169 211 295 433 322 768 379 974 517 213 314 772 510 774 36 109 259 954 50 287 623 469 14 788 798 553 839 783 741 96 485 223 950 885 257 917 693 351 330 984 140 605 814 377 574 701 154 458 186 216 813 540 424 514 919 57 438 823 694 1...

result:

ok Accepted

Test #27:

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

input:

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

output:

0 742 49 263 807 679 637 390 24 344 22 338 704 164 426 624 282 83 703 720 834 248 853 239 40 266 780 836 369 408 537 495 956 238 644 527 842 810 701 279 623 532 303 35 212 741 789 571 421 955 486 27 52 432 262 173 482 9 348 396 755 120 172 54 873 964 951 132 440 757 949 779 224 790 453 347 894 665 9...

result:

ok Accepted

Test #28:

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

input:

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

output:

0 412 620 658 96 740 707 945 919 417 621 18 479 636 859 27 163 494 430 758 204 767 642 421 224 524 85 259 886 597 36 875 101 939 848 212 904 371 413 216 485 378 544 800 529 175 710 269 796 604 405 54 99 468 219 65 754 442 300 746 309 289 429 820 601 406 267 305 555 914 121 194 317 840 87 982 428 702...

result:

ok Accepted

Test #29:

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

input:

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

output:

0 235 758 478 272 374 228 613 421 225 733 46 662 773 114 22 450 876 840 540 500 282 147 111 541 820 539 710 849 26 647 542 577 311 79 246 724 512 403 123 803 848 846 364 266 297 799 786 966 526 536 503 519 881 878 241 553 387 487 888 832 60 559 159 291 841 45 61 495 410 961 629 868 593 170 457 595 6...

result:

ok Accepted

Test #30:

score: 0
Accepted
time: 307ms
memory: 3900kb

input:

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

output:

0 709 264 457 494 59 433 76 128 783 575 773 911 451 61 630 333 889 259 944 795 863 253 915 334 505 155 349 695 242 954 870 674 862 498 72 821 114 967 275 570 949 151 696 448 461 21 381 456 562 58 219 409 327 267 762 265 143 245 813 983 436 202 729 807 912 178 789 683 963 865 864 1 597 315 831 431 60...

result:

ok Accepted

Test #31:

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

input:

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

output:

0 394 383 576 606 418 85 55 898 494 505 886 195 420 131 408 273 621 947 438 918 910 751 836 54 705 369 881 149 712 565 927 855 884 43 747 506 627 870 754 673 79 762 694 728 636 549 510 36 246 69 359 392 868 181 496 603 970 645 344 107 678 318 770 356 194 378 28 498 672 415 82 12 209 791 643 112 274 ...

result:

ok Accepted

Test #32:

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

input:

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

output:

0 156 458 389 621 51 226 560 524 298 718 699 802 831 412 262 959 40 99 697 725 137 178 476 483 453 522 867 734 250 140 86 174 425 549 961 872 368 840 676 662 990 683 857 341 482 565 494 358 26 435 87 694 614 257 551 76 488 854 649 567 45 782 895 367 864 120 457 841 902 168 706 720 386 308 215 244 28...

result:

ok Accepted

Test #33:

score: 0
Accepted
time: 302ms
memory: 3952kb

input:

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

output:

0 926 413 899 954 904 45 216 930 847 502 695 506 752 188 219 821 131 224 371 631 304 307 586 601 31 977 355 102 84 95 698 918 205 229 624 544 374 72 441 451 302 549 656 532 293 399 58 440 265 19 180 76 966 897 951 947 280 527 246 166 468 644 786 30 64 41 327 401 38 708 127 94 13 516 919 204 152 874 ...

result:

ok Accepted

Test #34:

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

input:

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

output:

0 429 556 833 489 95 590 141 851 412 298 699 285 722 898 821 593 106 235 446 828 570 433 888 89 825 629 982 723 181 410 207 713 691 384 790 921 277 238 814 378 389 884 479 615 881 216 322 496 458 159 259 115 434 702 295 401 33 254 632 461 741 414 527 53 798 91 300 161 76 760 696 444 304 464 469 35 3...

result:

ok Accepted

Test #35:

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

input:

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

output:

0 184 873 152 517 758 311 336 451 291 578 588 83 509 387 527 659 23 443 492 982 166 833 86 407 309 392 287 172 359 489 510 963 700 120 612 691 433 563 322 606 906 32 637 425 807 91 467 862 244 426 792 378 848 874 323 818 923 30 885 766 410 931 429 673 845 63 930 396 274 482 278 791 198 828 46 558 33...

result:

ok Accepted

Test #36:

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

input:

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

output:

0 984 576 950 125 966 247 778 244 480 115 353 774 603 378 624 386 699 672 864 68 214 419 327 110 209 346 118 943 578 664 10 1 402 28 224 678 671 989 788 894 426 366 352 948 271 818 635 958 48 935 809 448 265 373 690 791 134 666 846 468 358 766 805 586 85 831 573 610 962 676 560 585 630 450 367 988 2...

result:

ok Accepted

Test #37:

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

input:

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

output:

0 854 970 88 186 190 401 644 473 568 273 577 580 820 916 195 523 239 834 856 877 699 106 631 417 465 244 249 782 656 755 157 435 15 750 131 300 385 643 101 354 120 529 798 12 396 677 846 137 59 511 591 373 937 135 690 34 700 122 382 595 477 888 164 744 725 504 639 180 645 612 267 85 55 331 979 747 8...

result:

ok Accepted

Test #38:

score: 0
Accepted
time: 286ms
memory: 4152kb

input:

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

output:

0 400 837 272 882 460 25 410 827 679 620 743 576 213 104 564 403 995 641 933 615 131 293 518 478 527 159 688 741 593 577 668 87 906 358 98 279 411 660 227 228 531 232 729 940 24 219 852 231 639 737 168 609 748 924 462 963 988 86 540 744 499 64 746 943 423 661 372 786 608 886 581 636 829 49 241 438 6...

result:

ok Accepted

Test #39:

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

input:

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

output:

0 225 582 576 496 431 429 289 919 585 470 414 884 365 295 172 886 390 725 243 782 803 561 231 213 72 396 862 6 488 904 630 122 992 46 363 685 556 405 434 614 917 340 195 473 859 36 856 320 161 579 621 551 678 721 350 224 838 971 906 578 374 91 220 890 334 419 362 30 876 987 715 187 151 935 444 978 6...

result:

ok Accepted

Test #40:

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

input:

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

output:

0 41 545 739 899 801 414 53 776 425 551 840 125 712 630 758 897 183 528 820 23 677 318 366 301 432 245 395 378 606 376 849 17 734 548 342 275 994 56 571 310 720 560 111 816 224 848 995 907 95 175 578 329 227 369 508 762 360 316 303 359 951 726 685 973 692 693 460 94 230 884 238 458 683 966 445 67 89...

result:

ok Accepted

Test #41:

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

input:

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

output:

0 105 639 612 686 852 547 550 844 252 883 194 970 532 12 840 956 284 174 144 24 325 343 882 966 761 533 493 803 476 214 819 426 368 164 659 205 796 334 283 82 556 544 635 972 520 83 694 51 896 728 260 390 817 345 233 452 610 849 920 907 490 261 971 765 969 572 531 772 116 234 671 59 629 542 710 644 ...

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed