QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#740391#9432. PermutationHuluoboAC ✓293ms4212kbC++143.0kb2024-11-13 09:37:512024-11-13 09:37:55

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
1
0
0
2
1
0
2

output:

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

result:

ok Accepted

Test #2:

score: 0
Accepted
time: 269ms
memory: 3928kb

input:

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

output:

0 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 288 28...

result:

ok Accepted

Test #3:

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

input:

1

output:

1 1 

result:

ok Accepted

Test #4:

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

input:

2
0

output:

0 1 2 
1 2 1 

result:

ok Accepted

Test #5:

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

input:

3
2
1
2

output:

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

result:

ok Accepted

Test #6:

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

input:

4
0
0
0
0

output:

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

result:

ok Accepted

Test #7:

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

input:

6
1
0
1
0
1
0
0
0
1
0

output:

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

result:

ok Accepted

Test #8:

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

input:

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

output:

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

result:

ok Accepted

Test #9:

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

input:

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

output:

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

result:

ok Accepted

Test #10:

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

input:

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

output:

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

result:

ok Accepted

Test #11:

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

input:

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

output:

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

result:

ok Accepted

Test #12:

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

input:

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

output:

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

result:

ok Accepted

Test #13:

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

input:

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

output:

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

result:

ok Accepted

Test #14:

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

input:

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

output:

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

result:

ok Accepted

Test #15:

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

input:

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

output:

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

result:

ok Accepted

Test #16:

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

input:

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

output:

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

result:

ok Accepted

Test #17:

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

input:

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

output:

0 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 338 33...

result:

ok Accepted

Test #18:

score: 0
Accepted
time: 268ms
memory: 3988kb

input:

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

output:

0 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 275 27...

result:

ok Accepted

Test #19:

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

input:

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

output:

0 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 295 29...

result:

ok Accepted

Test #20:

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

input:

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

output:

0 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 34...

result:

ok Accepted

Test #21:

score: 0
Accepted
time: 268ms
memory: 4204kb

input:

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

output:

0 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 882 88...

result:

ok Accepted

Test #22:

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

input:

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

output:

0 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 67...

result:

ok Accepted

Test #23:

score: 0
Accepted
time: 273ms
memory: 3916kb

input:

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

output:

0 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 635 63...

result:

ok Accepted

Test #24:

score: 0
Accepted
time: 273ms
memory: 3964kb

input:

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

output:

0 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 38...

result:

ok Accepted

Test #25:

score: 0
Accepted
time: 264ms
memory: 3916kb

input:

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

output:

0 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 94...

result:

ok Accepted

Test #26:

score: 0
Accepted
time: 269ms
memory: 4212kb

input:

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

output:

0 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 44...

result:

ok Accepted

Test #27:

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

input:

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

output:

0 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 608 60...

result:

ok Accepted

Test #28:

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

input:

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

output:

0 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 22...

result:

ok Accepted

Test #29:

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

input:

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

output:

0 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 53...

result:

ok Accepted

Test #30:

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

input:

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

output:

0 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 481 48...

result:

ok Accepted

Test #31:

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

input:

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

output:

0 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 81...

result:

ok Accepted

Test #32:

score: 0
Accepted
time: 262ms
memory: 4192kb

input:

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

output:

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

result:

ok Accepted

Test #33:

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

input:

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

output:

0 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 25...

result:

ok Accepted

Test #34:

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

input:

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

output:

0 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 34...

result:

ok Accepted

Test #35:

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

input:

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

output:

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

result:

ok Accepted

Test #36:

score: 0
Accepted
time: 273ms
memory: 3900kb

input:

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

output:

0 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 482 48...

result:

ok Accepted

Test #37:

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

input:

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

output:

0 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 46...

result:

ok Accepted

Test #38:

score: 0
Accepted
time: 285ms
memory: 3972kb

input:

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

output:

0 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 646 64...

result:

ok Accepted

Test #39:

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

input:

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

output:

0 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 13...

result:

ok Accepted

Test #40:

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

input:

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

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 #41:

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

input:

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

output:

0 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 56...

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed