QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#595810#9432. Permutationucup-team3935#AC ✓264ms3912kbC++204.6kb2024-09-28 14:30:362024-09-28 14:30:37

详细

Test #1:

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

input:

5
3
3
0
2
2
2
0
2

output:

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

result:

ok Accepted

Test #2:

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

input:

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

output:

0 418 805 287 716 114 32 199 365 344 356 996 97 3 301 724 350 292 499 290 10 884 579 466 159 718 753 457 196 637 391 399 951 214 673 621 828 831 769 879 77 300 136 975 461 73 833 368 744 622 590 67 385 308 488 296 574 604 417 281 798 605 420 402 8 297 518 871 444 596 207 354 902 838 589 222 357 437 ...

result:

ok Accepted

Test #3:

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

input:

1

output:

1 1

result:

ok Accepted

Test #4:

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

input:

2
2
0
0

output:

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

result:

ok Accepted

Test #5:

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

input:

3
1
0
0
2

output:

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

result:

ok Accepted

Test #6:

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

input:

4
2
2
0
1
1
0
0
0

output:

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

result:

ok Accepted

Test #7:

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

input:

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

output:

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

result:

ok Accepted

Test #8:

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

input:

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

output:

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

result:

ok Accepted

Test #9:

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

input:

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

output:

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

result:

ok Accepted

Test #10:

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

input:

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

output:

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

result:

ok Accepted

Test #11:

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

input:

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

output:

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

result:

ok Accepted

Test #12:

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

input:

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

output:

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

result:

ok Accepted

Test #13:

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

input:

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

output:

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

result:

ok Accepted

Test #14:

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

input:

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

output:

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

result:

ok Accepted

Test #15:

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

input:

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

output:

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

result:

ok Accepted

Test #16:

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

input:

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

output:

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

result:

ok Accepted

Test #17:

score: 0
Accepted
time: 240ms
memory: 3692kb

input:

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

output:

0 319 178 170 933 555 748 498 2 113 788 18 429 395 204 664 435 208 515 589 310 884 546 369 734 32 380 762 799 296 322 517 636 202 168 272 975 273 41 225 545 675 518 665 544 945 563 13 885 780 349 356 132 311 465 88 685 149 623 458 408 6 283 908 628 105 719 843 211 874 158 87 1 76 746 289 735 466 916...

result:

ok Accepted

Test #18:

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

input:

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

output:

0 230 228 98 381 430 113 585 645 685 712 783 79 379 110 34 229 861 757 785 373 371 800 701 872 167 215 299 924 132 930 633 344 659 405 391 675 86 306 583 820 721 115 971 564 699 36 298 740 462 402 122 269 356 454 1 795 942 549 272 919 846 881 236 154 129 584 185 960 910 304 358 447 570 775 149 877 7...

result:

ok Accepted

Test #19:

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

input:

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

output:

0 367 11 41 299 336 544 699 469 150 676 410 399 977 685 386 606 116 772 122 71 175 85 480 56 114 589 501 661 333 102 601 853 300 39 29 366 850 138 353 570 335 707 423 860 838 57 281 18 735 846 259 517 218 329 241 370 274 291 600 633 203 587 65 222 678 704 413 103 490 128 830 728 635 72 317 803 862 4...

result:

ok Accepted

Test #20:

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

input:

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

output:

0 551 643 272 850 37 770 547 634 306 827 406 238 33 98 911 760 592 280 499 318 503 430 596 205 214 843 36 713 655 270 921 437 356 932 266 8 758 784 333 483 830 591 764 587 910 459 184 457 745 374 679 642 750 466 795 209 296 196 667 68 245 756 453 508 305 668 1 733 868 783 721 525 515 322 501 260 903...

result:

ok Accepted

Test #21:

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

input:

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

output:

0 808 513 235 675 843 895 163 715 292 440 211 148 370 942 371 467 736 952 743 846 697 114 357 26 4 366 220 109 289 732 526 844 516 767 847 567 231 124 619 367 687 663 660 420 334 566 145 390 256 911 389 972 645 193 111 731 318 162 296 825 510 579 849 668 785 267 147 691 584 606 897 182 40 311 533 68...

result:

ok Accepted

Test #22:

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

input:

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

output:

0 197 967 51 329 576 899 726 214 464 860 781 501 310 865 488 43 572 242 388 802 49 171 635 765 853 508 266 9 250 734 695 917 21 361 618 923 679 152 147 795 727 706 848 551 76 317 596 384 290 897 972 249 196 869 785 23 569 876 5 927 518 284 299 762 502 681 128 176 977 816 861 884 82 589 336 75 646 61...

result:

ok Accepted

Test #23:

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

input:

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

output:

0 966 235 426 342 251 323 368 170 745 165 249 927 210 201 451 386 10 686 407 734 705 611 783 373 274 612 250 676 948 496 296 289 727 668 374 88 782 908 693 667 188 241 473 602 336 802 690 980 302 671 384 893 1 500 533 324 18 786 184 207 163 430 771 99 610 338 448 113 935 896 123 526 459 354 534 182 ...

result:

ok Accepted

Test #24:

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

input:

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

output:

0 216 550 161 546 660 83 552 715 371 795 579 757 46 269 446 200 707 727 633 167 246 22 720 323 659 824 832 959 99 177 466 100 891 541 303 320 90 909 383 600 916 250 662 48 362 256 560 808 873 211 829 165 253 821 684 59 625 363 740 24 471 513 474 293 69 498 227 806 817 876 626 578 960 233 900 186 748...

result:

ok Accepted

Test #25:

score: 0
Accepted
time: 249ms
memory: 3676kb

input:

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

output:

0 201 419 263 450 241 916 403 431 901 689 905 505 49 619 674 99 875 411 841 973 775 594 917 958 184 117 937 260 879 621 834 974 87 43 291 59 643 912 187 258 476 925 329 558 475 426 867 743 933 791 147 944 514 172 896 189 56 191 185 375 487 726 968 941 97 244 844 264 399 767 171 57 392 796 389 88 825...

result:

ok Accepted

Test #26:

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

input:

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

output:

0 821 775 654 795 664 573 21 674 924 360 400 572 570 500 687 92 892 133 322 793 810 301 332 972 532 496 14 75 560 430 633 971 71 25 635 734 853 534 878 76 427 486 67 820 838 372 256 796 861 564 952 305 550 637 82 607 279 318 767 246 937 97 70 717 416 808 792 613 286 745 981 295 771 726 37 2 660 91 4...

result:

ok Accepted

Test #27:

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

input:

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

output:

0 971 218 184 331 731 912 462 544 311 514 444 946 203 587 93 777 595 982 187 421 213 921 805 870 402 717 776 703 447 945 979 363 613 759 557 150 458 610 818 648 314 242 823 96 478 4 7 68 384 526 484 10 830 359 401 388 310 210 635 561 474 325 768 546 415 450 743 42 231 913 107 423 948 354 24 689 196 ...

result:

ok Accepted

Test #28:

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

input:

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

output:

0 60 85 806 176 953 218 795 565 263 228 815 631 505 48 548 283 19 477 677 603 270 127 928 432 598 173 499 210 555 949 891 170 904 835 786 844 350 113 539 917 606 858 45 442 495 234 277 237 418 805 866 323 952 8 893 978 49 364 375 681 986 983 934 785 535 15 288 930 655 482 846 579 196 240 68 850 388 ...

result:

ok Accepted

Test #29:

score: 0
Accepted
time: 222ms
memory: 3740kb

input:

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

output:

0 890 481 961 933 799 968 246 531 56 50 589 917 725 551 272 332 765 937 593 959 577 73 490 802 793 816 372 333 431 566 271 858 811 22 23 125 398 632 795 484 86 630 769 809 314 47 175 342 362 425 135 239 970 457 907 702 855 581 948 373 831 471 512 846 579 862 198 412 448 106 274 124 658 804 273 982 8...

result:

ok Accepted

Test #30:

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

input:

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

output:

0 114 353 360 369 30 155 7 824 584 250 237 198 792 929 554 374 810 970 348 836 933 781 331 90 620 395 670 755 206 893 254 115 470 49 55 421 187 917 610 401 389 588 362 659 169 887 264 110 226 676 713 437 392 922 604 521 530 875 900 858 128 443 952 292 639 707 979 831 8 77 260 305 447 621 471 150 161...

result:

ok Accepted

Test #31:

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

input:

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

output:

0 78 270 737 531 649 348 187 237 452 171 832 955 633 65 507 665 713 849 369 113 875 372 536 20 648 652 96 724 502 152 293 821 813 618 456 132 1 909 732 969 585 596 932 694 854 925 680 12 578 207 627 343 484 878 800 120 59 682 650 736 600 611 92 288 261 345 572 920 218 287 145 929 430 662 745 725 868...

result:

ok Accepted

Test #32:

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

input:

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

output:

0 426 436 724 959 551 962 58 125 650 76 427 54 984 126 235 195 57 901 795 21 817 438 186 576 736 101 729 98 441 232 200 803 459 249 887 868 821 759 311 440 498 492 946 866 804 780 470 120 72 390 967 614 291 841 987 952 888 178 16 862 1 787 190 695 370 147 78 396 277 852 320 246 207 252 714 368 165 3...

result:

ok Accepted

Test #33:

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

input:

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

output:

0 254 466 737 26 164 709 715 260 712 342 321 233 961 723 587 444 637 763 853 483 158 420 656 445 218 302 33 925 399 585 437 930 54 34 373 402 320 803 947 497 307 632 963 123 618 741 368 727 488 805 94 53 668 806 971 49 448 440 789 114 703 80 534 379 24 323 84 409 977 547 341 452 882 654 985 823 793 ...

result:

ok Accepted

Test #34:

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

input:

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

output:

0 569 920 723 204 344 761 444 496 873 619 763 578 977 719 349 243 75 180 195 235 703 135 348 686 930 529 683 697 942 418 965 323 531 587 231 215 630 550 782 353 406 762 746 806 303 680 385 266 493 545 785 884 82 888 29 919 157 827 610 730 200 622 384 352 847 700 618 450 497 825 720 237 163 972 476 6...

result:

ok Accepted

Test #35:

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

input:

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

output:

0 267 22 91 818 863 949 219 100 954 130 614 372 126 575 674 766 251 442 479 504 168 669 903 35 948 109 111 984 119 68 561 704 761 347 53 433 873 611 892 681 70 381 637 763 678 243 714 746 482 26 827 328 228 634 524 544 196 254 786 849 128 966 901 909 44 720 490 313 828 859 344 415 154 147 560 573 72...

result:

ok Accepted

Test #36:

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

input:

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

output:

0 527 892 523 550 154 640 888 454 957 34 855 340 728 417 762 341 292 397 930 166 593 437 731 934 493 274 915 866 187 622 889 170 582 921 209 301 275 385 753 37 430 233 509 373 854 676 882 88 522 624 887 914 8 983 820 228 789 488 13 769 494 116 865 587 46 726 945 456 958 894 572 347 60 181 989 22 575...

result:

ok Accepted

Test #37:

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

input:

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

output:

0 965 281 156 680 757 405 460 561 307 712 793 605 377 697 850 186 551 321 228 690 548 781 36 656 621 630 537 250 696 436 69 349 73 867 643 459 876 470 751 65 531 813 475 102 63 915 386 994 742 957 599 895 489 841 892 683 169 767 476 507 752 661 389 447 722 568 333 703 668 375 117 10 675 921 851 513 ...

result:

ok Accepted

Test #38:

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

input:

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

output:

0 656 301 437 615 238 741 462 754 933 793 209 214 694 233 351 775 4 880 618 469 866 284 71 547 606 485 52 297 822 711 996 826 566 381 93 292 599 949 739 819 770 300 777 693 325 860 159 97 564 83 362 476 39 994 305 963 106 893 827 391 69 495 604 537 929 329 441 423 732 266 814 636 138 579 517 481 680...

result:

ok Accepted

Test #39:

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

input:

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

output:

0 682 59 276 23 363 566 564 862 346 834 386 411 978 724 170 120 621 743 95 606 892 634 75 599 693 883 489 506 777 410 990 986 593 133 964 57 293 297 331 660 591 445 218 490 644 521 532 753 709 951 667 610 209 760 636 24 300 328 476 594 446 31 79 808 222 503 237 686 223 102 162 604 437 91 739 940 965...

result:

ok Accepted

Test #40:

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

input:

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

output:

0 206 443 39 95 864 697 814 18 248 703 175 587 365 928 75 389 26 223 615 407 70 360 376 836 971 125 242 554 708 596 835 444 932 665 457 191 53 73 89 566 511 190 855 450 86 910 809 579 277 666 785 538 645 729 664 780 651 137 532 429 750 764 471 99 77 691 717 161 243 675 131 672 776 759 215 787 670 83...

result:

ok Accepted

Test #41:

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

input:

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

output:

0 777 415 815 266 931 617 459 990 616 422 263 451 51 840 818 770 890 819 380 725 443 122 868 141 786 417 292 656 338 757 219 21 397 512 888 785 650 226 825 101 570 958 899 639 575 413 106 926 571 675 832 83 742 908 594 325 516 193 50 233 670 886 875 824 62 609 677 382 421 217 620 779 377 649 379 850...

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed