QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#599158#9432. Permutationucup-team130#AC ✓294ms4008kbC++144.7kb2024-09-29 01:53:522024-09-29 01:53:56

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

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

result:

ok Accepted

Test #2:

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

input:

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

output:

0 184 140 717 618 592 842 600 689 643 395 392 413 587 608 395 685 479 252 239 608 830 142 873 196 535 596 70 48 234 848 446 803 107 243 194 786 546 269 441 224 720 751 568 489 793 60 370 497 381 723 4 6 132 450 423 524 215 591 392 430 552 238 121 74 332 204 590 801 384 825 757 444 997 869 480 659 47...

result:

ok Accepted

Test #3:

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

input:

1

output:

1 1

result:

ok Accepted

Test #4:

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

input:

2
1
1
1
0
0

output:

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

result:

ok Accepted

Test #5:

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

input:

3
2
1
1
0
1
0
0

output:

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

result:

ok Accepted

Test #6:

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

input:

4
2
0
1
2
1
0

output:

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

result:

ok Accepted

Test #7:

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

input:

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

output:

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

result:

ok Accepted

Test #8:

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

input:

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

output:

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

result:

ok Accepted

Test #9:

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

input:

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

output:

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

result:

ok Accepted

Test #10:

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

input:

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

output:

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

result:

ok Accepted

Test #11:

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

input:

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

output:

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

result:

ok Accepted

Test #12:

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

input:

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

output:

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

result:

ok Accepted

Test #13:

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

input:

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

output:

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

result:

ok Accepted

Test #14:

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

input:

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

output:

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

result:

ok Accepted

Test #15:

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

input:

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

output:

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

result:

ok Accepted

Test #16:

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

input:

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

output:

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

result:

ok Accepted

Test #17:

score: 0
Accepted
time: 282ms
memory: 3964kb

input:

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

output:

0 604 148 644 55 814 67 646 316 432 5 893 300 366 616 90 164 138 630 560 436 200 558 447 425 138 483 679 328 626 291 871 801 528 371 295 259 852 851 772 912 663 802 102 520 769 477 241 577 289 558 598 664 804 901 910 921 363 113 67 860 830 39 435 811 538 614 211 917 296 435 334 38 400 79 444 107 860...

result:

ok Accepted

Test #18:

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

input:

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

output:

0 652 495 814 201 685 967 19 172 849 219 700 610 684 420 64 655 476 725 709 430 783 434 798 1 813 502 270 873 875 862 739 38 182 787 180 693 128 339 866 975 192 261 101 51 823 510 367 525 165 360 253 716 675 675 529 604 596 413 154 444 421 386 593 484 413 868 585 654 814 75 329 4 814 934 674 195 927...

result:

ok Accepted

Test #19:

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

input:

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

output:

0 723 518 830 419 90 603 451 422 412 592 273 783 228 925 114 846 66 932 126 109 634 285 726 900 116 866 376 105 622 325 219 654 142 873 288 798 220 824 413 966 734 30 685 453 588 867 791 107 901 236 458 15 957 316 372 312 160 932 23 896 308 975 763 523 96 495 85 591 240 447 48 358 60 970 792 242 910...

result:

ok Accepted

Test #20:

score: 0
Accepted
time: 256ms
memory: 3960kb

input:

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

output:

0 977 321 348 32 412 225 923 265 349 319 9 261 116 856 492 858 89 82 643 442 845 718 944 842 74 106 380 305 721 633 276 390 886 806 185 135 845 161 345 477 582 430 345 234 373 533 844 14 148 919 729 890 513 837 63 862 838 706 506 66 900 120 666 536 666 662 955 644 902 98 289 47 321 5 186 784 354 888...

result:

ok Accepted

Test #21:

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

input:

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

output:

0 904 405 180 577 161 429 299 674 871 67 467 319 172 492 398 495 656 941 228 631 560 183 436 773 829 765 695 189 385 31 376 512 126 527 701 908 352 382 130 62 834 486 357 191 274 366 606 176 930 98 932 512 381 538 293 314 49 420 555 160 677 539 107 834 539 887 190 556 441 686 974 355 284 359 351 333...

result:

ok Accepted

Test #22:

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

input:

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

output:

0 894 610 830 889 425 798 766 828 386 265 333 900 713 575 98 618 139 688 237 243 397 889 699 459 731 209 266 2 61 314 160 317 527 803 591 863 909 665 712 448 268 319 795 948 881 902 962 17 820 260 292 32 673 964 253 806 100 847 714 537 726 464 586 472 31 945 210 270 475 191 220 952 130 772 788 932 8...

result:

ok Accepted

Test #23:

score: 0
Accepted
time: 284ms
memory: 3732kb

input:

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

output:

0 675 573 435 683 352 869 869 423 574 893 196 95 798 462 196 400 710 484 279 182 285 31 748 267 677 27 932 201 412 261 721 269 64 898 55 322 210 421 560 530 476 344 383 714 147 40 326 494 180 377 279 198 113 407 491 117 298 841 24 789 530 369 166 620 214 729 388 335 292 838 567 553 78 728 487 53 72 ...

result:

ok Accepted

Test #24:

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

input:

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

output:

0 377 357 820 546 245 195 863 498 935 911 169 170 66 495 825 870 724 812 225 787 635 699 192 443 574 935 689 411 882 648 41 371 479 767 416 206 824 147 925 216 39 733 413 967 112 74 580 585 494 566 457 414 898 754 37 249 152 862 547 256 211 453 626 362 359 652 556 893 155 238 962 644 975 940 901 877...

result:

ok Accepted

Test #25:

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

input:

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

output:

0 864 721 77 297 613 30 854 485 704 862 390 441 92 784 298 978 550 579 183 942 342 143 636 31 431 276 236 193 812 602 743 38 7 966 830 537 257 406 798 589 64 906 115 708 29 294 180 535 768 539 239 444 859 648 521 979 734 869 339 79 127 455 260 373 165 291 667 953 846 690 454 523 932 764 446 9 782 11...

result:

ok Accepted

Test #26:

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

input:

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

output:

0 938 111 793 756 835 744 41 342 908 93 350 944 295 315 973 379 50 848 346 134 732 225 822 84 810 984 413 719 514 489 278 442 846 946 342 215 536 284 604 524 881 839 334 441 428 500 781 298 351 259 642 375 535 620 439 178 53 180 226 83 592 132 663 88 145 493 855 458 182 494 462 628 284 835 728 28 10...

result:

ok Accepted

Test #27:

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

input:

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

output:

0 10 509 277 621 949 858 840 592 584 370 78 918 795 406 46 717 144 520 860 539 15 802 333 697 729 97 857 223 961 722 821 973 454 362 799 979 501 302 397 301 286 849 190 177 688 869 818 858 347 556 890 242 60 983 221 178 255 721 880 823 125 645 51 610 453 402 56 67 569 772 292 491 560 866 228 555 249...

result:

ok Accepted

Test #28:

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

input:

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

output:

0 917 505 496 642 245 225 824 782 437 214 706 888 704 504 555 776 213 153 122 495 548 42 330 145 122 550 952 897 261 392 261 645 667 979 244 438 6 871 288 331 692 639 263 854 86 986 296 698 89 952 255 24 562 479 27 114 624 192 798 60 162 599 713 237 966 732 163 328 336 710 844 696 747 569 505 608 60...

result:

ok Accepted

Test #29:

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

input:

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

output:

0 926 112 904 899 1 183 470 927 163 672 710 95 88 63 709 406 809 705 160 673 643 407 504 477 22 242 412 41 336 114 917 146 98 385 13 650 221 851 275 317 35 712 165 496 19 623 697 968 543 269 673 357 625 343 83 689 591 97 309 955 440 526 46 756 327 639 267 694 735 460 357 45 215 949 566 427 121 264 8...

result:

ok Accepted

Test #30:

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

input:

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

output:

0 859 120 593 529 687 104 477 622 551 128 778 267 442 683 357 582 879 351 842 948 81 725 819 837 788 243 843 827 197 19 671 445 303 838 680 89 184 427 801 6 678 66 701 771 496 335 281 459 144 517 16 25 412 539 63 430 238 85 749 895 242 662 307 51 502 549 72 657 232 257 361 771 760 329 303 407 358 95...

result:

ok Accepted

Test #31:

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

input:

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

output:

0 389 29 478 54 136 950 469 630 649 287 404 105 295 987 841 298 287 278 680 881 486 856 781 251 364 388 790 416 960 421 325 146 190 743 984 898 753 568 514 723 784 972 691 344 634 240 690 270 944 980 921 9 397 229 973 882 653 816 286 833 550 80 936 306 263 813 257 554 978 198 826 749 32 970 705 979 ...

result:

ok Accepted

Test #32:

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

input:

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

output:

0 492 906 334 734 85 598 677 939 437 180 491 248 165 411 859 655 449 127 426 955 726 469 453 573 880 563 282 309 407 785 365 208 546 404 495 84 725 252 662 903 152 204 752 244 739 585 424 251 400 881 864 611 98 442 612 40 852 582 940 422 313 688 928 779 397 63 741 721 101 891 394 308 654 662 47 61 9...

result:

ok Accepted

Test #33:

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

input:

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

output:

0 258 156 601 5 87 289 878 670 336 334 10 678 226 4 108 677 183 663 681 819 669 231 901 980 932 810 99 975 745 185 932 904 248 270 482 604 764 978 97 670 58 558 173 834 650 689 555 202 222 231 522 82 435 789 330 967 77 68 958 45 538 13 935 92 350 286 568 931 151 95 322 134 450 39 953 700 522 546 276...

result:

ok Accepted

Test #34:

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

input:

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

output:

0 555 448 981 988 539 528 914 322 573 448 529 710 318 281 10 489 277 436 22 40 815 292 353 480 902 316 702 699 651 762 671 836 211 303 497 10 565 280 649 585 939 453 101 157 65 467 906 641 561 323 928 95 283 317 161 576 865 677 889 532 449 168 522 42 691 528 187 433 866 686 634 348 781 821 409 641 8...

result:

ok Accepted

Test #35:

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

input:

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

output:

0 424 201 43 606 26 17 299 267 770 399 411 842 234 56 184 41 915 47 358 436 561 947 887 778 489 749 399 190 370 783 352 801 920 152 635 628 984 766 438 849 527 149 889 471 963 606 858 15 87 656 866 947 19 889 285 424 756 428 313 670 40 739 559 498 629 716 212 855 196 102 980 778 974 159 662 437 402 ...

result:

ok Accepted

Test #36:

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

input:

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

output:

0 48 786 133 167 669 691 380 385 874 63 354 182 334 85 322 106 258 671 746 419 978 970 269 309 642 330 521 669 796 642 64 132 402 415 808 471 63 258 789 202 424 169 157 860 31 316 287 90 386 833 610 577 986 179 180 921 748 424 244 993 360 247 27 282 825 7 473 827 436 357 620 421 437 70 176 610 231 9...

result:

ok Accepted

Test #37:

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

input:

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

output:

0 722 772 663 16 445 853 117 337 747 731 584 480 295 823 744 588 724 713 429 196 407 579 455 826 434 684 847 801 847 742 207 864 347 92 936 769 869 4 450 560 893 96 798 759 708 927 887 452 870 540 638 835 291 531 263 414 790 357 296 633 764 371 115 21 21 675 375 855 605 839 415 821 181 936 582 274 5...

result:

ok Accepted

Test #38:

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

input:

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

output:

0 849 68 411 902 761 90 308 810 141 801 489 492 987 708 2 495 627 306 273 924 867 384 353 502 365 795 886 857 218 808 799 275 587 222 17 380 718 977 85 429 501 714 112 950 704 531 184 367 479 153 530 59 852 412 830 632 878 51 817 461 552 34 464 252 2 9 416 277 889 53 980 959 46 8 538 344 949 716 252...

result:

ok Accepted

Test #39:

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

input:

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

output:

0 260 311 154 796 208 887 385 56 905 898 204 125 522 634 941 556 170 614 858 884 379 558 461 933 471 589 255 507 756 90 935 600 906 664 355 34 596 33 162 110 412 877 601 486 537 928 243 68 753 243 545 869 519 630 654 174 394 770 777 141 853 653 13 138 278 4 491 894 828 225 327 323 135 290 916 838 29...

result:

ok Accepted

Test #40:

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

input:

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

output:

0 984 695 338 558 248 697 673 800 695 96 264 349 276 704 838 344 746 741 324 139 769 644 524 337 500 794 563 973 201 318 965 411 51 384 475 585 530 917 800 781 683 100 417 11 873 938 450 409 64 307 213 995 284 263 115 218 958 75 805 855 794 400 97 7 847 183 85 62 900 73 788 429 688 207 192 472 451 4...

result:

ok Accepted

Test #41:

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

input:

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

output:

0 140 853 317 16 782 837 328 264 292 607 115 196 199 854 472 119 897 209 911 292 342 431 194 246 223 187 423 988 427 724 482 232 159 652 589 573 883 262 756 157 430 147 377 917 209 222 170 913 824 715 91 474 854 749 496 526 61 767 420 60 983 846 780 218 543 808 582 142 500 508 910 412 656 163 381 46...

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed