QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#598048#9432. Permutationucup-team5063#AC ✓241ms3940kbC++207.7kb2024-09-28 20:14:002024-09-28 20:14:01

详细

Test #1:

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

input:

5
1
1
0
0
1
0
1
1
1
2

output:

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

result:

ok Accepted

Test #2:

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

input:

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

output:

0 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 437 43...

result:

ok Accepted

Test #3:

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

input:

1

output:

1 1

result:

ok Accepted

Test #4:

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

input:

2
0

output:

0 1 2 
1 2 1 

result:

ok Accepted

Test #5:

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

input:

3
1
2
0

output:

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

result:

ok Accepted

Test #6:

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

input:

4
1
1
0
0
1
0

output:

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

result:

ok Accepted

Test #7:

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

input:

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

output:

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

result:

ok Accepted

Test #8:

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

input:

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

output:

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

result:

ok Accepted

Test #9:

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

input:

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

output:

0 1 2 2 2 2 2 2 2 
0 1 1 2 2 2 2 2 2 
0 1 1 1 2 2 2 2 2 
0 1 3 3 3 3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4 4 
0 2 2 2 2 2 2 4 4 4 4 
0 2 2 2 2 2 2 2 4 4 4 
0 2 5 5 5 5 5 5 5 5 5 
0...

result:

ok Accepted

Test #12:

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

input:

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

output:

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

result:

ok Accepted

Test #13:

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

input:

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

output:

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

result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 2 2 2 2 3 3 3 3...

result:

ok Accepted

Test #16:

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

input:

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

output:

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

result:

ok Accepted

Test #17:

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

input:

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

output:

0 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 23...

result:

ok Accepted

Test #18:

score: 0
Accepted
time: 224ms
memory: 3936kb

input:

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

output:

0 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 30...

result:

ok Accepted

Test #19:

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

input:

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

output:

0 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 51...

result:

ok Accepted

Test #20:

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

input:

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

output:

0 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 90...

result:

ok Accepted

Test #21:

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

input:

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

output:

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

result:

ok Accepted

Test #22:

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

input:

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

output:

0 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 561 56...

result:

ok Accepted

Test #23:

score: 0
Accepted
time: 225ms
memory: 3648kb

input:

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

output:

0 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 402 40...

result:

ok Accepted

Test #24:

score: 0
Accepted
time: 193ms
memory: 3716kb

input:

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

output:

0 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 289 28...

result:

ok Accepted

Test #25:

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

input:

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

output:

0 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 72...

result:

ok Accepted

Test #26:

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

input:

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

output:

0 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 85...

result:

ok Accepted

Test #27:

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

input:

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

output:

0 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 5...

result:

ok Accepted

Test #28:

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

input:

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

output:

0 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 ...

result:

ok Accepted

Test #29:

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

input:

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

output:

0 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 83...

result:

ok Accepted

Test #30:

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

input:

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

output:

0 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 9...

result:

ok Accepted

Test #31:

score: 0
Accepted
time: 232ms
memory: 3940kb

input:

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

output:

0 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 42...

result:

ok Accepted

Test #32:

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

input:

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

output:

0 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 524 52...

result:

ok Accepted

Test #33:

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

input:

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

output:

0 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 47...

result:

ok Accepted

Test #34:

score: 0
Accepted
time: 215ms
memory: 3648kb

input:

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

output:

0 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 951 95...

result:

ok Accepted

Test #35:

score: 0
Accepted
time: 221ms
memory: 3716kb

input:

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

output:

0 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 22...

result:

ok Accepted

Test #36:

score: 0
Accepted
time: 217ms
memory: 3716kb

input:

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

output:

0 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 74...

result:

ok Accepted

Test #37:

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

input:

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

output:

0 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 39...

result:

ok Accepted

Test #38:

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

input:

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

output:

0 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 97...

result:

ok Accepted

Test #39:

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

input:

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

output:

0 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 53...

result:

ok Accepted

Test #40:

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

input:

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

output:

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

result:

ok Accepted

Test #41:

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

input:

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

output:

0 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 55...

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed