QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#597407#9432. Permutationucup-team138#AC ✓310ms4088kbC++142.6kb2024-09-28 17:45:352024-09-28 17:45:36

詳細信息

Test #1:

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

input:

5
1
1
1
0
1
1
1
1
0
1
1
0

output:

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

result:

ok Accepted

Test #2:

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

input:

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

output:

0 280 953 469 236 258 386 778 422 553 413 411 412 44 922 373 522 264 174 255 948 66 512 595 393 447 356 644 963 116 50 350 296 889 510 229 292 824 626 218 852 155 779 640 149 439 732 286 734 72 621 89 165 741 972 701 266 840 310 638 721 249 75 984 636 457 55 865 9 100 881 872 336 774 955 894 905 245...

result:

ok Accepted

Test #3:

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

input:

1

output:

1 1

result:

ok Accepted

Test #4:

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

input:

2
2
2
2
2
0
2

output:

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

result:

ok Accepted

Test #5:

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

input:

3
0
0
0

output:

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

result:

ok Accepted

Test #6:

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

input:

4
1
1
1
0
2
2
0

output:

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

result:

ok Accepted

Test #7:

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

input:

6
0
2
1
0
0
1
1
0

output:

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

result:

ok Accepted

Test #8:

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

input:

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

output:

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

result:

ok Accepted

Test #9:

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

input:

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

output:

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

result:

ok Accepted

Test #10:

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

input:

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

output:

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

result:

ok Accepted

Test #11:

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

input:

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

output:

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

result:

ok Accepted

Test #12:

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

input:

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

output:

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

result:

ok Accepted

Test #13:

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

input:

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

output:

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

result:

ok Accepted

Test #14:

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

input:

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

output:

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

result:

ok Accepted

Test #15:

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

input:

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

output:

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

result:

ok Accepted

Test #16:

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

input:

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

output:

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

result:

ok Accepted

Test #17:

score: 0
Accepted
time: 297ms
memory: 3712kb

input:

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

output:

0 44 954 470 96 657 18 541 95 554 414 412 362 395 242 374 80 399 68 961 793 117 413 596 170 448 223 969 964 102 141 307 217 890 849 230 789 355 931 953 590 321 780 621 809 725 450 368 376 199 622 203 325 742 306 883 759 219 521 291 722 755 437 191 616 461 458 866 380 509 212 882 611 684 956 840 906 ...

result:

ok Accepted

Test #18:

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

input:

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

output:

0 280 953 469 236 258 386 778 422 553 413 411 412 44 922 373 522 264 174 255 948 66 512 595 393 447 356 644 963 116 50 350 296 889 510 229 292 824 626 218 852 155 779 640 149 439 732 286 734 72 621 89 165 741 972 701 266 840 310 638 721 249 75 418 636 457 55 865 9 100 881 872 336 774 955 894 905 245...

result:

ok Accepted

Test #19:

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

input:

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

output:

0 44 954 470 96 657 18 541 95 554 414 412 362 395 242 374 80 399 68 961 793 117 413 596 170 448 223 969 964 102 141 307 217 890 849 230 789 355 931 953 590 321 780 621 809 725 450 368 376 199 622 203 325 742 306 883 759 219 521 291 722 755 437 191 616 461 458 866 380 509 212 882 611 684 956 840 906 ...

result:

ok Accepted

Test #20:

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

input:

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

output:

0 280 953 469 236 258 386 778 422 553 413 411 412 44 922 373 522 264 174 255 948 66 512 595 393 447 356 644 963 116 50 350 296 889 510 229 292 824 626 218 852 155 779 640 149 439 732 286 734 72 621 89 165 741 972 701 266 840 310 638 721 249 75 418 636 457 55 865 9 100 881 872 336 774 955 894 905 245...

result:

ok Accepted

Test #21:

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

input:

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

output:

0 44 954 470 96 657 18 541 95 554 414 412 362 395 242 374 80 399 68 961 793 117 413 596 170 448 223 969 964 102 141 307 217 890 849 230 789 355 931 953 590 321 780 621 809 725 450 368 376 199 622 203 325 742 306 883 759 219 521 291 722 755 437 191 616 461 458 866 380 509 212 882 611 684 956 840 906 ...

result:

ok Accepted

Test #22:

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

input:

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

output:

0 280 953 469 236 258 386 778 422 553 413 411 412 44 922 373 522 264 174 255 948 66 512 595 393 447 356 644 963 116 50 350 296 889 510 229 292 824 626 218 852 155 779 640 149 439 732 286 734 72 621 89 165 741 972 701 266 840 310 638 721 249 75 418 636 457 55 865 9 100 881 872 336 774 955 894 905 245...

result:

ok Accepted

Test #23:

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

input:

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

output:

0 44 954 470 96 657 18 541 95 554 414 412 362 395 242 374 80 399 68 961 793 117 413 596 170 448 223 969 964 102 141 307 217 890 849 230 789 355 931 953 590 321 780 621 809 725 450 368 376 199 622 203 325 742 306 883 759 219 521 291 722 755 437 191 616 461 458 866 380 509 212 882 611 684 956 840 906 ...

result:

ok Accepted

Test #24:

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

input:

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

output:

0 280 953 469 236 258 386 778 422 553 413 411 412 44 922 373 522 264 174 255 948 66 512 595 393 447 356 644 963 116 50 350 296 889 510 229 292 824 626 218 852 155 779 640 149 439 732 286 734 72 621 89 165 741 972 701 266 840 310 638 721 249 75 418 636 457 55 865 9 100 881 872 336 774 955 894 905 245...

result:

ok Accepted

Test #25:

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

input:

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

output:

0 44 954 470 96 657 18 541 95 554 414 412 362 395 242 374 80 399 68 961 793 117 413 596 170 448 223 969 964 102 141 307 217 890 849 230 789 355 931 953 590 321 780 621 809 725 450 368 376 199 622 203 325 742 306 883 759 219 521 291 722 755 437 191 616 461 458 866 380 509 212 882 611 684 956 840 906 ...

result:

ok Accepted

Test #26:

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

input:

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

output:

0 280 953 469 236 258 386 778 422 553 413 411 412 44 922 373 522 264 174 255 948 66 512 595 393 447 356 644 963 116 50 350 296 889 510 229 292 824 626 218 852 155 779 640 149 439 732 286 734 72 621 89 165 741 972 701 266 840 310 638 721 249 75 984 636 457 55 865 9 100 881 872 336 774 955 894 905 245...

result:

ok Accepted

Test #27:

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

input:

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

output:

0 44 954 470 96 657 18 541 95 554 414 412 362 395 242 374 80 399 68 961 793 117 413 596 170 448 223 969 964 102 141 307 217 890 849 230 789 355 931 953 590 321 780 621 809 725 450 368 376 199 622 203 325 742 306 883 759 219 521 291 722 755 437 191 616 461 458 866 380 509 212 882 611 684 956 840 906 ...

result:

ok Accepted

Test #28:

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

input:

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

output:

0 280 953 469 236 258 386 778 422 553 413 411 412 44 922 373 522 264 174 255 948 66 512 595 393 447 356 644 963 116 50 350 296 889 510 229 292 824 626 218 852 155 779 640 149 439 732 286 734 72 621 89 165 741 972 701 266 840 310 638 721 249 75 984 636 457 55 865 9 100 881 872 336 774 955 894 905 245...

result:

ok Accepted

Test #29:

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

input:

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

output:

0 44 954 470 96 657 18 541 95 554 414 412 362 395 242 374 80 399 68 961 793 117 413 596 170 448 223 969 964 102 141 307 217 890 849 230 789 355 931 953 590 321 780 621 809 725 450 368 376 199 622 203 325 742 306 883 759 219 521 291 722 755 437 191 616 461 458 866 380 509 212 882 611 684 956 840 906 ...

result:

ok Accepted

Test #30:

score: 0
Accepted
time: 308ms
memory: 3712kb

input:

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

output:

0 280 953 469 236 258 386 778 422 553 413 411 412 44 922 373 522 264 174 255 948 66 512 595 393 447 356 644 963 116 50 350 296 889 510 229 292 824 626 218 852 155 779 640 149 439 732 286 734 72 621 89 165 741 972 701 266 840 310 638 721 249 75 984 636 457 55 865 9 100 881 872 336 774 955 894 905 245...

result:

ok Accepted

Test #31:

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

input:

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

output:

0 44 954 470 96 657 18 541 95 554 414 412 362 395 242 374 80 399 68 961 793 117 413 596 170 448 223 969 964 102 141 307 217 890 849 230 789 355 931 953 590 321 780 621 809 725 450 368 376 199 622 203 325 742 306 883 759 219 521 291 722 755 437 191 616 461 458 866 380 509 212 882 611 684 956 840 906 ...

result:

ok Accepted

Test #32:

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

input:

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

output:

0 280 953 469 236 258 386 778 422 553 413 411 412 44 922 373 522 264 174 255 948 66 512 595 393 447 356 644 963 116 50 350 296 889 510 229 292 824 626 218 852 155 779 640 149 439 732 286 734 72 621 89 165 741 972 701 266 840 310 638 721 249 75 984 636 457 55 865 9 100 881 872 336 774 955 894 905 245...

result:

ok Accepted

Test #33:

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

input:

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

output:

0 44 954 470 96 657 18 541 95 554 414 412 362 395 242 374 80 399 68 961 793 117 413 596 170 448 223 969 964 102 141 307 217 890 849 230 789 355 931 953 590 321 780 621 809 725 450 368 376 199 622 203 325 742 306 883 759 219 521 291 722 755 437 191 616 461 458 866 380 509 212 882 611 684 956 840 906 ...

result:

ok Accepted

Test #34:

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

input:

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

output:

0 280 953 469 236 258 386 778 422 553 413 411 412 44 922 373 522 264 174 255 948 66 512 595 393 447 356 644 963 116 50 350 296 889 510 229 292 824 626 218 852 155 779 640 149 439 732 286 734 72 621 89 165 741 972 701 266 840 310 638 721 249 75 984 636 457 55 865 9 100 881 872 336 774 955 894 905 245...

result:

ok Accepted

Test #35:

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

input:

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

output:

0 44 954 470 96 657 18 541 95 554 414 412 362 395 242 374 80 399 68 961 793 117 413 596 170 448 223 969 964 102 141 307 217 890 849 230 789 355 931 953 590 321 780 621 809 725 450 368 376 199 622 203 325 742 306 883 759 219 521 291 722 755 437 191 616 461 458 866 380 509 212 882 611 684 956 840 906 ...

result:

ok Accepted

Test #36:

score: 0
Accepted
time: 289ms
memory: 4088kb

input:

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

output:

0 280 953 469 236 258 386 778 422 553 413 411 412 44 922 373 522 264 174 255 948 66 512 595 393 447 356 644 963 116 50 350 296 889 510 229 292 824 626 218 852 155 779 640 149 439 732 286 734 72 621 89 165 741 972 701 266 840 310 638 721 249 75 984 636 457 55 865 9 100 881 872 336 774 955 894 905 245...

result:

ok Accepted

Test #37:

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

input:

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

output:

0 44 954 470 96 657 18 541 95 554 414 412 362 395 242 374 80 399 68 961 793 117 413 596 170 448 223 969 964 102 141 307 217 890 849 230 789 355 931 953 590 321 780 621 809 725 450 368 376 199 622 203 325 995 306 883 759 219 521 291 722 755 437 191 616 461 458 866 380 509 212 882 611 684 956 840 906 ...

result:

ok Accepted

Test #38:

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

input:

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

output:

0 280 953 469 236 258 386 778 422 553 413 411 412 44 922 373 522 264 174 255 948 66 512 595 393 447 356 644 963 116 50 350 296 889 510 229 292 824 626 218 852 155 779 640 149 439 732 286 734 72 621 89 165 741 972 701 266 840 310 638 721 249 75 984 636 457 55 865 9 100 881 872 336 774 955 894 905 245...

result:

ok Accepted

Test #39:

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

input:

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

output:

0 44 954 470 96 657 18 541 95 554 414 412 362 395 242 374 80 399 68 961 793 117 413 596 170 448 223 969 964 102 141 307 217 890 849 230 789 355 931 953 590 321 780 621 809 725 450 368 376 199 622 203 325 995 306 883 759 219 521 291 722 755 437 191 616 461 458 866 380 509 212 882 611 684 956 840 906 ...

result:

ok Accepted

Test #40:

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

input:

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

output:

0 280 953 469 236 258 386 778 422 553 413 411 412 44 922 373 522 264 174 255 948 66 512 595 393 447 356 644 963 116 50 350 296 889 510 229 292 824 626 218 852 155 779 640 149 439 732 286 734 72 621 89 165 741 972 701 266 840 310 638 721 249 75 984 636 457 55 865 9 100 881 872 336 774 955 894 905 245...

result:

ok Accepted

Test #41:

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

input:

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

output:

0 44 954 470 96 657 18 541 95 554 414 412 362 395 242 374 80 399 68 961 793 117 413 596 170 448 223 969 964 102 141 307 217 890 849 230 789 355 931 953 590 321 780 621 809 725 450 368 376 199 622 203 325 995 306 883 759 219 521 291 722 755 437 191 616 461 458 866 380 509 212 882 611 684 956 840 906 ...

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed