QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#740762#9432. PermutationHuluoboAC ✓292ms4120kbC++142.9kb2024-11-13 11:23:032024-11-13 11:23:11

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
0
2
2
0
0

output:

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

result:

ok Accepted

Test #2:

score: 0
Accepted
time: 283ms
memory: 4036kb

input:

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

output:

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

result:

ok Accepted

Test #3:

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

input:

1

output:

1 1 

result:

ok Accepted

Test #4:

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

input:

2
2

output:

0 2 1 
1 2 1 

result:

ok Accepted

Test #5:

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

input:

3
0
0

output:

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

result:

ok Accepted

Test #6:

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

input:

4
2
2
0
2

output:

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

result:

ok Accepted

Test #7:

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

input:

6
0
0
0
2
2
2
0

output:

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

result:

ok Accepted

Test #8:

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

input:

7
2
2
1
0
1
2
0
2
0
0

output:

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

result:

ok Accepted

Test #9:

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

input:

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

output:

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

result:

ok Accepted

Test #10:

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

input:

9
0
2
2
0
2
2
2
0
0
2
2
0
0

output:

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

result:

ok Accepted

Test #11:

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

input:

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

output:

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

result:

ok Accepted

Test #12:

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

input:

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

output:

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

result:

ok Accepted

Test #13:

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

input:

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

output:

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

result:

ok Accepted

Test #14:

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

input:

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

output:

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

result:

ok Accepted

Test #15:

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

input:

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

output:

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

result:

ok Accepted

Test #16:

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

input:

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

output:

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

result:

ok Accepted

Test #17:

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

input:

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

output:

0 975 975 1 1 975 1 975 1 975 1 975 1 1 975 1 975 975 975 975 1 1 975 1 1 975 975 1 1 975 1 975 1 1 1 975 975 975 1 975 1 975 975 1 1 1 975 975 1 975 975 1 975 975 1 1 1 975 1 975 1 975 975 1 1 1 1 975 975 1 975 975 975 1 975 1 975 1 1 1 1 975 975 1 975 1 975 975 1 1 975 975 1 975 975 1 1 1 1 975 97...

result:

ok Accepted

Test #18:

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

input:

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

output:

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

result:

ok Accepted

Test #19:

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

input:

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

output:

0 977 977 977 1 977 977 1 1 977 977 977 1 977 977 1 1 1 1 1 977 977 1 1 1 977 1 1 1 977 1 1 1 1 1 1 977 1 1 1 977 1 977 1 1 977 977 977 977 1 977 1 1 977 977 1 1 977 1 977 977 1 1 1 977 977 1 1 977 977 1 977 977 1 1 1 977 1 1 977 977 977 977 977 977 977 977 977 977 977 1 1 1 1 1 977 1 977 1 1 977 97...

result:

ok Accepted

Test #20:

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

input:

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

output:

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

result:

ok Accepted

Test #21:

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

input:

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

output:

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

result:

ok Accepted

Test #22:

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

input:

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

output:

0 980 1 1 980 1 980 980 980 1 980 980 1 1 980 980 1 1 980 980 980 980 1 980 1 980 980 980 1 980 1 1 980 1 1 1 980 1 980 1 980 980 1 1 1 980 980 1 1 1 980 1 980 1 980 1 980 1 980 980 980 980 1 1 1 1 1 980 980 1 980 1 980 1 1 1 980 980 980 980 980 1 980 980 980 980 1 1 980 1 1 980 1 1 980 1 1 1 980 98...

result:

ok Accepted

Test #23:

score: 0
Accepted
time: 252ms
memory: 4008kb

input:

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

output:

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

result:

ok Accepted

Test #24:

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

input:

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

output:

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

result:

ok Accepted

Test #25:

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

input:

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

output:

0 983 1 983 983 1 1 983 983 983 1 983 983 983 1 1 1 1 1 1 983 983 983 983 983 1 983 983 1 1 983 1 1 983 983 1 1 1 983 983 983 1 983 1 983 1 1 1 983 1 983 983 1 1 983 983 1 983 1 983 1 1 983 1 1 983 1 1 1 1 983 1 1 1 1 983 1 983 983 983 1 983 1 983 983 983 1 1 1 983 1 1 1 1 1 983 1 1 983 1 983 1 1 98...

result:

ok Accepted

Test #26:

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

input:

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

output:

0 1 984 1 984 1 984 984 984 1 1 984 984 1 984 984 1 1 1 984 1 984 1 1 984 1 1 984 1 984 1 1 984 984 984 1 984 984 1 1 1 1 1 984 1 1 1 984 1 1 984 984 1 1 1 1 984 1 984 1 984 1 984 984 984 1 1 984 1 984 984 984 984 1 984 984 1 1 984 984 984 984 1 984 984 1 1 1 1 984 1 984 984 1 1 984 984 984 1 984 98...

result:

ok Accepted

Test #27:

score: 0
Accepted
time: 263ms
memory: 4008kb

input:

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

output:

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

result:

ok Accepted

Test #28:

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

input:

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

output:

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

result:

ok Accepted

Test #29:

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

input:

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

output:

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

result:

ok Accepted

Test #30:

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

input:

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

output:

0 988 988 988 1 988 988 1 1 1 988 988 988 988 1 1 988 1 1 1 1 1 988 1 988 1 988 1 988 988 988 988 1 988 1 988 1 988 988 1 1 988 988 988 1 988 1 1 1 1 988 1 1 988 1 1 988 1 1 988 988 988 1 988 1 988 1 1 988 988 1 988 1 1 988 988 1 1 1 988 1 1 988 1 1 1 988 1 988 1 1 1 988 1 988 1 988 988 1 1 988 1 98...

result:

ok Accepted

Test #31:

score: 0
Accepted
time: 266ms
memory: 4060kb

input:

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

output:

0 1 989 989 1 989 989 989 989 1 1 1 1 989 1 1 989 1 1 989 989 1 989 989 989 1 1 1 1 989 1 1 989 1 1 1 1 989 1 1 989 1 989 989 989 989 989 1 989 1 1 1 989 1 989 1 1 989 989 1 989 1 989 1 1 1 1 1 989 989 1 1 989 1 989 1 1 1 989 1 1 989 1 989 1 989 989 989 989 1 1 989 1 1 989 1 989 989 1 989 989 989 98...

result:

ok Accepted

Test #32:

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

input:

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

output:

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

result:

ok Accepted

Test #33:

score: 0
Accepted
time: 288ms
memory: 4120kb

input:

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

output:

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

result:

ok Accepted

Test #34:

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

input:

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

output:

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

result:

ok Accepted

Test #35:

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

input:

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

output:

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

result:

ok Accepted

Test #36:

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

input:

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

output:

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

result:

ok Accepted

Test #37:

score: 0
Accepted
time: 281ms
memory: 3756kb

input:

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

output:

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

result:

ok Accepted

Test #38:

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

input:

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

output:

0 1 996 1 1 1 996 996 996 1 996 1 996 1 996 996 1 1 996 1 1 1 1 996 1 996 1 1 1 996 1 996 1 1 1 1 996 996 1 996 1 996 1 996 1 1 996 996 1 996 1 996 996 1 996 996 1 996 1 996 1 1 996 1 1 1 996 996 996 1 1 1 1 996 996 996 1 1 996 996 996 1 996 1 1 996 1 1 996 996 996 996 996 1 996 996 1 1 996 996 1 99...

result:

ok Accepted

Test #39:

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

input:

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

output:

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

result:

ok Accepted

Test #40:

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

input:

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

output:

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

result:

ok Accepted

Test #41:

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

input:

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

output:

0 999 999 1 999 1 999 1 1 1 1 1 1 999 999 1 1 1 999 1 999 999 1 1 999 999 999 1 999 1 999 1 1 999 1 999 1 999 1 1 999 999 999 1 999 1 999 1 1 999 1 999 999 999 999 1 1 999 1 999 999 999 999 999 999 1 1 1 1 1 1 999 999 999 999 999 999 1 999 1 999 999 999 1 999 1 999 999 999 1 1 1 999 999 999 999 1 99...

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed