QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#741601#9432. PermutationShui_DreamAC ✓284ms4188kbC++231.4kb2024-11-13 14:45:242024-11-13 14:45:24

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
0
1
0
0
0
0

output:

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

result:

ok Accepted

Test #2:

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

input:

1000
2
1
1
1
1
2
2
1
1
1
1
0
2
0
1
1
0
0
0
2
1
2
1
0
1
1
1
1
0
1
0
2
1
1
1
2
2
1
0
1
1
0
2
1
0
0
1
1
2
1
1
0
1
1
1
1
1
2
1
1
0
1
0
2
2
1
0
1
1
2
0
0
1
1
0
1
1
2
2
1
0
1
2
1
2
0
0
2
1
0
1
0
1
2
0
2
0
1
1
1
1
2
2
1
0
2
2
1
2
2
2
1
1
1
0
1
2
0
2
1
0
1
2
0
1
1
1
1
2
0
1
0
2
1
2
1
0
1
1
2
1
2
1
2
0
0
2
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 #3:

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

input:

1

output:

1 1 

result:

ok Accepted

Test #4:

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

input:

2
0

output:

0 1 2 
1 2 1 

result:

ok Accepted

Test #5:

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

input:

3
2
0

output:

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

result:

ok Accepted

Test #6:

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

input:

4
2
2
2
0

output:

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

result:

ok Accepted

Test #7:

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

input:

6
1
1
2
1
0
2
0
2

output:

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

result:

ok Accepted

Test #8:

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

input:

7
2
2
2
0
2
0
0
0
2

output:

0 7 7 7 7 6 6 6 
0 1 1 1 1 5 5 5 
0 2 2 2 2 4 4 4 
0 2 2 7 7 7 7 7 
0 3 3 1 1 1 1 1 
0 7 3 3 3 3 3 3 
0 2 2 1 2 2 2 2 
0 6 6 6 6 4 4 6 
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: 3784kb

input:

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

output:

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

result:

ok Accepted

Test #10:

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

input:

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

output:

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

result:

ok Accepted

Test #11:

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

input:

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

output:

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

result:

ok Accepted

Test #12:

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

input:

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

output:

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

result:

ok Accepted

Test #13:

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

input:

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

output:

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

result:

ok Accepted

Test #14:

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

input:

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

output:

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

result:

ok Accepted

Test #15:

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

input:

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

output:

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

result:

ok Accepted

Test #16:

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

input:

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

output:

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

result:

ok Accepted

Test #17:

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

input:

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

output:

0 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 448 44...

result:

ok Accepted

Test #18:

score: 0
Accepted
time: 261ms
memory: 4188kb

input:

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

output:

0 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 878 87...

result:

ok Accepted

Test #19:

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

input:

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

output:

0 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 830 83...

result:

ok Accepted

Test #20:

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

input:

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

output:

0 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 665 66...

result:

ok Accepted

Test #21:

score: 0
Accepted
time: 259ms
memory: 3908kb

input:

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

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: 237ms
memory: 3832kb

input:

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

output:

0 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 54...

result:

ok Accepted

Test #23:

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

input:

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

output:

0 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 534 53...

result:

ok Accepted

Test #24:

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

input:

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

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

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

input:

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

output:

0 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 45...

result:

ok Accepted

Test #26:

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

input:

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

output:

0 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 772 77...

result:

ok Accepted

Test #27:

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

input:

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

output:

0 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 1...

result:

ok Accepted

Test #28:

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

input:

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

output:

0 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 52...

result:

ok Accepted

Test #29:

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

input:

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

output:

0 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 532 53...

result:

ok Accepted

Test #30:

score: 0
Accepted
time: 238ms
memory: 3836kb

input:

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

output:

0 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 5...

result:

ok Accepted

Test #31:

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

input:

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

output:

0 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 759 75...

result:

ok Accepted

Test #32:

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

input:

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

output:

0 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 333 33...

result:

ok Accepted

Test #33:

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

input:

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

output:

0 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 3...

result:

ok Accepted

Test #34:

score: 0
Accepted
time: 229ms
memory: 4112kb

input:

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

output:

0 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 597 59...

result:

ok Accepted

Test #35:

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

input:

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

output:

0 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 539 53...

result:

ok Accepted

Test #36:

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

input:

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

output:

0 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 27...

result:

ok Accepted

Test #37:

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

input:

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

output:

0 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 767 76...

result:

ok Accepted

Test #38:

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

input:

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

output:

0 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 359 35...

result:

ok Accepted

Test #39:

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

input:

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

output:

0 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 555 55...

result:

ok Accepted

Test #40:

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

input:

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

output:

0 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 88...

result:

ok Accepted

Test #41:

score: 0
Accepted
time: 250ms
memory: 3896kb

input:

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

output:

0 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 22...

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed