QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#598513#9432. Permutationucup-team3602#AC ✓292ms4172kbC++172.3kb2024-09-28 22:16:262024-09-28 22:16:26

詳細信息

Test #1:

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

input:

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

output:

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

result:

ok Accepted

Test #2:

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

input:

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

output:

0 220 801 663 743 165 845 585 547 361 479 482 188 778 481 329 812 948 773 716 89 288 200 473 867 475 17 889 501 673 887 77 788 606 736 834 221 607 832 650 968 195 944 336 123 885 61 858 941 245 667 70 642 702 312 669 465 559 341 572 626 790 122 618 770 135 660 713 211 518 159 679 589 968 713 238 85 ...

result:

ok Accepted

Test #3:

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

input:

1
1

output:

0 1
1 1

result:

ok Accepted

Test #4:

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

input:

2
0
2

output:

0 1 2
0 2 1
1 2 1

result:

ok Accepted

Test #5:

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

input:

3
0
1
1
0
3

output:

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

result:

ok Accepted

Test #6:

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

input:

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

output:

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

result:

ok Accepted

Test #7:

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

input:

6
0
2
0
1
1
0
0
2
0
1
1
0
0
1
0
1
0
0
1
0
1
0
0
0
1
3
1
2
2
1
0
2
0
1
1
0
0
1
0
1
0
0
1
0
1
0
0
0
2
4
2
3
3
2
1
3
1
2
2
1
1
2
1
2
1
1
2
1
2
1
1
1
1
2
1
2
1
1
0
1
0
1
0
0
0
1
0
1
0
0
0
0
0
0
0
0
2
1
2
1
1
1
1
0
1
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
2
0
1
1
0
0
2
0
1
1
0
0
1
0
1
0
0
1
0
1
0
0
0
0
2
0
1
1
...

output:

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

result:

ok Accepted

Test #8:

score: 0
Accepted
time: 6ms
memory: 3812kb

input:

7
0
0
2
1
1
0
0
0
1
2
0
1
1
0
0
1
0
2
1
0
0
1
1
3
0
0
2
1
1
0
0
0
1
1
0
0
1
0
0
0
0
1
1
0
0
0
1
2
0
0
1
2
0
1
0
0
1
1
0
0
0
1
0
0
1
0
0
1
0
0
2
1
1
0
0
1
0
2
1
0
0
0
0
1
0
1
0
0
1
0
0
2
0
1
1
0
1
0
0
1
1
3
1
0
0
0
1
2
0
1
0
0
2
1
0
2
0
1
1
0
1
1
3
2
2
1
1
1
2
3
1
2
2
1
1
2
1
3
2
1
1
2
2
4
0
0
2
1
1
...

output:

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

result:

ok Accepted

Test #9:

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

input:

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

output:

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

result:

ok Accepted

Test #10:

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

input:

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

output:

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

result:

ok Accepted

Test #11:

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

input:

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

output:

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

result:

ok Accepted

Test #12:

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

input:

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

output:

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

result:

ok Accepted

Test #13:

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

input:

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

output:

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

result:

ok Accepted

Test #14:

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

input:

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

output:

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

result:

ok Accepted

Test #15:

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

input:

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

output:

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

result:

ok Accepted

Test #16:

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

input:

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

output:

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

result:

ok Accepted

Test #17:

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

input:

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

output:

0 119 622 682 294 670 160 891 557 133 382 209 447 164 622 24 30 691 672 656 865 730 290 836 489 321 61 469 411 458 459 52 116 915 134 155 906 932 78 814 294 798 304 923 141 355 851 661 113 553 227 497 625 15 830 308 87 822 768 922 802 548 518 216 353 566 49 651 771 812 600 911 470 226 251 709 567 25...

result:

ok Accepted

Test #18:

score: 0
Accepted
time: 259ms
memory: 3880kb

input:

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

output:

0 620 526 887 541 646 970 429 243 221 816 538 835 850 597 278 710 759 189 311 885 824 363 355 951 215 548 184 490 444 78 131 457 878 432 520 403 38 78 910 126 219 775 583 481 273 471 670 489 426 289 166 7 818 326 481 834 617 86 335 96 649 371 632 561 558 732 128 787 713 566 803 214 802 106 347 681 2...

result:

ok Accepted

Test #19:

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

input:

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

output:

0 39 461 460 567 4 725 512 80 159 77 786 91 448 696 720 573 364 485 853 751 450 146 257 666 691 507 566 247 586 73 89 734 324 412 468 392 760 15 681 39 705 665 449 556 600 251 489 840 686 345 736 956 132 508 813 311 463 493 761 633 142 533 813 804 724 719 918 697 168 670 906 297 633 798 858 686 645 ...

result:

ok Accepted

Test #20:

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

input:

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

output:

0 246 206 465 814 409 185 483 537 791 434 939 85 541 271 604 621 211 544 819 718 879 77 117 902 149 860 305 323 756 555 842 377 402 23 856 179 137 431 510 743 98 291 301 925 386 32 298 480 566 637 621 947 25 555 730 652 73 169 152 196 860 719 442 553 539 876 201 720 817 732 950 497 464 772 232 768 5...

result:

ok Accepted

Test #21:

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

input:

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

output:

0 676 141 941 676 780 499 810 677 151 397 118 457 42 84 35 355 375 365 140 599 474 95 873 806 491 402 437 891 371 158 139 797 161 742 237 450 958 158 745 162 558 535 125 550 736 338 556 598 846 51 899 631 925 563 110 7 617 250 700 715 696 872 76 684 707 32 874 875 719 61 470 666 324 259 626 433 495 ...

result:

ok Accepted

Test #22:

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

input:

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

output:

0 379 571 851 445 674 111 338 339 646 618 112 319 861 963 45 7 671 372 885 265 643 452 697 205 108 839 899 834 814 51 857 254 723 237 745 974 721 332 494 447 833 953 862 595 334 170 681 210 192 596 898 631 392 725 24 599 485 676 786 449 956 689 316 65 794 721 508 587 579 724 898 328 234 709 864 201 ...

result:

ok Accepted

Test #23:

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

input:

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

output:

0 683 263 581 152 90 910 688 122 154 266 898 244 901 907 955 244 396 376 758 477 800 838 301 751 106 16 535 675 615 326 497 556 854 653 114 444 389 665 677 956 920 834 533 760 396 417 776 127 623 275 480 388 919 391 911 228 515 916 838 494 278 268 185 485 720 772 53 647 870 120 735 803 190 331 646 8...

result:

ok Accepted

Test #24:

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

input:

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

output:

0 376 657 440 226 321 867 503 534 567 736 458 880 161 135 810 598 459 683 300 669 380 860 740 504 132 203 511 296 545 946 263 307 806 911 619 736 237 121 894 147 905 438 292 446 976 124 656 925 584 735 863 751 442 896 962 755 737 489 879 121 419 175 484 327 13 51 595 21 871 949 874 66 233 860 649 91...

result:

ok Accepted

Test #25:

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

input:

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

output:

0 578 573 834 806 775 919 313 250 218 976 39 286 409 751 900 358 52 185 297 567 695 507 235 639 70 907 372 76 898 301 64 107 540 681 648 888 909 797 506 853 703 905 847 649 386 100 185 364 490 278 842 862 587 295 832 867 481 819 545 540 290 88 615 890 590 43 104 795 448 635 541 81 134 764 460 439 47...

result:

ok Accepted

Test #26:

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

input:

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

output:

0 721 856 149 567 1 677 731 322 473 361 41 256 24 598 129 486 629 486 248 887 432 626 684 914 355 437 271 314 843 975 507 544 931 442 494 521 252 320 568 793 413 191 800 122 859 844 218 137 390 918 150 14 907 571 205 951 478 379 276 265 358 203 358 600 705 821 482 770 292 323 40 276 926 688 57 2 429...

result:

ok Accepted

Test #27:

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

input:

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

output:

0 511 62 627 271 55 410 316 726 554 143 351 481 321 933 862 85 730 524 658 150 452 562 397 754 667 513 827 245 98 91 142 781 931 8 262 829 736 209 508 546 312 6 870 704 296 776 148 728 889 486 124 98 457 739 950 828 980 313 412 94 408 71 467 309 691 471 693 930 356 858 43 449 777 693 780 693 350 971...

result:

ok Accepted

Test #28:

score: 0
Accepted
time: 264ms
memory: 3912kb

input:

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

output:

0 612 400 700 615 208 58 682 164 598 540 41 559 291 787 650 642 534 37 629 58 554 714 946 971 505 770 337 426 420 682 765 978 203 532 717 548 573 774 978 164 666 256 756 383 753 516 247 4 576 596 936 421 473 97 503 580 20 11 359 20 532 890 229 211 923 279 414 586 81 98 936 968 189 304 468 266 193 66...

result:

ok Accepted

Test #29:

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

input:

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

output:

0 22 83 667 31 497 159 851 562 210 685 150 791 418 586 448 642 237 194 409 260 153 110 657 87 464 100 564 780 33 205 296 24 332 556 77 218 671 619 668 438 309 849 651 223 645 738 929 537 923 445 379 697 234 9 74 370 233 879 26 932 228 918 616 223 742 804 911 31 249 391 118 626 95 589 987 674 877 687...

result:

ok Accepted

Test #30:

score: 0
Accepted
time: 291ms
memory: 3940kb

input:

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

output:

0 619 837 241 965 728 855 952 53 416 41 925 789 868 108 832 592 346 988 508 190 596 975 150 585 927 502 819 958 802 255 171 740 607 372 490 496 304 24 550 154 348 758 764 644 179 246 821 873 481 580 906 556 371 573 444 424 380 156 568 738 416 529 890 404 621 41 860 779 722 719 912 170 491 962 683 44...

result:

ok Accepted

Test #31:

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

input:

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

output:

0 522 705 152 238 656 962 945 445 828 274 624 354 738 731 461 430 795 78 974 609 399 171 419 797 308 866 951 77 205 321 879 109 542 635 758 924 715 337 575 647 346 586 337 526 228 123 852 201 811 13 212 791 94 546 34 395 481 903 99 3 679 659 887 223 210 946 880 656 379 133 638 275 901 754 934 494 89...

result:

ok Accepted

Test #32:

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

input:

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

output:

0 692 799 242 929 82 702 615 261 154 375 878 237 47 393 688 429 967 321 759 653 100 690 902 707 360 955 278 327 866 346 835 699 335 694 985 716 147 704 294 881 793 724 94 99 863 439 901 964 753 522 847 544 584 339 271 378 477 572 677 167 803 401 10 51 730 941 802 583 716 870 56 951 539 841 338 920 1...

result:

ok Accepted

Test #33:

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

input:

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

output:

0 524 190 499 926 74 848 162 896 143 524 397 490 595 1 552 278 458 205 846 928 626 185 416 776 505 198 11 598 664 954 109 171 476 444 715 78 712 960 99 735 61 932 699 588 120 41 574 317 120 625 345 380 307 87 550 946 266 826 899 228 149 584 607 788 200 262 593 715 519 604 156 231 72 370 154 246 584 ...

result:

ok Accepted

Test #34:

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

input:

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

output:

0 497 614 175 545 753 186 165 922 731 410 599 728 795 693 550 438 606 613 581 504 787 977 800 937 965 361 364 242 450 919 221 786 842 824 678 459 880 310 489 432 972 238 565 46 269 333 604 539 617 258 583 72 492 137 75 484 467 807 643 373 351 927 43 408 179 58 820 772 379 642 211 220 752 71 2 768 54...

result:

ok Accepted

Test #35:

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

input:

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

output:

0 69 288 477 433 464 985 687 852 537 27 665 911 635 126 864 231 483 193 710 160 229 223 33 372 849 557 259 817 968 898 768 209 549 873 374 174 637 53 264 240 740 440 541 443 856 974 945 303 707 276 993 102 881 484 384 710 70 299 733 402 856 748 827 737 957 681 733 363 757 122 969 591 979 565 651 90 ...

result:

ok Accepted

Test #36:

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

input:

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

output:

0 759 393 893 298 521 907 562 249 217 846 306 692 801 422 773 964 896 367 3 716 829 546 655 258 854 939 651 111 256 231 752 202 32 748 924 294 523 96 752 444 267 25 524 314 505 943 86 521 607 90 509 890 564 544 695 127 404 443 282 689 868 526 58 874 377 568 484 327 393 174 892 306 840 680 51 208 903...

result:

ok Accepted

Test #37:

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

input:

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

output:

0 832 815 270 343 719 538 203 516 617 37 751 653 686 209 463 330 770 966 584 827 816 497 656 316 122 819 19 959 47 689 89 744 767 765 569 380 434 533 397 713 675 172 464 426 630 905 376 670 452 27 657 474 469 862 580 396 966 692 846 668 893 576 135 212 974 517 890 770 637 189 855 34 984 242 966 643 ...

result:

ok Accepted

Test #38:

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

input:

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

output:

0 348 484 50 720 213 203 877 166 751 803 534 585 273 707 510 582 232 888 282 597 183 88 16 800 517 971 933 705 978 400 828 467 186 415 542 777 116 658 718 630 413 510 747 744 876 516 238 896 813 201 572 490 942 691 673 190 339 476 79 21 362 786 918 893 203 606 488 581 429 543 513 239 182 868 795 246...

result:

ok Accepted

Test #39:

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

input:

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

output:

0 417 316 687 761 484 781 596 558 295 150 903 55 928 276 39 469 968 230 396 368 211 812 925 779 972 912 894 509 8 843 649 628 24 296 175 33 809 369 932 268 986 653 533 896 565 19 911 198 515 51 718 217 295 749 895 417 868 20 433 939 551 411 158 173 749 33 962 746 287 626 963 928 458 271 610 477 973 ...

result:

ok Accepted

Test #40:

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

input:

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

output:

0 960 551 557 256 847 121 112 649 890 634 309 952 234 534 771 712 385 906 929 493 413 651 90 667 383 163 680 461 39 245 456 258 940 767 936 114 686 497 804 593 659 720 177 268 658 252 421 44 472 964 112 421 468 37 908 208 25 417 684 577 190 647 348 388 218 264 387 365 319 418 762 989 998 400 865 164...

result:

ok Accepted

Test #41:

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

input:

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

output:

0 496 242 986 619 67 107 943 587 907 922 278 988 253 897 212 606 481 94 660 493 209 633 667 775 238 496 861 758 802 782 300 641 991 874 424 182 816 40 326 386 153 962 557 675 839 515 945 940 363 153 319 83 505 34 514 575 999 536 977 264 792 871 511 25 19 785 252 896 570 459 882 624 938 81 121 154 76...

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed