QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#742364#9432. PermutationHuluoboAC ✓278ms8252kbC++141.5kb2024-11-13 16:27:352024-11-13 16:27:39

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 7956kb

input:

5
1
2
0
0
0
0

output:

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

result:

ok Accepted

Test #2:

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

input:

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

output:

0 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 763 76...

result:

ok Accepted

Test #3:

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

input:

1

output:

1 1 

result:

ok Accepted

Test #4:

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

input:

2
0

output:

0 1 2
1 2 1 

result:

ok Accepted

Test #5:

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

input:

3
1
2
2

output:

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

result:

ok Accepted

Test #6:

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

input:

4
0
2
0
2

output:

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

result:

ok Accepted

Test #7:

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

input:

6
0
1
0
0
2
1
2
2

output:

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

result:

ok Accepted

Test #8:

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

input:

7
0
1
2
0
0
0
0
0
0
0

output:

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

result:

ok Accepted

Test #9:

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

input:

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

output:

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

result:

ok Accepted

Test #10:

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

input:

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

output:

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

result:

ok Accepted

Test #11:

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

input:

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

output:

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

result:

ok Accepted

Test #12:

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

input:

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

output:

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

result:

ok Accepted

Test #13:

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

input:

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

output:

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

result:

ok Accepted

Test #14:

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

input:

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

output:

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

result:

ok Accepted

Test #15:

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

input:

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

output:

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

result:

ok Accepted

Test #16:

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

input:

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

output:

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

result:

ok Accepted

Test #17:

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

input:

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

output:

0 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 483 48...

result:

ok Accepted

Test #18:

score: 0
Accepted
time: 240ms
memory: 8052kb

input:

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

output:

0 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 6...

result:

ok Accepted

Test #19:

score: 0
Accepted
time: 254ms
memory: 8060kb

input:

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

output:

0 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 61...

result:

ok Accepted

Test #20:

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

input:

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

output:

0 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 869 86...

result:

ok Accepted

Test #21:

score: 0
Accepted
time: 245ms
memory: 7916kb

input:

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

output:

0 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 36...

result:

ok Accepted

Test #22:

score: 0
Accepted
time: 254ms
memory: 7972kb

input:

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

output:

0 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 27...

result:

ok Accepted

Test #23:

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

input:

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

output:

0 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 9...

result:

ok Accepted

Test #24:

score: 0
Accepted
time: 237ms
memory: 7984kb

input:

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

output:

0 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 894 89...

result:

ok Accepted

Test #25:

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

input:

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

output:

0 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 3...

result:

ok Accepted

Test #26:

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

input:

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

output:

0 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 71...

result:

ok Accepted

Test #27:

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

input:

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

output:

0 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 39...

result:

ok Accepted

Test #28:

score: 0
Accepted
time: 241ms
memory: 7956kb

input:

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

output:

0 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 701 70...

result:

ok Accepted

Test #29:

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

input:

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

output:

0 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 694 69...

result:

ok Accepted

Test #30:

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

input:

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

output:

0 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 42...

result:

ok Accepted

Test #31:

score: 0
Accepted
time: 243ms
memory: 7912kb

input:

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

output:

0 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 391 39...

result:

ok Accepted

Test #32:

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

input:

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

output:

0 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 836 83...

result:

ok Accepted

Test #33:

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

input:

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

output:

0 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 680 68...

result:

ok Accepted

Test #34:

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

input:

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

output:

0 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 335 33...

result:

ok Accepted

Test #35:

score: 0
Accepted
time: 240ms
memory: 8192kb

input:

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

output:

0 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 104 10...

result:

ok Accepted

Test #36:

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

input:

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

output:

0 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 230 23...

result:

ok Accepted

Test #37:

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

input:

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

output:

0 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 264 26...

result:

ok Accepted

Test #38:

score: 0
Accepted
time: 236ms
memory: 7968kb

input:

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

output:

0 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 90...

result:

ok Accepted

Test #39:

score: 0
Accepted
time: 241ms
memory: 7984kb

input:

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

output:

0 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 52...

result:

ok Accepted

Test #40:

score: 0
Accepted
time: 278ms
memory: 7964kb

input:

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

output:

0 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 301 30...

result:

ok Accepted

Test #41:

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

input:

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

output:

0 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 92...

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed