QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#741206#9432. PermutationHuluoboAC ✓216ms3856kbC++141.8kb2024-11-13 13:48:012024-11-13 13:48:02

详细

Test #1:

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

input:

5
0
0
0
0
2

output:

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

result:

ok Accepted

Test #2:

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

input:

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

output:

0 714 714 984 714 714 714 714 714 714 984 714 714 984 984 714 984 984 714 984 984 984 714 984 714 714 984 984 714 714 984 714 714 714 984 714 984 714 714 984 714 984 714 984 984 984 984 984 984 984 984 984 984 714 714 714 984 984 984 984 984 984 984 714 714 984 714 984 984 984 984 984 984 984 714 98...

result:

ok Accepted

Test #3:

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

input:

1

output:

1 1 

result:

ok Accepted

Test #4:

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

input:

2
0

output:

0 1 2 
1 2 1 

result:

ok Accepted

Test #5:

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

input:

3
2
0

output:

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

result:

ok Accepted

Test #6:

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

input:

4
0
0
0
0

output:

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

result:

ok Accepted

Test #7:

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

input:

6
1
0
0
1
0
2
0
2

output:

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

result:

ok Accepted

Test #8:

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

input:

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

output:

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

result:

ok Accepted

Test #9:

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

input:

8
2
2
2
2
0
2
0
0
2
2
0
2

output:

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

result:

ok Accepted

Test #10:

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

input:

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

output:

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

result:

ok Accepted

Test #11:

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

input:

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

output:

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

result:

ok Accepted

Test #12:

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

input:

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

output:

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

result:

ok Accepted

Test #13:

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

input:

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

output:

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

result:

ok Accepted

Test #14:

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

input:

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

output:

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

result:

ok Accepted

Test #15:

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

input:

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

output:

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

result:

ok Accepted

Test #16:

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

input:

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

output:

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

result:

ok Accepted

Test #17:

score: 0
Accepted
time: 183ms
memory: 3572kb

input:

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

output:

0 696 696 868 696 696 696 696 696 696 868 696 696 696 868 696 868 868 696 868 868 868 696 868 696 696 868 868 696 696 868 696 696 696 868 696 868 696 696 868 696 868 696 868 868 868 868 868 868 868 868 868 868 696 696 868 868 868 868 868 868 868 868 696 696 868 696 868 868 868 868 868 868 868 696 86...

result:

ok Accepted

Test #18:

score: 0
Accepted
time: 189ms
memory: 3564kb

input:

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

output:

0 7 7 89 7 7 7 7 7 7 89 7 7 7 89 7 89 89 7 89 89 89 7 89 7 7 89 89 7 7 89 7 7 7 89 7 89 7 7 89 7 89 7 89 89 89 89 89 89 89 89 89 89 7 7 89 89 89 89 89 89 89 89 7 7 89 7 89 89 89 89 89 89 89 7 89 7 89 7 89 7 89 7 89 89 7 89 89 7 7 89 89 89 89 7 7 89 89 7 7 7 7 89 7 89 7 89 89 89 89 7 89 7 7 7 89 7 7 ...

result:

ok Accepted

Test #19:

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

input:

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

output:

0 855 855 373 855 855 855 855 855 855 373 855 855 855 373 855 373 373 855 373 373 373 855 373 855 855 373 373 855 855 373 855 855 855 373 855 373 855 855 373 855 373 855 373 373 373 373 373 373 373 373 373 373 855 855 373 373 373 373 373 373 373 373 855 855 373 855 373 373 373 373 373 373 373 855 37...

result:

ok Accepted

Test #20:

score: 0
Accepted
time: 199ms
memory: 3856kb

input:

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

output:

0 716 716 852 716 716 716 716 716 716 852 716 716 716 852 716 852 852 716 852 852 852 716 852 716 716 852 852 716 716 852 716 716 716 852 716 852 716 716 852 716 852 716 852 852 852 852 852 852 852 852 852 852 716 716 852 852 852 852 852 852 852 852 716 716 852 716 852 852 852 852 852 852 852 716 85...

result:

ok Accepted

Test #21:

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

input:

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

output:

0 582 582 710 582 582 582 582 582 582 710 582 582 582 710 582 710 710 582 710 710 710 582 710 582 582 710 710 582 582 710 582 582 582 710 582 710 582 582 710 582 710 582 710 710 710 710 710 710 710 710 710 710 582 582 710 710 710 710 710 710 710 710 582 582 710 582 710 710 710 710 710 710 710 582 71...

result:

ok Accepted

Test #22:

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

input:

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

output:

0 821 821 789 821 821 821 821 821 821 789 821 821 821 789 821 789 789 821 789 789 789 821 789 821 821 789 789 821 821 789 821 821 821 789 821 789 821 821 789 821 789 821 789 789 789 789 789 789 789 789 789 789 821 821 789 789 789 789 789 789 789 789 821 821 789 821 789 789 789 789 789 789 789 821 78...

result:

ok Accepted

Test #23:

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

input:

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

output:

0 318 318 741 318 318 318 318 318 318 741 318 318 318 741 318 741 741 318 741 741 741 318 741 318 318 741 741 318 318 741 318 318 318 741 318 741 318 318 741 318 741 318 741 741 741 741 741 741 741 741 741 741 318 318 741 741 741 741 741 741 741 741 318 318 741 318 741 741 741 741 741 741 741 318 74...

result:

ok Accepted

Test #24:

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

input:

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

output:

0 242 242 786 242 242 242 242 242 242 786 242 242 242 786 242 786 786 242 786 786 786 242 786 242 242 786 786 242 242 786 242 242 242 786 242 786 242 242 786 242 786 242 786 786 786 786 786 786 786 786 786 786 242 242 786 786 786 786 786 786 786 786 242 242 786 242 786 786 786 786 786 786 786 242 78...

result:

ok Accepted

Test #25:

score: 0
Accepted
time: 201ms
memory: 3640kb

input:

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

output:

0 228 228 529 228 228 228 228 228 228 529 228 228 228 529 228 529 529 228 529 529 529 228 529 228 228 529 529 228 228 529 228 228 228 529 228 529 228 228 529 228 529 228 529 529 529 529 529 529 529 529 529 529 228 228 529 529 529 529 529 529 529 529 228 228 529 228 529 529 529 529 529 529 529 228 52...

result:

ok Accepted

Test #26:

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

input:

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

output:

0 584 584 576 584 584 584 584 584 584 576 584 584 584 576 584 576 576 584 576 576 576 584 576 584 584 576 576 584 584 576 584 584 584 576 584 576 584 584 576 584 576 584 576 576 576 576 576 576 576 576 576 576 584 584 576 576 576 576 576 576 576 576 584 584 576 584 576 576 576 576 576 576 576 584 57...

result:

ok Accepted

Test #27:

score: 0
Accepted
time: 190ms
memory: 3856kb

input:

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

output:

0 201 201 337 201 201 201 201 201 201 337 201 201 201 337 201 337 337 201 337 337 337 201 337 201 201 337 337 201 201 337 201 201 201 337 201 337 201 201 337 201 337 201 337 337 337 337 337 337 337 337 337 337 201 201 337 337 337 337 337 337 337 337 201 201 337 201 337 337 337 337 337 337 337 201 33...

result:

ok Accepted

Test #28:

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

input:

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

output:

0 5 5 759 5 5 5 5 5 5 759 5 5 5 759 5 759 759 5 759 759 759 5 759 5 5 759 759 5 5 759 5 5 5 759 5 759 5 5 759 5 759 5 759 759 759 759 759 759 759 759 759 759 5 5 759 759 759 759 759 759 759 759 5 5 759 5 759 759 759 759 759 759 759 5 759 5 759 5 759 5 759 5 759 759 5 759 759 5 5 759 759 759 759 5 5 ...

result:

ok Accepted

Test #29:

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

input:

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

output:

0 116 116 431 116 116 116 116 116 116 431 116 116 116 431 116 431 431 116 431 431 431 116 431 116 116 431 431 116 116 431 116 116 116 431 116 431 116 116 431 116 431 116 431 431 431 431 431 431 431 431 431 431 116 116 431 431 431 431 431 431 431 431 116 116 431 116 431 431 431 431 431 431 431 116 43...

result:

ok Accepted

Test #30:

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

input:

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

output:

0 450 450 118 450 450 450 450 450 450 118 450 450 450 118 450 118 118 450 118 118 118 450 118 450 450 118 118 450 450 118 450 450 450 118 450 118 450 450 118 450 118 450 118 118 118 118 118 118 118 118 118 118 450 450 118 118 118 118 118 118 118 118 450 450 118 450 118 118 118 118 118 118 118 450 11...

result:

ok Accepted

Test #31:

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

input:

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

output:

0 446 446 328 446 446 446 446 446 446 328 446 446 328 328 446 328 328 446 328 328 328 446 328 446 446 328 328 446 446 328 446 446 446 328 446 328 446 446 328 446 328 446 328 328 328 328 328 328 328 328 328 328 446 446 328 328 328 328 328 328 328 328 446 446 328 446 328 328 328 328 328 328 328 446 32...

result:

ok Accepted

Test #32:

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

input:

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

output:

0 55 55 647 55 55 55 55 55 55 647 55 55 647 647 55 647 647 55 647 647 647 55 647 55 55 647 647 55 55 647 55 55 55 647 55 647 55 55 647 55 647 55 647 647 647 647 647 647 647 647 647 647 55 55 55 647 647 647 647 647 647 647 55 55 647 55 647 647 647 647 647 647 647 55 647 55 647 55 647 55 647 55 647 64...

result:

ok Accepted

Test #33:

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

input:

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

output:

0 442 442 839 442 442 442 442 442 442 839 442 442 839 839 442 839 839 442 839 839 839 442 839 442 442 839 839 442 442 839 442 442 442 839 442 839 442 442 839 442 839 442 839 839 839 839 839 839 839 839 839 839 442 442 442 839 839 839 839 839 839 839 442 442 839 442 839 839 839 839 839 839 839 442 83...

result:

ok Accepted

Test #34:

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

input:

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

output:

0 646 646 628 646 646 646 646 646 646 628 646 646 628 628 646 628 628 646 628 628 628 646 628 646 646 628 628 646 646 628 646 646 646 628 646 628 646 646 628 646 628 646 628 628 628 628 628 628 628 628 628 628 646 646 646 628 628 628 628 628 628 628 646 646 628 646 628 628 628 628 628 628 628 646 62...

result:

ok Accepted

Test #35:

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

input:

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

output:

0 985 985 350 985 985 985 985 985 985 350 985 985 350 350 985 350 350 985 350 350 350 985 350 985 985 350 350 985 985 350 985 985 985 350 985 350 985 985 350 985 350 985 350 350 350 350 350 350 350 350 350 350 985 985 985 350 350 350 350 350 350 350 985 985 350 985 350 350 350 350 350 350 350 985 35...

result:

ok Accepted

Test #36:

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

input:

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

output:

0 63 63 568 63 63 63 63 63 63 568 63 63 568 568 63 568 568 63 568 568 568 63 568 63 63 568 568 63 63 568 63 63 63 568 63 568 63 63 568 63 568 63 568 568 568 568 568 568 568 568 568 568 63 63 63 568 568 568 568 568 568 568 63 63 568 63 568 568 568 568 568 568 568 63 568 63 568 63 568 63 568 63 568 56...

result:

ok Accepted

Test #37:

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

input:

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

output:

0 995 995 422 995 995 995 995 995 995 422 995 995 422 422 995 422 422 995 422 422 422 995 422 995 995 422 422 995 995 422 995 995 995 422 995 422 995 995 422 995 422 995 422 422 422 422 422 422 422 422 422 422 995 995 995 422 422 422 422 422 422 422 995 995 422 995 422 422 422 422 422 422 422 995 42...

result:

ok Accepted

Test #38:

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

input:

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

output:

0 861 861 829 861 861 861 861 861 861 829 861 861 829 829 861 829 829 861 829 829 829 861 829 861 861 829 829 861 861 829 861 861 861 829 861 829 861 861 829 861 829 861 829 829 829 829 829 829 829 829 829 829 861 861 861 829 829 829 829 829 829 829 861 861 829 861 829 829 829 829 829 829 829 861 82...

result:

ok Accepted

Test #39:

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

input:

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

output:

0 932 932 669 932 932 932 932 932 932 669 932 932 669 669 932 669 669 932 669 669 669 932 669 932 932 669 669 932 932 669 932 932 932 669 932 669 932 932 669 932 669 932 669 669 669 669 669 669 669 669 669 669 932 932 932 669 669 669 669 669 669 669 932 932 669 932 669 669 669 669 669 669 669 932 66...

result:

ok Accepted

Test #40:

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

input:

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

output:

0 983 983 763 983 983 983 983 983 983 763 983 983 763 763 983 763 763 983 763 763 763 983 763 983 983 763 763 983 983 763 983 983 983 763 983 763 983 983 763 983 763 983 763 763 763 763 763 763 763 763 763 763 983 983 983 763 763 763 763 763 763 763 983 983 763 983 763 763 763 763 763 763 763 983 76...

result:

ok Accepted

Test #41:

score: 0
Accepted
time: 213ms
memory: 3572kb

input:

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

output:

0 778 778 6 778 778 778 778 778 778 6 778 778 6 6 778 6 6 778 6 6 6 778 6 778 778 6 6 778 778 6 778 778 778 6 778 6 778 778 6 778 6 778 6 6 6 6 6 6 6 6 6 6 778 778 778 6 6 6 6 6 6 6 778 778 6 778 6 6 6 6 6 6 6 778 6 778 6 778 6 778 6 778 6 6 778 6 6 778 778 6 6 6 6 778 778 6 6 778 778 778 778 6 778 ...

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed