QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#599437#9432. Permutationucup-team2054#AC ✓311ms3992kbC++176.4kb2024-09-29 04:47:312024-09-29 04:47:31

详细

Test #1:

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

input:

5
2
0
0
1
0
2
2

output:

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

result:

ok Accepted

Test #2:

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

input:

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

output:

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

result:

ok Accepted

Test #3:

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

input:

1

output:

1 1 

result:

ok Accepted

Test #4:

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

input:

2
0
2
2
0

output:

0 1 2 
0 2 1 
0 2 1 
0 1 2 
1 2 1 

result:

ok Accepted

Test #5:

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

input:

3
0
2
2

output:

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

result:

ok Accepted

Test #6:

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

input:

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

output:

0 4 4 1 1 
0 1 1 4 4 
0 1 4 4 4 
0 4 1 4 4 
0 3 1 1 3 
0 1 3 3 1 
0 3 2 2 3 
0 2 3 3 2 
0 3 3 3 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: 3768kb

input:

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

output:

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

result:

ok Accepted

Test #8:

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

input:

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

output:

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

result:

ok Accepted

Test #9:

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

input:

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

output:

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

result:

ok Accepted

Test #10:

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

input:

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

output:

0 9 9 2 2 2 9 2 9 9 
0 2 2 9 9 9 2 9 2 2 
0 9 9 2 2 2 9 2 9 9 
0 2 2 9 9 9 2 9 2 2 
0 9 9 6 6 6 9 6 9 9 
0 6 6 9 9 9 6 9 6 6 
0 9 9 9 9 5 9 5 9 9 
0 9 9 5 5 9 9 9 9 9 
0 9 9 9 9 9 9 2 9 9 
0 9 9 9 9 2 9 9 9 9 
0 1 1 1 1 1 2 2 2 2 
0 1 1 1 1 9 9 9 9 9 
0 1 1 2 2 1 1 1 1 1 
0 1 1 9 9 9 9 9 9 9 
0 1 1 ...

result:

ok Accepted

Test #11:

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

input:

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

output:

0 3 10 3 10 3 3 10 10 10 3 
0 10 3 10 3 10 10 3 3 3 10 
0 7 10 7 10 7 7 10 10 10 7 
0 10 7 10 7 10 10 7 7 7 10 
0 10 10 10 10 6 6 10 10 10 10 
0 6 10 6 10 10 10 10 10 10 6 
0 10 10 10 10 10 10 10 10 10 2 
0 2 10 2 10 10 10 10 10 10 10 
0 2 10 10 10 10 10 10 10 10 10 
0 10 10 2 10 10 10 10 10 10 10 
...

result:

ok Accepted

Test #12:

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

input:

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

output:

0 11 3 11 3 11 11 3 11 11 3 3 
0 3 11 3 11 3 3 11 3 3 11 11 
0 11 7 11 7 11 11 7 11 11 7 7 
0 7 11 7 11 7 7 11 7 7 11 11 
0 4 11 4 11 11 11 11 4 11 11 11 
0 11 11 11 11 4 4 11 11 4 11 11 
0 11 11 11 11 11 11 11 7 11 11 11 
0 7 11 7 11 11 11 11 11 11 11 11 
0 1 1 1 1 1 2 2 1 2 2 2 
0 2 2 1 1 2 1 1 1 ...

result:

ok Accepted

Test #13:

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

input:

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

output:

0 11 12 11 12 11 11 11 12 12 11 12 12 
0 12 11 12 11 12 12 12 11 11 12 11 11 
0 3 12 3 12 3 3 3 12 12 3 12 12 
0 12 3 12 3 12 12 12 3 3 12 3 3 
0 12 7 12 12 12 12 12 12 12 12 7 7 
0 12 12 12 7 12 12 12 7 7 12 12 12 
0 12 12 12 3 12 12 12 12 12 12 12 12 
0 12 12 12 12 12 12 12 3 3 12 12 12 
0 12 12 1...

result:

ok Accepted

Test #14:

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

input:

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

output:

0 13 12 13 12 13 12 12 13 13 12 12 13 13 
0 12 13 12 13 12 13 13 12 12 13 13 12 12 
0 13 3 13 3 13 3 3 13 13 3 3 13 13 
0 3 13 3 13 3 13 13 3 3 13 13 3 3 
0 13 9 13 9 13 9 9 13 13 9 9 13 13 
0 9 13 9 13 9 13 13 9 9 13 13 9 9 
0 13 5 13 5 13 5 5 13 13 5 5 13 13 
0 5 13 5 13 5 13 13 5 5 13 13 5 5 
0 1...

result:

ok Accepted

Test #15:

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

input:

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

output:

0 4 14 4 14 4 4 4 4 14 4 14 14 14 14 
0 14 4 14 4 14 14 14 14 4 14 4 4 4 4 
0 9 14 9 14 9 9 9 9 14 9 14 14 14 14 
0 14 9 14 9 14 14 14 14 9 14 9 9 9 9 
0 5 14 5 14 5 5 5 5 14 5 14 14 14 14 
0 14 5 14 5 14 14 14 14 5 14 5 5 5 5 
0 14 14 14 14 3 3 3 14 14 14 14 14 14 14 
0 3 14 3 14 14 14 14 3 14 3 14...

result:

ok Accepted

Test #16:

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

input:

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

output:

0 15 4 15 4 15 4 4 15 4 4 4 15 15 15 15 
0 4 15 4 15 4 15 15 4 15 15 15 4 4 4 4 
0 15 10 15 10 15 10 10 15 10 10 10 15 15 15 15 
0 10 15 10 15 10 15 15 10 15 15 15 10 10 10 10 
0 15 15 15 5 15 15 5 15 5 15 15 15 15 15 15 
0 15 5 15 15 15 5 15 15 15 5 5 15 15 15 15 
0 15 15 15 15 15 15 15 15 15 3 3 1...

result:

ok Accepted

Test #17:

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

input:

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

output:

0 260 975 975 975 975 260 260 260 260 975 975 260 975 260 260 260 260 975 975 260 260 260 975 260 260 975 975 975 975 975 975 975 975 975 975 260 260 260 975 260 260 260 975 975 260 975 260 975 975 260 260 975 260 975 260 260 975 260 260 260 260 260 260 260 975 975 975 260 975 260 260 260 975 975 97...

result:

ok Accepted

Test #18:

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

input:

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

output:

0 907 907 907 907 907 976 976 907 976 976 976 976 907 976 976 907 907 907 907 907 976 907 907 907 907 907 976 976 976 976 907 976 976 976 907 976 976 976 976 976 907 907 907 907 976 907 976 976 976 907 907 907 907 907 907 976 907 976 976 976 976 907 907 976 976 976 976 907 907 976 907 976 907 907 97...

result:

ok Accepted

Test #19:

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

input:

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

output:

0 908 977 977 977 977 908 908 908 908 977 977 908 977 908 908 908 908 977 977 908 908 908 977 908 908 977 977 977 977 977 977 977 977 977 977 908 908 908 977 908 908 908 977 977 908 977 908 977 977 908 908 977 908 977 908 908 977 908 908 908 908 908 908 908 977 977 977 908 977 908 908 908 977 977 97...

result:

ok Accepted

Test #20:

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

input:

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

output:

0 239 239 239 239 239 978 978 239 978 978 978 978 239 978 978 239 239 239 239 239 978 239 239 239 239 239 978 239 978 978 239 978 978 978 239 978 978 978 978 978 239 239 239 239 978 239 978 978 978 239 239 239 239 239 239 978 239 978 978 978 978 239 239 978 978 978 978 239 239 978 239 978 239 239 97...

result:

ok Accepted

Test #21:

score: 0
Accepted
time: 298ms
memory: 3644kb

input:

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

output:

0 240 979 979 979 979 240 240 240 240 979 979 240 979 240 240 240 240 979 979 240 240 240 979 240 240 979 979 979 979 979 979 979 979 979 979 240 240 240 979 240 240 240 979 979 240 979 240 979 979 240 240 979 240 979 240 240 979 240 240 240 979 240 240 240 979 979 979 240 979 240 240 240 979 979 97...

result:

ok Accepted

Test #22:

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

input:

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

output:

0 716 716 716 716 716 980 980 716 980 980 980 980 980 980 980 716 716 716 716 716 980 716 716 716 716 716 980 716 980 980 716 980 980 980 716 980 980 980 980 980 716 716 716 716 980 716 980 980 980 716 716 716 716 716 716 980 716 980 980 980 980 716 716 980 980 980 980 716 716 980 716 980 716 716 98...

result:

ok Accepted

Test #23:

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

input:

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

output:

0 717 981 981 981 981 717 717 717 717 981 981 717 981 717 717 717 717 981 981 717 717 717 981 717 717 981 981 981 981 981 981 981 981 981 981 717 717 717 981 717 717 717 981 981 717 981 717 981 981 717 717 981 717 981 717 717 981 717 717 717 981 717 717 717 981 981 981 717 981 717 717 717 981 981 98...

result:

ok Accepted

Test #24:

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

input:

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

output:

0 99 99 99 99 99 982 982 99 982 982 99 982 982 982 982 99 99 99 99 99 982 99 99 99 99 99 982 99 982 982 99 982 982 982 99 982 982 982 982 982 99 99 99 99 982 99 982 982 982 99 99 99 99 99 99 982 99 982 982 982 982 99 99 982 982 982 982 99 99 982 99 982 99 99 982 99 99 982 99 99 99 99 982 982 982 982...

result:

ok Accepted

Test #25:

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

input:

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

output:

0 100 983 983 983 983 100 100 100 100 983 100 100 983 100 100 100 100 983 983 100 100 100 983 100 100 983 983 983 983 983 983 983 983 983 983 100 100 100 983 100 100 100 983 983 100 983 100 983 983 100 100 983 100 983 100 100 983 100 100 100 983 100 100 100 983 983 983 100 983 100 100 100 983 983 98...

result:

ok Accepted

Test #26:

score: 0
Accepted
time: 307ms
memory: 3732kb

input:

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

output:

0 481 481 481 481 481 984 984 481 984 984 481 984 984 984 984 481 481 481 481 481 984 481 481 481 481 481 984 481 984 984 481 984 984 984 481 984 984 984 984 984 481 481 481 481 984 481 984 984 984 481 481 481 481 481 481 984 481 984 984 984 984 481 481 984 984 984 984 481 481 984 481 984 481 481 98...

result:

ok Accepted

Test #27:

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

input:

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

output:

0 482 985 985 985 985 482 482 482 482 985 482 482 985 482 482 482 482 985 985 482 482 482 985 482 482 985 985 985 985 985 985 985 985 985 985 482 482 482 985 482 482 482 985 985 482 985 482 985 985 482 482 985 482 985 482 482 985 482 482 482 985 482 482 482 985 985 985 482 985 482 482 482 985 985 98...

result:

ok Accepted

Test #28:

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

input:

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

output:

0 340 340 340 340 340 986 986 340 986 986 340 986 986 986 986 340 340 340 340 340 986 340 340 340 986 340 986 340 986 986 340 986 986 986 340 986 986 986 986 986 340 340 340 340 986 340 986 986 986 340 340 340 340 340 340 986 340 986 986 986 986 340 340 986 986 986 986 340 340 986 340 986 340 340 98...

result:

ok Accepted

Test #29:

score: 0
Accepted
time: 296ms
memory: 3700kb

input:

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

output:

0 340 987 987 987 987 340 340 340 340 987 340 340 987 340 340 340 340 987 987 340 340 340 987 340 340 987 987 987 987 987 987 987 987 987 987 340 340 340 987 340 340 340 987 987 340 987 340 987 987 340 340 987 340 987 340 340 987 340 340 340 987 340 340 340 987 987 987 340 987 340 340 340 987 987 98...

result:

ok Accepted

Test #30:

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

input:

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

output:

0 572 572 572 572 572 988 988 572 988 988 572 988 988 988 988 572 572 572 572 572 988 572 572 572 988 572 988 572 988 988 572 988 988 988 572 988 988 988 988 988 572 572 572 572 988 572 988 988 988 572 572 572 572 572 572 988 572 988 988 988 988 572 572 988 988 988 988 572 572 988 572 988 572 572 98...

result:

ok Accepted

Test #31:

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

input:

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

output:

0 573 989 989 989 989 573 573 573 573 989 573 573 989 573 573 573 573 989 989 573 573 573 989 573 573 989 989 989 989 989 989 989 989 989 989 989 573 573 989 573 573 573 989 989 573 989 573 989 989 573 573 989 573 989 573 573 989 573 573 573 989 573 573 573 989 989 989 573 989 573 573 573 989 989 98...

result:

ok Accepted

Test #32:

score: 0
Accepted
time: 310ms
memory: 3764kb

input:

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

output:

0 279 279 279 279 279 990 990 279 990 990 279 990 990 990 990 279 279 279 279 279 990 279 279 279 990 279 990 279 990 990 279 990 990 990 279 990 990 990 990 990 279 279 279 279 990 279 990 990 990 279 279 279 279 279 279 990 279 990 990 990 990 279 279 990 990 990 990 279 279 990 279 990 279 279 99...

result:

ok Accepted

Test #33:

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

input:

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

output:

0 280 991 991 991 991 280 280 280 280 991 280 280 991 280 280 280 280 991 991 280 280 280 991 280 280 991 991 991 991 991 991 991 991 991 991 991 280 280 991 280 280 280 991 991 280 991 280 991 991 280 280 991 280 991 280 280 991 280 280 280 991 280 280 280 991 991 991 280 991 280 280 280 991 991 99...

result:

ok Accepted

Test #34:

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

input:

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

output:

0 236 236 236 236 236 992 992 236 992 992 236 992 992 992 992 236 236 236 236 236 992 236 236 236 992 236 992 236 992 992 236 992 992 992 236 992 992 992 992 992 236 236 236 236 992 236 992 992 992 236 236 236 236 236 236 992 236 992 992 992 992 236 236 992 992 992 992 236 236 992 236 992 236 236 99...

result:

ok Accepted

Test #35:

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

input:

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

output:

0 236 993 993 993 993 236 236 236 236 993 236 236 993 236 236 236 236 993 993 236 236 236 993 236 236 993 993 993 993 993 993 993 993 993 993 993 236 236 993 236 236 236 993 993 236 993 236 993 993 236 236 993 236 993 236 236 993 236 236 236 993 236 236 236 993 993 993 236 993 236 236 236 993 993 99...

result:

ok Accepted

Test #36:

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

input:

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

output:

0 963 963 963 963 963 994 994 963 994 994 963 994 994 994 994 963 963 963 963 963 994 963 963 963 994 963 994 963 994 994 963 994 994 994 963 994 994 994 994 994 963 963 963 963 994 963 994 994 994 963 963 963 963 963 963 994 963 994 994 994 994 963 963 994 994 994 994 963 963 994 963 994 963 963 99...

result:

ok Accepted

Test #37:

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

input:

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

output:

0 964 995 995 995 995 964 964 964 964 995 964 964 995 964 964 964 964 995 995 964 964 964 995 964 964 995 995 995 995 995 995 995 995 995 995 995 964 964 995 964 964 964 995 995 964 995 964 995 995 964 964 995 964 995 964 964 995 964 964 964 995 964 964 964 995 995 995 964 995 964 964 964 995 995 99...

result:

ok Accepted

Test #38:

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

input:

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

output:

0 458 458 458 458 458 996 996 458 996 996 458 996 996 996 996 458 458 458 458 458 996 458 458 458 996 458 996 458 996 996 458 996 996 996 458 996 996 996 996 996 458 458 458 458 996 458 996 996 996 458 458 458 458 458 458 996 458 996 996 996 996 458 458 996 996 996 996 458 458 996 458 996 458 458 99...

result:

ok Accepted

Test #39:

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

input:

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

output:

0 458 997 997 997 997 458 458 458 458 997 458 458 997 458 458 458 458 997 997 458 458 458 997 458 458 997 997 997 997 997 997 997 997 997 997 997 458 458 997 458 458 458 997 997 458 997 458 997 997 458 458 997 458 997 458 458 997 458 458 458 997 458 458 458 997 997 997 458 997 458 458 458 997 997 99...

result:

ok Accepted

Test #40:

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

input:

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

output:

0 214 214 214 214 214 998 998 214 998 998 214 998 998 998 998 214 214 214 214 214 998 214 214 214 998 214 998 214 998 998 214 998 998 998 214 998 998 998 998 998 214 214 214 214 998 214 998 998 998 214 214 214 214 214 214 998 214 998 998 998 998 214 214 998 998 998 998 214 214 998 214 998 998 214 99...

result:

ok Accepted

Test #41:

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

input:

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

output:

0 214 999 999 999 999 214 214 214 214 999 214 214 999 214 214 214 214 999 999 214 214 214 999 214 214 999 999 999 999 999 999 999 999 999 999 999 214 214 999 214 214 214 999 999 214 999 214 999 999 214 214 999 214 999 214 214 999 214 214 214 999 214 214 214 999 999 999 214 999 214 214 214 999 999 99...

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed