QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#661380#9432. Permutationucup-team5249#AC ✓299ms4164kbC++141.5kb2024-10-20 15:59:152024-10-20 15:59:15

详细

Test #1:

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

input:

5
0
1
0
1
0
2
2

output:

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

result:

ok Accepted

Test #2:

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

input:

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

output:

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

result:

ok Accepted

Test #3:

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

input:

1

output:

1 1 

result:

ok Accepted

Test #4:

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

input:

2
0

output:

0 1 2 
1 2 1 

result:

ok Accepted

Test #5:

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

input:

3
1
2
0

output:

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

result:

ok Accepted

Test #6:

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

input:

4
1
2
2
2
0

output:

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

result:

ok Accepted

Test #7:

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

input:

6
0
2
0
2
1
2
1
0
0

output:

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

result:

ok Accepted

Test #8:

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

input:

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

output:

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

result:

ok Accepted

Test #9:

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

input:

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

output:

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

result:

ok Accepted

Test #10:

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

input:

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

output:

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

result:

ok Accepted

Test #11:

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

input:

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

output:

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

result:

ok Accepted

Test #12:

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

input:

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

output:

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

result:

ok Accepted

Test #13:

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

input:

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

output:

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

result:

ok Accepted

Test #14:

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

input:

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

output:

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

result:

ok Accepted

Test #15:

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

input:

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

output:

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

result:

ok Accepted

Test #16:

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

input:

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

output:

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

result:

ok Accepted

Test #17:

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

input:

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

output:

0 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 70...

result:

ok Accepted

Test #18:

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

input:

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

output:

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

result:

ok Accepted

Test #19:

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

input:

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

output:

0 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 80...

result:

ok Accepted

Test #20:

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

input:

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

output:

0 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 372 37...

result:

ok Accepted

Test #21:

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

input:

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

output:

0 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 251 25...

result:

ok Accepted

Test #22:

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

input:

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

output:

0 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 42...

result:

ok Accepted

Test #23:

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

input:

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

output:

0 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 86...

result:

ok Accepted

Test #24:

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

input:

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

output:

0 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 574 57...

result:

ok Accepted

Test #25:

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

input:

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

output:

0 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 521 52...

result:

ok Accepted

Test #26:

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

input:

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

output:

0 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 684 68...

result:

ok Accepted

Test #27:

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

input:

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

output:

0 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 6...

result:

ok Accepted

Test #28:

score: 0
Accepted
time: 256ms
memory: 4140kb

input:

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

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

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

input:

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

output:

0 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 315 31...

result:

ok Accepted

Test #30:

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

input:

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

output:

0 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 172 17...

result:

ok Accepted

Test #31:

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

input:

989
1
1
2
0
2
1
2
1
0
1
1
2
1
2
1
1
1
2
1
0
1
1
0
1
1
1
0
1
1
1
1
2
0
1
1
2
0
1
0
1
0
2
0
0
2
0
1
0
2
0
1
0
1
1
1
2
1
2
0
1
1
1
1
1
1
2
0
0
1
1
1
0
2
0
0
2
1
1
2
0
2
1
1
1
0
1
1
0
1
0
2
2
1
0
0
1
1
1
0
0
2
1
1
0
1
1
0
1
2
2
1
2
1
2
0
0
1
1
2
1
2
0
2
1
2
0
0
1
0
2
2
0
1
1
0
2
1
1
1
0
2
1
1
1
2
2
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 #32:

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

input:

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

output:

0 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 24...

result:

ok Accepted

Test #33:

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

input:

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

output:

0 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 415 41...

result:

ok Accepted

Test #34:

score: 0
Accepted
time: 289ms
memory: 3932kb

input:

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

output:

0 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 660 66...

result:

ok Accepted

Test #35:

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

input:

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

output:

0 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 95...

result:

ok Accepted

Test #36:

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

input:

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

output:

0 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 29...

result:

ok Accepted

Test #37:

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

input:

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

output:

0 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 640 64...

result:

ok Accepted

Test #38:

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

input:

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

output:

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

result:

ok Accepted

Test #39:

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

input:

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

output:

0 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 311 31...

result:

ok Accepted

Test #40:

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

input:

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

output:

0 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 596 59...

result:

ok Accepted

Test #41:

score: 0
Accepted
time: 274ms
memory: 3852kb

input:

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

output:

0 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 825 82...

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed