QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#744199#9432. PermutationMaMengQiAC ✓309ms3908kbC++141.1kb2024-11-13 21:08:142024-11-13 21:08:14

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
1
0
2
0
0
2

output:

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

result:

ok Accepted

Test #2:

score: 0
Accepted
time: 309ms
memory: 3620kb

input:

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

output:

0 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 591 59...

result:

ok Accepted

Test #3:

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

input:

1

output:

1 1 

result:

ok Accepted

Test #4:

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

input:

2
0

output:

0 1 2 
1 2 1 

result:

ok Accepted

Test #5:

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

input:

3
2
2

output:

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

result:

ok Accepted

Test #6:

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

input:

4
0
0
0
2

output:

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

result:

ok Accepted

Test #7:

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

input:

6
1
2
0
1
0
0
1
0
2

output:

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

result:

ok Accepted

Test #8:

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

input:

7
0
0
1
0
2
2
2
2
2
0

output:

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

result:

ok Accepted

Test #9:

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

input:

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

output:

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

result:

ok Accepted

Test #10:

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

input:

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

output:

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

result:

ok Accepted

Test #11:

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

input:

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

output:

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

result:

ok Accepted

Test #12:

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

input:

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

output:

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

result:

ok Accepted

Test #13:

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

input:

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

output:

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

result:

ok Accepted

Test #14:

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

input:

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

output:

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

result:

ok Accepted

Test #15:

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

input:

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

output:

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

result:

ok Accepted

Test #16:

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

input:

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

output:

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

result:

ok Accepted

Test #17:

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

input:

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

output:

0 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 60...

result:

ok Accepted

Test #18:

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

input:

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

output:

0 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 77...

result:

ok Accepted

Test #19:

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

input:

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

output:

0 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 82...

result:

ok Accepted

Test #20:

score: 0
Accepted
time: 292ms
memory: 3692kb

input:

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

output:

0 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 1...

result:

ok Accepted

Test #21:

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

input:

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

output:

0 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 82...

result:

ok Accepted

Test #22:

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

input:

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

output:

0 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 21...

result:

ok Accepted

Test #23:

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

input:

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

output:

0 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 2...

result:

ok Accepted

Test #24:

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

input:

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

output:

0 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 544 54...

result:

ok Accepted

Test #25:

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

input:

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

output:

0 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 508 50...

result:

ok Accepted

Test #26:

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

input:

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

output:

0 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 90...

result:

ok Accepted

Test #27:

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

input:

985
2
0
0
0
1
1
2
0
1
2
0
1
0
1
1
2
0
1
2
1
0
1
0
1
1
1
1
0
2
0
1
2
1
1
1
1
2
2
1
1
0
1
0
2
1
0
2
1
1
1
2
1
1
2
2
1
2
2
1
0
0
1
0
1
0
0
0
1
2
1
1
1
0
1
2
2
0
1
1
1
2
2
2
2
1
1
1
1
0
1
1
1
1
2
0
2
0
0
2
1
0
1
0
0
2
0
1
0
0
1
2
1
0
2
1
1
1
1
0
0
1
0
2
2
1
0
0
1
1
0
1
1
2
1
1
2
1
2
2
1
2
2
1
0
1
0
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 #28:

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

input:

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

output:

0 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 97...

result:

ok Accepted

Test #29:

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

input:

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

output:

0 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 30...

result:

ok Accepted

Test #30:

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

input:

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

output:

0 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 766 76...

result:

ok Accepted

Test #31:

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

input:

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

output:

0 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 292 29...

result:

ok Accepted

Test #32:

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

input:

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

output:

0 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 9...

result:

ok Accepted

Test #33:

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

input:

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

output:

0 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 55...

result:

ok Accepted

Test #34:

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

input:

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

output:

0 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 15...

result:

ok Accepted

Test #35:

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

input:

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

output:

0 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 12...

result:

ok Accepted

Test #36:

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

input:

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

output:

0 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 24...

result:

ok Accepted

Test #37:

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

input:

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

output:

0 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 5...

result:

ok Accepted

Test #38:

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

input:

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

output:

0 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 56...

result:

ok Accepted

Test #39:

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

input:

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

output:

0 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 72...

result:

ok Accepted

Test #40:

score: 0
Accepted
time: 291ms
memory: 3908kb

input:

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

output:

0 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 443 44...

result:

ok Accepted

Test #41:

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

input:

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

output:

0 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 860 86...

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed