QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#738414#9432. PermutationHuluoboAC ✓271ms4124kbC++143.1kb2024-11-12 19:00:462024-11-12 19:00:50

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
0
1
0
1
2
0
0

output:

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

result:

ok Accepted

Test #2:

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

input:

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

output:

0 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 59...

result:

ok Accepted

Test #3:

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

input:

1

output:

1 1 

result:

ok Accepted

Test #4:

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

input:

2
2

output:

0 2 1 
1 2 1 

result:

ok Accepted

Test #5:

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

input:

3
1
2
2

output:

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

result:

ok Accepted

Test #6:

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

input:

4
1
0
0
0

output:

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

result:

ok Accepted

Test #7:

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

input:

6
1
1
2
2
2
0
0
0

output:

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

result:

ok Accepted

Test #8:

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

input:

7
2
0
2
2
2
0
0
1
0
0

output:

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

result:

ok Accepted

Test #9:

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

input:

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

output:

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

result:

ok Accepted

Test #10:

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

input:

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

output:

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

result:

ok Accepted

Test #11:

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

input:

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

output:

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

result:

ok Accepted

Test #12:

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

input:

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

output:

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

result:

ok Accepted

Test #13:

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

input:

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

output:

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

result:

ok Accepted

Test #14:

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

input:

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

output:

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

result:

ok Accepted

Test #15:

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

input:

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

output:

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

result:

ok Accepted

Test #16:

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

input:

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

output:

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

result:

ok Accepted

Test #17:

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

input:

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

output:

0 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 673 67...

result:

ok Accepted

Test #18:

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

input:

976
1
2
1
2
1
1
0
1
1
0
1
1
0
1
2
0
1
1
1
1
2
0
1
2
1
2
1
1
2
2
0
1
1
1
0
0
2
0
1
0
0
2
2
0
0
2
1
1
1
2
2
1
0
2
2
1
0
1
1
1
1
1
0
0
2
1
2
1
1
1
1
1
1
1
0
2
0
1
1
1
2
1
1
0
0
1
2
2
1
1
1
0
1
2
0
2
0
2
1
0
1
0
1
2
1
0
1
0
0
1
2
1
2
0
0
0
1
1
1
1
0
1
1
1
0
1
0
1
1
0
1
2
2
1
1
2
2
2
0
2
1
1
0
0
1
2
0
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 #19:

score: 0
Accepted
time: 260ms
memory: 3828kb

input:

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

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

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

input:

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

output:

0 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 45...

result:

ok Accepted

Test #21:

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

input:

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

output:

0 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 5...

result:

ok Accepted

Test #22:

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

input:

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

output:

0 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 1...

result:

ok Accepted

Test #23:

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

input:

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

output:

0 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 95...

result:

ok Accepted

Test #24:

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

input:

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

output:

0 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 45...

result:

ok Accepted

Test #25:

score: 0
Accepted
time: 248ms
memory: 4096kb

input:

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

output:

0 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 63...

result:

ok Accepted

Test #26:

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

input:

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

output:

0 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 44...

result:

ok Accepted

Test #27:

score: 0
Accepted
time: 242ms
memory: 4096kb

input:

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

output:

0 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 27...

result:

ok Accepted

Test #28:

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

input:

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

output:

0 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 6...

result:

ok Accepted

Test #29:

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

input:

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

output:

0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2...

result:

ok Accepted

Test #30:

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

input:

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

output:

0 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 777 77...

result:

ok Accepted

Test #31:

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

input:

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

output:

0 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 58...

result:

ok Accepted

Test #32:

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

input:

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

output:

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

result:

ok Accepted

Test #33:

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

input:

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

output:

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

result:

ok Accepted

Test #34:

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

input:

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

output:

0 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 26...

result:

ok Accepted

Test #35:

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

input:

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

output:

0 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 ...

result:

ok Accepted

Test #36:

score: 0
Accepted
time: 235ms
memory: 4104kb

input:

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

output:

0 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 83...

result:

ok Accepted

Test #37:

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

input:

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

output:

0 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 6...

result:

ok Accepted

Test #38:

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

input:

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

output:

0 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 43...

result:

ok Accepted

Test #39:

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

input:

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

output:

0 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 299 29...

result:

ok Accepted

Test #40:

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

input:

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

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: 248ms
memory: 3884kb

input:

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

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

Extra Test:

score: 0
Extra Test Passed