QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#601706#9432. PermutationNailongGroup#AC ✓327ms8136kbC++204.5kb2024-09-30 11:18:402024-09-30 11:18:40

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
0
2
2
1
2
2
0

output:

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

result:

ok Accepted

Test #2:

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

input:

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

output:

0 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 876 87...

result:

ok Accepted

Test #3:

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

input:

1

output:

1 1 

result:

ok Accepted

Test #4:

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

input:

2
2

output:

0 2 1 
1 2 1 

result:

ok Accepted

Test #5:

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

input:

3
1
0
0

output:

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

result:

ok Accepted

Test #6:

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

input:

4
2
2
2
2

output:

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

result:

ok Accepted

Test #7:

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

input:

6
0
2
2
2
2
0
0
2
2

output:

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

result:

ok Accepted

Test #8:

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

input:

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

output:

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

result:

ok Accepted

Test #9:

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

input:

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

output:

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

result:

ok Accepted

Test #10:

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

input:

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

output:

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

result:

ok Accepted

Test #11:

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

input:

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

output:

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

result:

ok Accepted

Test #12:

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

input:

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

output:

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

result:

ok Accepted

Test #13:

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

input:

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

output:

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

result:

ok Accepted

Test #14:

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

input:

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

output:

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

result:

ok Accepted

Test #15:

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

input:

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

output:

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

result:

ok Accepted

Test #16:

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

input:

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

output:

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

result:

ok Accepted

Test #17:

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

input:

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

output:

0 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 217 21...

result:

ok Accepted

Test #18:

score: 0
Accepted
time: 257ms
memory: 7936kb

input:

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

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

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

input:

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

output:

0 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 69...

result:

ok Accepted

Test #20:

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

input:

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

output:

0 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 113 11...

result:

ok Accepted

Test #21:

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

input:

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

output:

0 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 895 89...

result:

ok Accepted

Test #22:

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

input:

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

output:

0 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 126 12...

result:

ok Accepted

Test #23:

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

input:

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

output:

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

result:

ok Accepted

Test #24:

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

input:

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

output:

0 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 52...

result:

ok Accepted

Test #25:

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

input:

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

output:

0 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 18...

result:

ok Accepted

Test #26:

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

input:

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

output:

0 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 88...

result:

ok Accepted

Test #27:

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

input:

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

output:

0 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 92...

result:

ok Accepted

Test #28:

score: 0
Accepted
time: 302ms
memory: 7872kb

input:

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

output:

0 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 7...

result:

ok Accepted

Test #29:

score: 0
Accepted
time: 308ms
memory: 7864kb

input:

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

output:

0 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 6...

result:

ok Accepted

Test #30:

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

input:

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

output:

0 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 84...

result:

ok Accepted

Test #31:

score: 0
Accepted
time: 304ms
memory: 8040kb

input:

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

output:

0 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 706 70...

result:

ok Accepted

Test #32:

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

input:

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

output:

0 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 365 36...

result:

ok Accepted

Test #33:

score: 0
Accepted
time: 297ms
memory: 7864kb

input:

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

output:

0 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 745 74...

result:

ok Accepted

Test #34:

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

input:

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

output:

0 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 79...

result:

ok Accepted

Test #35:

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

input:

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

output:

0 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 25...

result:

ok Accepted

Test #36:

score: 0
Accepted
time: 304ms
memory: 7864kb

input:

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

output:

0 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 203 20...

result:

ok Accepted

Test #37:

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

input:

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

output:

0 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 413 41...

result:

ok Accepted

Test #38:

score: 0
Accepted
time: 315ms
memory: 7820kb

input:

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

output:

0 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 36...

result:

ok Accepted

Test #39:

score: 0
Accepted
time: 314ms
memory: 8108kb

input:

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

output:

0 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 604 60...

result:

ok Accepted

Test #40:

score: 0
Accepted
time: 315ms
memory: 7932kb

input:

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

output:

0 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 38...

result:

ok Accepted

Test #41:

score: 0
Accepted
time: 327ms
memory: 7800kb

input:

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

output:

0 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 17...

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed