QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#599546#9432. Permutationucup-team1878#AC ✓341ms3888kbC++234.3kb2024-09-29 06:26:242024-09-29 06:26:24

详细

Test #1:

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

input:

5
2
2
2
2
0
0
0
2
2
0

output:

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

result:

ok Accepted

Test #2:

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

input:

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

output:

0 505 772 102 791 381 389 889 407 54 241 750 439 567 239 742 818 811 377 817 504 600 265 705 133 741 392 564 779 769 137 965 369 654 942 977 681 547 201 388 699 563 252 258 736 823 213 577 369 784 965 235 806 953 163 937 494 89 314 581 275 354 702 883 250 20 483 328 403 380 522 978 551 435 83 582 13...

result:

ok Accepted

Test #3:

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

input:

1

output:

1 1

result:

ok Accepted

Test #4:

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

input:

2
0
0

output:

0 1 2
0 1 2
1 2 1

result:

ok Accepted

Test #5:

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

input:

3
2
1
0
1
2

output:

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

result:

ok Accepted

Test #6:

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

input:

4
2
0
1
2
1
0

output:

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

result:

ok Accepted

Test #7:

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

input:

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

output:

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

result:

ok Accepted

Test #8:

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

input:

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

output:

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

result:

ok Accepted

Test #9:

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

input:

8
1
0
0
0
1
1
1
0
1
0
0
0
0

output:

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

result:

ok Accepted

Test #10:

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

input:

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

output:

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

result:

ok Accepted

Test #11:

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

input:

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

output:

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

result:

ok Accepted

Test #12:

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

input:

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

output:

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

result:

ok Accepted

Test #13:

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

input:

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

output:

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

result:

ok Accepted

Test #14:

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

input:

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

output:

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

result:

ok Accepted

Test #15:

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

input:

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

output:

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

result:

ok Accepted

Test #16:

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

input:

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

output:

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

result:

ok Accepted

Test #17:

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

input:

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

output:

0 955 772 377 341 406 414 889 932 354 466 900 864 817 889 17 368 711 427 642 379 625 40 880 708 166 442 289 79 369 537 515 344 279 542 177 781 822 776 63 674 538 152 233 136 448 713 752 119 384 90 860 206 28 188 287 219 289 964 531 200 929 802 233 925 970 533 378 603 80 372 603 351 360 683 532 135 8...

result:

ok Accepted

Test #18:

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

input:

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

output:

0 417 764 702 703 141 773 89 879 758 337 38 335 935 311 294 562 75 897 129 400 120 241 665 173 325 224 700 219 217 897 733 673 502 6 401 465 443 657 540 443 931 292 490 776 847 93 121 665 48 437 563 710 377 707 9 534 849 306 189 555 450 950 715 114 764 259 672 83 516 858 266 887 379 627 846 759 725 ...

result:

ok Accepted

Test #19:

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

input:

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

output:

0 529 666 218 482 787 837 581 690 8 277 491 221 596 794 124 451 646 331 373 832 59 714 24 25 401 650 31 211 214 693 680 470 558 45 709 324 856 71 746 514 246 192 241 485 229 302 28 186 654 168 378 802 974 537 919 667 756 587 912 272 781 426 564 623 966 417 767 443 210 212 381 766 105 104 313 178 901...

result:

ok Accepted

Test #20:

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

input:

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

output:

0 553 46 308 611 1 717 829 929 174 439 948 585 631 943 32 86 87 187 423 832 250 463 925 585 769 880 442 121 957 939 743 419 456 836 177 421 483 161 330 77 967 746 608 916 313 821 707 929 540 873 503 740 805 797 347 570 229 664 129 215 434 244 551 196 550 887 408 243 620 306 804 81 345 953 322 645 45...

result:

ok Accepted

Test #21:

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

input:

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

output:

0 236 557 667 429 836 65 262 650 410 103 92 858 705 301 876 928 958 862 670 272 834 482 355 940 601 181 8 780 620 782 902 630 220 652 256 388 212 25 186 373 854 173 119 555 618 569 401 97 206 501 618 638 737 938 937 79 370 445 227 637 267 140 259 579 357 89 836 245 264 807 832 274 539 850 829 264 37...

result:

ok Accepted

Test #22:

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

input:

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

output:

0 65 272 382 211 761 849 209 327 454 781 170 919 507 599 82 498 551 497 137 684 140 725 525 913 321 72 704 439 269 577 365 249 934 682 57 961 867 501 248 239 203 432 578 536 763 953 217 169 664 365 115 66 73 443 337 114 509 574 521 975 574 562 823 790 740 3 48 423 860 82 78 831 815 143 682 95 833 66...

result:

ok Accepted

Test #23:

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

input:

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

output:

0 406 373 551 209 220 363 679 395 924 97 969 312 787 799 536 854 486 856 663 322 931 445 289 744 55 307 895 673 402 657 140 248 558 209 372 709 387 542 141 518 946 125 632 469 58 395 62 449 270 912 470 689 532 629 644 954 1 412 375 104 281 799 476 7 286 599 744 684 131 495 810 321 765 923 304 240 28...

result:

ok Accepted

Test #24:

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

input:

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

output:

0 467 654 494 27 407 895 709 249 298 873 794 433 305 555 730 446 765 625 319 884 540 857 29 425 859 340 620 947 435 575 653 487 122 636 733 611 457 855 738 661 453 304 456 884 229 881 257 139 784 813 891 98 911 659 365 442 477 122 743 887 170 4 465 310 490 259 596 313 602 392 910 769 785 225 772 475...

result:

ok Accepted

Test #25:

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

input:

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

output:

0 982 409 188 219 972 763 237 622 262 89 537 798 453 296 364 581 690 552 519 329 158 225 423 648 819 318 24 409 172 686 219 745 645 631 224 732 958 108 725 202 616 664 866 523 457 61 937 227 70 286 913 278 938 501 161 897 587 918 142 281 273 58 708 416 653 232 87 945 61 144 926 583 74 895 163 478 53...

result:

ok Accepted

Test #26:

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

input:

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

output:

0 769 748 14 143 589 21 457 479 702 817 6 111 871 799 782 914 699 769 321 136 928 913 937 453 685 520 652 43 321 81 221 737 486 926 57 673 771 377 924 179 811 812 698 232 391 269 137 233 816 717 107 230 505 59 761 126 793 442 717 227 194 358 803 10 604 323 480 195 908 642 666 495 99 875 838 567 773 ...

result:

ok Accepted

Test #27:

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

input:

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

output:

0 875 412 652 831 386 234 574 177 924 946 220 134 762 219 137 528 111 27 447 424 530 820 975 413 331 122 684 229 79 597 245 4 944 27 982 791 967 226 663 519 208 737 263 676 328 93 337 599 869 460 750 131 58 358 807 829 454 894 786 965 354 142 458 945 425 493 698 403 75 42 968 881 735 138 77 915 308 ...

result:

ok Accepted

Test #28:

score: 0
Accepted
time: 317ms
memory: 3520kb

input:

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

output:

0 553 758 68 15 377 231 693 59 158 879 838 485 25 331 928 596 521 739 295 506 110 555 729 545 705 120 754 549 639 85 793 543 380 394 377 175 467 965 920 219 597 474 18 716 483 893 781 891 506 501 617 270 81 881 483 6 853 356 347 221 166 428 265 346 74 489 982 949 754 522 772 201 835 735 344 151 467 ...

result:

ok Accepted

Test #29:

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

input:

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

output:

0 772 181 305 890 670 618 916 341 216 676 555 30 199 277 320 638 978 70 690 880 889 718 721 801 391 478 613 838 843 423 743 263 402 395 813 163 825 515 465 302 826 929 284 382 301 722 77 680 69 225 458 563 556 926 50 597 292 679 843 191 959 541 788 223 838 416 531 570 650 390 267 432 276 878 745 186...

result:

ok Accepted

Test #30:

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

input:

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

output:

0 461 564 338 55 549 297 473 295 354 349 458 903 271 395 602 82 607 505 525 652 248 1 9 201 517 260 328 495 733 641 333 825 422 490 489 521 367 477 752 635 551 932 974 552 747 245 193 145 696 909 535 570 301 71 105 986 861 366 89 551 786 958 883 106 684 247 924 759 28 34 226 715 503 787 90 447 525 3...

result:

ok Accepted

Test #31:

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

input:

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

output:

0 238 70 511 891 340 738 745 649 22 314 445 277 163 320 300 121 728 412 72 162 132 955 941 528 207 676 41 957 199 669 754 210 218 905 966 26 286 782 826 415 483 380 286 284 666 946 914 384 215 93 935 926 44 707 548 716 164 957 86 51 784 561 132 261 237 207 517 265 978 987 419 834 569 591 680 170 628...

result:

ok Accepted

Test #32:

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

input:

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

output:

0 775 832 722 11 121 219 229 287 564 961 510 429 67 169 392 818 441 37 87 844 130 625 685 753 271 82 184 439 609 837 275 509 594 542 597 421 927 641 978 329 73 602 218 676 13 503 467 449 954 435 695 176 253 773 167 684 469 214 51 725 344 52 413 700 610 23 528 333 770 972 18 681 495 113 862 825 533 4...

result:

ok Accepted

Test #33:

score: 0
Accepted
time: 331ms
memory: 3644kb

input:

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

output:

0 684 869 144 30 189 736 120 62 822 295 955 502 548 811 892 263 409 187 610 233 878 549 144 949 268 607 98 676 523 965 697 235 79 14 263 810 14 882 339 414 521 934 69 417 64 161 311 980 770 361 645 776 526 407 749 684 625 684 282 773 778 587 597 898 916 962 87 843 33 699 950 578 86 539 966 682 263 1...

result:

ok Accepted

Test #34:

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

input:

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

output:

0 833 812 382 159 301 869 649 847 406 497 502 527 439 183 566 658 923 433 417 848 984 465 601 877 741 608 924 923 329 929 349 721 470 806 625 209 699 737 268 491 227 404 602 808 559 365 169 585 864 21 35 438 457 787 809 166 289 946 29 747 626 486 139 210 380 723 992 83 36 618 282 423 91 35 814 247 8...

result:

ok Accepted

Test #35:

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

input:

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

output:

0 211 664 80 140 640 303 925 719 672 580 207 852 451 463 731 428 81 742 75 196 328 355 898 153 673 568 808 940 969 633 290 800 366 443 717 295 636 953 660 173 481 590 23 442 679 443 50 791 669 726 764 413 901 71 650 183 568 136 210 209 365 844 647 967 79 959 381 72 875 411 309 576 735 137 577 708 57...

result:

ok Accepted

Test #36:

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

input:

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

output:

0 149 384 704 645 523 163 223 187 328 837 268 863 605 277 180 988 943 539 641 446 826 865 105 3 13 576 186 75 689 283 897 473 402 444 827 331 643 347 52 393 567 712 550 326 875 365 301 729 552 715 339 934 577 331 883 506 957 868 31 611 630 142 389 342 292 647 48 479 538 194 638 467 563 115 948 249 2...

result:

ok Accepted

Test #37:

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

input:

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

output:

0 10 287 602 41 786 109 634 567 474 211 595 914 392 634 12 313 776 97 927 19 650 20 725 643 286 187 234 349 744 872 660 609 304 197 697 61 187 681 543 454 93 822 718 596 553 598 607 374 404 75 310 566 818 683 272 764 414 524 361 425 814 582 538 745 355 48 668 863 790 402 948 826 550 108 557 95 423 9...

result:

ok Accepted

Test #38:

score: 0
Accepted
time: 321ms
memory: 3528kb

input:

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

output:

0 193 208 74 371 889 117 37 407 138 433 162 459 679 727 446 14 27 229 261 748 772 73 469 225 229 592 340 595 201 801 137 557 594 470 933 601 447 989 624 491 607 200 158 700 523 29 857 437 24 849 371 410 505 419 809 594 517 646 921 311 986 250 275 22 4 359 732 243 968 294 510 543 543 131 490 375 53 2...

result:

ok Accepted

Test #39:

score: 0
Accepted
time: 341ms
memory: 3508kb

input:

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

output:

0 508 358 489 610 655 978 157 887 107 976 91 278 389 423 467 995 173 212 769 726 978 553 419 341 320 55 503 503 700 481 88 551 941 585 625 251 983 222 752 372 489 891 933 65 249 901 836 868 272 219 918 158 964 247 72 725 656 595 176 363 120 835 557 187 184 988 213 865 504 997 379 31 919 894 929 625 ...

result:

ok Accepted

Test #40:

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

input:

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

output:

0 845 836 310 987 669 493 781 269 62 681 488 785 887 453 262 490 267 859 161 604 238 291 735 163 239 448 640 641 285 909 683 875 64 100 89 93 877 283 794 963 15 450 364 232 815 837 669 943 964 583 113 836 845 627 659 948 83 252 903 271 538 992 589 874 288 391 2 135 224 94 246 107 491 445 758 911 677...

result:

ok Accepted

Test #41:

score: 0
Accepted
time: 324ms
memory: 3816kb

input:

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

output:

0 127 733 902 398 310 300 922 269 879 61 951 330 139 232 410 386 81 730 897 376 454 418 784 114 145 901 706 394 204 81 743 680 135 947 732 394 315 461 267 743 658 791 209 460 634 818 962 935 441 597 362 221 802 179 797 882 784 772 456 338 578 142 881 367 754 464 69 513 383 621 855 303 603 581 79 519...

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed