QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#748329#9432. PermutationHuluoboAC ✓227ms3960kbC++142.6kb2024-11-14 20:03:172024-11-14 20:03:19

详细

Test #1:

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

input:

5
2
0
1
1
2
0
2

output:

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

result:

ok Accepted

Test #2:

score: 0
Accepted
time: 211ms
memory: 3740kb

input:

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

output:

0 1000 1000 1000 1000 1000 999 999 1000 999 999 1000 999 999 999 999 1000 1000 1000 1000 1000 999 1000 1000 1000 999 1000 999 1000 999 999 1000 999 999 999 1000 999 999 999 999 999 1000 1000 1000 1000 999 1000 999 999 999 1000 1000 1000 1000 1000 1000 999 1000 999 999 999 999 1000 1000 999 999 999 9...

result:

ok Accepted

Test #3:

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

input:

1

output:

1 1 

result:

ok Accepted

Test #4:

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

input:

2
2

output:

0 2 1 
1 2 1 

result:

ok Accepted

Test #5:

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

input:

3
1
2
0

output:

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

result:

ok Accepted

Test #6:

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

input:

4
1
0
1
0
2

output:

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

result:

ok Accepted

Test #7:

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

input:

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

output:

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

result:

ok Accepted

Test #8:

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

input:

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

output:

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

result:

ok Accepted

Test #9:

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

input:

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

output:

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

result:

ok Accepted

Test #10:

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

input:

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

output:

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

result:

ok Accepted

Test #11:

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

input:

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

output:

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

result:

ok Accepted

Test #12:

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

input:

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

output:

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

result:

ok Accepted

Test #13:

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

input:

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

output:

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

result:

ok Accepted

Test #14:

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

input:

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

output:

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

result:

ok Accepted

Test #15:

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

input:

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

output:

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

result:

ok Accepted

Test #16:

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

input:

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

output:

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

result:

ok Accepted

Test #17:

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

input:

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

output:

0 975 974 974 974 974 975 975 975 975 974 974 975 974 975 975 975 975 974 974 975 975 975 974 975 975 974 974 974 974 974 974 974 974 974 974 975 975 975 974 975 975 975 974 974 975 974 975 974 974 975 975 974 975 974 975 975 974 975 975 975 975 975 975 975 974 974 974 975 974 975 975 975 974 974 97...

result:

ok Accepted

Test #18:

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

input:

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

output:

0 976 976 976 976 976 975 975 976 975 975 975 975 976 975 975 976 976 976 976 976 975 976 976 976 976 976 975 975 975 975 976 975 975 975 976 975 975 975 975 975 976 976 976 976 975 976 975 975 975 976 976 976 976 976 976 975 976 975 975 975 975 976 976 975 975 975 975 976 976 975 976 975 976 976 97...

result:

ok Accepted

Test #19:

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

input:

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

output:

0 977 976 976 976 976 977 977 977 977 976 976 977 976 977 977 977 977 976 976 977 977 977 976 977 977 976 976 976 976 976 976 976 976 976 976 977 977 977 976 977 977 977 976 976 977 976 977 976 976 977 977 976 977 976 977 977 976 977 977 977 977 977 977 977 976 976 976 977 976 977 977 977 976 976 97...

result:

ok Accepted

Test #20:

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

input:

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

output:

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

result:

ok Accepted

Test #21:

score: 0
Accepted
time: 213ms
memory: 3672kb

input:

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

output:

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

result:

ok Accepted

Test #22:

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

input:

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

output:

0 980 980 980 980 980 979 979 980 979 979 979 979 979 979 979 980 980 980 980 980 979 980 980 980 980 980 979 980 979 979 980 979 979 979 980 979 979 979 979 979 980 980 980 980 979 980 979 979 979 980 980 980 980 980 980 979 980 979 979 979 979 980 980 979 979 979 979 980 980 979 980 979 980 980 97...

result:

ok Accepted

Test #23:

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

input:

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

output:

0 981 980 980 980 980 981 981 981 981 980 981 981 980 981 981 981 981 980 980 981 981 981 980 981 981 980 980 980 980 980 980 980 980 980 980 981 981 981 980 981 981 981 980 980 981 980 981 980 980 981 981 980 981 980 981 981 980 981 981 981 980 981 981 981 980 980 980 981 980 981 981 981 980 980 98...

result:

ok Accepted

Test #24:

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

input:

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

output:

0 982 982 982 982 982 981 981 982 981 981 982 981 981 981 981 982 982 982 982 982 981 982 982 982 982 982 981 982 981 981 982 981 981 981 982 981 981 981 981 981 982 982 982 982 981 982 981 981 981 982 982 982 982 982 982 981 982 981 981 981 981 982 982 981 981 981 981 982 982 981 982 981 982 982 98...

result:

ok Accepted

Test #25:

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

input:

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

output:

0 983 982 982 982 982 983 983 983 983 982 983 983 982 983 983 983 983 982 982 983 983 983 982 983 983 982 982 982 982 982 982 982 982 982 982 983 983 983 982 983 983 983 982 982 983 982 983 982 982 983 983 982 983 982 983 983 982 983 983 983 982 983 983 983 982 982 982 983 982 983 983 983 982 982 98...

result:

ok Accepted

Test #26:

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

input:

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

output:

0 984 984 984 984 984 983 983 984 983 983 984 983 983 983 983 984 984 984 984 984 983 984 984 984 984 984 983 984 983 983 984 983 983 983 984 983 983 983 983 983 984 984 984 984 983 984 983 983 983 984 984 984 984 984 984 983 984 983 983 983 983 984 984 983 983 983 983 984 984 983 984 983 984 984 98...

result:

ok Accepted

Test #27:

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

input:

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

output:

0 985 984 984 984 984 985 985 985 985 984 985 985 984 985 985 985 985 984 984 985 985 985 984 985 985 984 984 984 984 984 984 984 984 984 984 985 985 985 984 985 985 985 984 984 985 984 985 984 984 985 985 984 985 984 985 985 984 985 985 985 984 985 985 985 984 984 984 985 984 985 985 985 984 984 98...

result:

ok Accepted

Test #28:

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

input:

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

output:

0 986 986 986 986 986 985 985 986 985 985 986 985 985 985 985 986 986 986 986 986 985 986 986 986 985 986 985 986 985 985 986 985 985 985 986 985 985 985 985 985 986 986 986 986 985 986 985 985 985 986 986 986 986 986 986 985 986 985 985 985 985 986 986 985 985 985 985 986 986 985 986 985 986 986 98...

result:

ok Accepted

Test #29:

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

input:

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

output:

0 987 986 986 986 986 987 987 987 987 986 987 987 986 987 987 987 987 986 986 987 987 987 986 987 987 986 986 986 986 986 986 986 986 986 986 987 987 987 986 987 987 987 986 986 987 986 987 986 986 987 987 986 987 986 987 987 986 987 987 987 986 987 987 987 986 986 986 987 986 987 987 987 986 986 98...

result:

ok Accepted

Test #30:

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

input:

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

output:

0 988 988 988 988 988 987 987 988 987 987 988 987 987 987 987 988 988 988 988 988 987 988 988 988 987 988 987 988 987 987 988 987 987 987 988 987 987 987 987 987 988 988 988 988 987 988 987 987 987 988 988 988 988 988 988 987 988 987 987 987 987 988 988 987 987 987 987 988 988 987 988 987 988 988 98...

result:

ok Accepted

Test #31:

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

input:

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

output:

0 989 988 988 988 988 989 989 989 989 988 989 989 988 989 989 989 989 988 988 989 989 989 988 989 989 988 988 988 988 988 988 988 988 988 988 988 989 989 988 989 989 989 988 988 989 988 989 988 988 989 989 988 989 988 989 989 988 989 989 989 988 989 989 989 988 988 988 989 988 989 989 989 988 988 98...

result:

ok Accepted

Test #32:

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

input:

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

output:

0 990 990 990 990 990 989 989 990 989 989 990 989 989 989 989 990 990 990 990 990 989 990 990 990 989 990 989 990 989 989 990 989 989 989 990 989 989 989 989 989 990 990 990 990 989 990 989 989 989 990 990 990 990 990 990 989 990 989 989 989 989 990 990 989 989 989 989 990 990 989 990 989 990 990 98...

result:

ok Accepted

Test #33:

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

input:

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

output:

0 991 990 990 990 990 991 991 991 991 990 991 991 990 991 991 991 991 990 990 991 991 991 990 991 991 990 990 990 990 990 990 990 990 990 990 990 991 991 990 991 991 991 990 990 991 990 991 990 990 991 991 990 991 990 991 991 990 991 991 991 990 991 991 991 990 990 990 991 990 991 991 991 990 990 99...

result:

ok Accepted

Test #34:

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

input:

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

output:

0 992 992 992 992 992 991 991 992 991 991 992 991 991 991 991 992 992 992 992 992 991 992 992 992 991 992 991 992 991 991 992 991 991 991 992 991 991 991 991 991 992 992 992 992 991 992 991 991 991 992 992 992 992 992 992 991 992 991 991 991 991 992 992 991 991 991 991 992 992 991 992 991 992 992 99...

result:

ok Accepted

Test #35:

score: 0
Accepted
time: 212ms
memory: 3952kb

input:

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

output:

0 993 992 992 992 992 993 993 993 993 992 993 993 992 993 993 993 993 992 992 993 993 993 992 993 993 992 992 992 992 992 992 992 992 992 992 992 993 993 992 993 993 993 992 992 993 992 993 992 992 993 993 992 993 992 993 993 992 993 993 993 992 993 993 993 992 992 992 993 992 993 993 993 992 992 99...

result:

ok Accepted

Test #36:

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

input:

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

output:

0 994 994 994 994 994 993 993 994 993 993 994 993 993 993 993 994 994 994 994 994 993 994 994 994 993 994 993 994 993 993 994 993 993 993 994 993 993 993 993 993 994 994 994 994 993 994 993 993 993 994 994 994 994 994 994 993 994 993 993 993 993 994 994 993 993 993 993 994 994 993 994 993 994 994 99...

result:

ok Accepted

Test #37:

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

input:

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

output:

0 995 994 994 994 994 995 995 995 995 994 995 995 994 995 995 995 995 994 994 995 995 995 994 995 995 994 994 994 994 994 994 994 994 994 994 994 995 995 994 995 995 995 994 994 995 994 995 994 994 995 995 994 995 994 995 995 994 995 995 995 994 995 995 995 994 994 994 995 994 995 995 995 994 994 99...

result:

ok Accepted

Test #38:

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

input:

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

output:

0 996 996 996 996 996 995 995 996 995 995 996 995 995 995 995 996 996 996 996 996 995 996 996 996 995 996 995 996 995 995 996 995 995 995 996 995 995 995 995 995 996 996 996 996 995 996 995 995 995 996 996 996 996 996 996 995 996 995 995 995 995 996 996 995 995 995 995 996 996 995 996 995 996 996 99...

result:

ok Accepted

Test #39:

score: 0
Accepted
time: 204ms
memory: 3960kb

input:

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

output:

0 997 996 996 996 996 997 997 997 997 996 997 997 996 997 997 997 997 996 996 997 997 997 996 997 997 996 996 996 996 996 996 996 996 996 996 996 997 997 996 997 997 997 996 996 997 996 997 996 996 997 997 996 997 996 997 997 996 997 997 997 996 997 997 997 996 996 996 997 996 997 997 997 996 996 99...

result:

ok Accepted

Test #40:

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

input:

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

output:

0 998 998 998 998 998 997 997 998 997 997 998 997 997 997 997 998 998 998 998 998 997 998 998 998 997 998 997 998 997 997 998 997 997 997 998 997 997 997 997 997 998 998 998 998 997 998 997 997 997 998 998 998 998 998 998 997 998 997 997 997 997 998 998 997 997 997 997 998 998 997 998 997 997 998 99...

result:

ok Accepted

Test #41:

score: 0
Accepted
time: 214ms
memory: 3944kb

input:

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

output:

0 999 998 998 998 998 999 999 999 999 998 999 999 998 999 999 999 999 998 998 999 999 999 998 999 999 998 998 998 998 998 998 998 998 998 998 998 999 999 998 999 999 999 998 998 999 998 999 998 998 999 999 998 999 998 999 999 998 999 999 999 998 999 999 999 998 998 998 999 998 999 999 999 998 998 99...

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed