QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#740693#9432. PermutationHuluoboAC ✓304ms3920kbC++143.8kb2024-11-13 11:09:022024-11-13 11:09:02

詳細信息

Test #1:

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

input:

5
2
0
2
2
0

output:

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

result:

ok Accepted

Test #2:

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

input:

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

output:

0 925 925 902 925 902 925 925 902 925 925 925 925 902 902 925 925 925 925 925 902 902 925 925 925 925 902 925 925 902 925 925 925 902 902 902 925 902 902 902 902 925 902 925 925 925 902 902 902 925 925 902 925 925 925 902 925 925 925 925 925 902 925 925 902 925 902 925 925 925 925 925 902 925 925 90...

result:

ok Accepted

Test #3:

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

input:

1

output:

1 1 

result:

ok Accepted

Test #4:

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

input:

2
2

output:

0 2 1 
1 2 1 

result:

ok Accepted

Test #5:

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

input:

3
2
2

output:

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

result:

ok Accepted

Test #6:

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

input:

4
2
2
0
0

output:

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

result:

ok Accepted

Test #7:

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

input:

6
0
2
0
1
0
0
0
2

output:

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

result:

ok Accepted

Test #8:

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

input:

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

output:

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

result:

ok Accepted

Test #9:

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

input:

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

output:

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

result:

ok Accepted

Test #10:

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

input:

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

output:

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

result:

ok Accepted

Test #11:

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

input:

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

output:

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

result:

ok Accepted

Test #12:

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

input:

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

output:

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

result:

ok Accepted

Test #13:

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

input:

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

output:

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

result:

ok Accepted

Test #14:

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

input:

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

output:

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

result:

ok Accepted

Test #15:

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

input:

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

output:

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

result:

ok Accepted

Test #16:

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

input:

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

output:

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

result:

ok Accepted

Test #17:

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

input:

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

output:

0 535 535 535 535 535 623 535 535 623 535 535 535 535 535 623 623 623 535 535 623 623 535 535 623 623 623 623 535 535 623 535 535 535 535 623 535 535 535 535 623 623 535 535 535 535 535 623 535 535 535 535 535 623 623 535 535 623 535 623 535 535 535 623 623 535 535 535 535 535 535 623 535 535 535 53...

result:

ok Accepted

Test #18:

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

input:

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

output:

0 326 326 879 879 879 879 326 879 879 879 326 879 879 879 326 879 326 326 879 326 326 326 879 879 879 879 326 326 879 326 326 879 879 326 326 326 879 879 326 326 879 879 326 879 879 326 326 326 326 879 879 326 326 879 879 879 879 326 879 879 326 326 326 326 326 879 879 879 326 326 326 879 879 326 32...

result:

ok Accepted

Test #19:

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

input:

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

output:

0 933 550 550 933 933 933 933 933 550 933 550 933 933 550 550 550 933 933 933 933 933 933 550 933 550 550 933 550 550 550 933 933 550 933 933 550 933 550 933 933 550 550 550 933 933 933 550 933 550 550 933 933 550 550 550 550 550 933 550 933 550 933 933 933 550 550 550 550 550 933 550 550 550 550 55...

result:

ok Accepted

Test #20:

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

input:

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

output:

0 432 432 432 694 432 432 694 694 694 432 694 694 694 432 432 694 432 694 432 432 694 432 694 432 432 694 432 694 432 694 694 432 432 432 432 694 432 432 432 432 694 694 694 694 694 432 432 694 432 694 694 432 432 694 432 432 694 694 432 694 694 694 694 694 694 694 432 432 694 694 432 694 694 694 69...

result:

ok Accepted

Test #21:

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

input:

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

output:

0 263 802 802 263 802 263 263 802 802 802 263 263 802 263 802 802 263 263 263 802 263 263 802 263 263 802 263 802 802 263 802 802 263 263 263 802 263 263 802 802 263 802 802 263 802 802 263 802 802 802 263 802 802 263 263 263 802 263 802 263 263 263 802 802 802 802 802 263 263 802 802 802 802 263 80...

result:

ok Accepted

Test #22:

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

input:

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

output:

0 45 45 45 45 743 743 743 45 45 743 45 743 743 45 45 743 743 45 45 743 45 45 743 743 45 743 743 743 45 743 45 743 45 45 743 743 743 743 45 743 743 743 45 45 45 45 45 45 45 743 45 743 743 45 743 45 45 743 45 45 45 743 45 743 45 743 743 45 743 45 743 743 743 45 45 743 45 743 45 743 743 45 45 743 743 4...

result:

ok Accepted

Test #23:

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

input:

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

output:

0 740 740 373 373 373 740 740 740 740 373 373 740 373 740 373 740 373 740 373 740 373 740 373 373 740 740 373 740 373 740 373 373 373 740 740 373 373 740 373 740 740 740 740 740 373 740 740 740 373 740 740 740 373 373 740 373 740 740 373 740 373 373 740 740 740 740 740 373 373 740 740 373 373 740 74...

result:

ok Accepted

Test #24:

score: 0
Accepted
time: 288ms
memory: 3636kb

input:

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

output:

0 425 534 534 425 425 534 534 534 425 534 425 425 534 534 534 425 425 425 425 425 534 534 425 534 425 425 425 425 425 534 534 534 534 425 425 534 425 534 534 534 425 534 425 534 534 425 425 425 534 425 425 425 534 534 534 425 534 425 534 534 534 425 534 534 534 534 534 425 534 534 425 534 534 425 42...

result:

ok Accepted

Test #25:

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

input:

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

output:

0 74 74 74 74 534 74 534 534 74 534 74 74 74 534 74 74 74 534 534 74 74 534 74 534 534 534 534 534 74 534 534 74 534 74 74 534 534 74 74 534 534 534 74 74 74 534 534 74 74 74 534 534 534 534 74 74 534 534 74 74 74 534 74 74 74 74 534 534 74 534 534 74 74 534 534 74 534 534 74 534 74 534 534 534 74 7...

result:

ok Accepted

Test #26:

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

input:

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

output:

0 771 934 934 934 934 771 771 934 934 771 934 934 934 771 934 771 771 771 934 771 934 771 771 771 771 934 934 934 934 934 934 771 934 934 771 771 771 771 771 771 771 771 771 771 771 771 771 934 771 934 771 934 771 934 771 934 771 934 934 771 771 771 771 934 934 934 771 771 771 934 934 771 934 934 93...

result:

ok Accepted

Test #27:

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

input:

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

output:

0 708 728 728 728 728 728 728 728 708 728 708 728 728 728 708 708 708 708 728 708 728 708 708 728 708 708 708 728 708 728 728 708 708 708 708 708 728 708 728 728 708 728 708 708 728 708 728 728 708 708 708 708 708 728 728 728 708 728 728 728 708 728 728 708 728 728 708 708 708 728 728 708 728 708 70...

result:

ok Accepted

Test #28:

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

input:

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

output:

0 62 62 948 62 948 948 62 62 948 948 948 948 948 948 62 62 62 62 948 62 948 62 948 948 62 62 948 948 62 62 62 948 62 948 62 62 948 62 948 948 62 62 948 948 62 62 948 62 948 62 948 948 62 62 948 948 948 62 62 948 62 948 62 62 948 948 948 62 62 948 62 62 948 62 948 948 948 62 948 62 62 62 62 948 62 94...

result:

ok Accepted

Test #29:

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

input:

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

output:

0 97 219 97 219 219 97 219 219 219 97 97 97 97 97 219 97 97 97 97 97 219 219 219 97 219 97 219 97 97 97 97 97 97 97 219 219 219 97 219 97 97 219 219 97 219 97 97 219 219 97 97 97 97 219 219 219 97 97 219 219 97 97 219 219 219 97 97 219 97 219 219 97 97 219 219 97 97 97 97 219 219 97 97 219 219 219 2...

result:

ok Accepted

Test #30:

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

input:

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

output:

0 751 835 751 751 751 751 835 835 835 751 835 835 835 751 835 751 835 835 835 835 835 751 835 835 835 751 835 835 835 751 835 835 751 751 751 835 835 751 751 835 835 835 835 835 751 751 835 835 835 835 835 751 751 751 835 751 751 835 751 751 835 751 751 751 751 751 751 835 835 835 835 751 835 751 75...

result:

ok Accepted

Test #31:

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

input:

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

output:

0 485 485 419 485 485 419 485 485 419 485 485 419 419 485 419 419 419 419 485 419 419 485 485 485 419 485 419 485 419 485 419 485 419 419 485 485 485 485 485 485 419 485 485 419 419 419 485 419 419 419 485 419 485 485 485 419 419 419 485 419 485 419 419 419 419 419 419 419 485 485 419 485 485 485 41...

result:

ok Accepted

Test #32:

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

input:

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

output:

0 285 770 770 770 285 770 770 285 770 285 770 770 770 285 285 285 285 285 770 285 285 770 770 285 285 285 285 285 285 285 285 285 285 285 770 770 285 770 285 770 770 770 285 285 285 770 770 285 285 770 285 285 770 770 285 770 770 770 285 285 770 770 770 770 285 770 285 770 285 285 770 285 770 285 77...

result:

ok Accepted

Test #33:

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

input:

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

output:

0 492 492 492 492 492 492 702 702 702 702 702 492 702 702 492 492 492 492 492 492 492 492 702 492 702 702 492 492 492 702 492 492 702 702 492 702 492 492 492 492 492 702 702 492 702 702 492 702 492 702 492 492 702 492 492 492 702 492 702 702 492 702 702 702 702 492 702 702 702 702 702 492 492 492 70...

result:

ok Accepted

Test #34:

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

input:

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

output:

0 664 891 664 664 891 664 664 664 664 664 891 664 891 664 891 664 891 891 664 891 664 891 891 664 664 891 664 664 664 891 891 891 664 664 664 664 891 664 664 891 891 891 891 891 891 664 664 891 891 664 664 664 891 891 664 891 664 664 664 891 891 891 891 664 891 664 664 664 891 891 664 891 664 891 66...

result:

ok Accepted

Test #35:

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

input:

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

output:

0 920 484 484 484 920 920 484 484 920 484 920 920 484 920 484 484 920 484 920 484 484 484 484 484 484 920 920 484 920 920 920 484 920 484 484 920 484 920 920 484 920 920 920 484 920 484 920 920 484 920 484 484 920 484 484 484 484 484 920 920 484 920 484 484 484 484 920 484 484 484 920 484 484 920 92...

result:

ok Accepted

Test #36:

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

input:

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

output:

0 30 30 985 30 30 30 985 30 30 30 985 985 985 985 30 30 30 30 30 985 985 985 985 985 30 985 985 30 985 30 30 985 30 985 30 30 30 985 985 985 30 30 30 30 30 30 985 30 985 985 985 30 30 30 30 985 30 30 30 30 985 30 985 985 985 30 30 30 30 985 985 30 985 985 30 30 30 30 985 30 30 30 985 985 30 30 985 9...

result:

ok Accepted

Test #37:

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

input:

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

output:

0 121 121 121 850 121 121 121 121 121 850 121 850 850 850 850 121 850 121 850 850 121 121 121 850 850 121 121 121 121 850 850 850 121 121 121 121 121 121 121 121 121 121 121 850 850 850 121 121 121 121 850 850 121 121 121 121 121 850 850 850 121 121 121 121 850 121 850 850 850 850 121 850 121 121 85...

result:

ok Accepted

Test #38:

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

input:

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

output:

0 621 621 621 621 486 621 486 486 486 621 621 621 621 486 621 621 486 621 621 621 621 621 486 621 621 486 621 621 486 621 486 486 621 621 621 621 486 486 486 486 621 486 621 621 486 486 486 621 621 621 621 621 486 621 621 621 486 621 486 486 621 486 486 621 621 486 486 621 621 621 621 486 486 621 48...

result:

ok Accepted

Test #39:

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

input:

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

output:

0 617 798 798 617 617 617 798 798 617 798 617 617 798 617 617 798 617 617 798 617 617 617 617 617 798 617 798 798 617 617 798 798 798 798 617 798 798 798 617 798 798 617 798 617 617 798 617 617 798 798 617 798 617 798 798 798 798 798 798 617 617 617 617 798 617 617 617 617 798 617 617 617 617 617 79...

result:

ok Accepted

Test #40:

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

input:

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

output:

0 303 303 658 303 303 303 658 658 303 303 658 658 303 658 658 303 658 303 658 303 658 658 303 658 303 303 658 303 303 658 658 303 658 658 658 303 303 658 303 303 303 303 303 303 658 658 658 303 303 658 303 303 303 303 303 658 303 303 658 658 658 303 303 303 303 658 303 658 658 303 658 658 658 658 30...

result:

ok Accepted

Test #41:

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

input:

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

output:

0 363 481 481 363 481 363 363 363 363 481 363 481 363 363 363 481 481 363 363 363 363 363 481 481 481 481 363 363 481 481 363 481 481 363 481 481 363 363 363 363 363 481 363 481 363 363 363 481 481 481 363 363 481 363 363 363 363 481 363 363 363 363 363 481 481 481 363 481 481 481 481 481 363 363 36...

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed