QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#744512#9432. PermutationHuluoboAC ✓278ms4200kbC++141.9kb2024-11-13 22:12:472024-11-13 22:12:52

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
1
1
2
0
0
0

output:

0 3 3 3 2 2 
0 2 2 2 4 4 
0 4 4 4 5 5 
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: 272ms
memory: 3956kb

input:

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

output:

0 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 81...

result:

ok Accepted

Test #3:

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

input:

1

output:

1 1 

result:

ok Accepted

Test #4:

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

input:

2
2

output:

0 2 1 
1 2 1 

result:

ok Accepted

Test #5:

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

input:

3
1
2
0

output:

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

result:

ok Accepted

Test #6:

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

input:

4
1
2
0
2

output:

0 3 3 4 4 
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: 3936kb

input:

6
2
2
2
2
2
1
2
2

output:

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

input:

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

output:

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

result:

ok Accepted

Test #9:

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

input:

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

output:

0 3 3 3 3 5 5 5 5 
0 2 2 2 2 8 8 8 8 
0 4 4 4 4 1 1 1 1 
0 7 7 7 7 6 6 6 6 
0 1 1 2 2 2 2 2 2 
0 2 2 7 7 7 7 7 7 
0 3 7 7 7 7 7 7 7 
0 2 2 2 1 1 1 1 1 
0 5 5 5 5 5 5 8 8 
0 4 4 4 4 4 4 6 6 
0 6 6 6 6 6 5 5 5 
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: 1ms
memory: 3932kb

input:

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

output:

0 4 4 4 4 4 6 6 6 6 
0 6 6 6 6 6 5 5 5 5 
0 5 5 5 5 5 9 9 9 9 
0 2 2 2 2 2 1 1 1 1 
0 1 1 1 1 1 7 7 7 7 
0 7 7 7 7 7 8 8 8 8 
0 7 7 7 1 1 1 1 1 1 
0 2 2 2 3 3 3 3 3 3 
0 3 3 3 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 1 1 1 1 9 9 9 9 9 
0 5 5 5 5 5 5 5 6 6 
0 8 8 8 8 8 8 8 4 4 
0 4 4 ...

result:

ok Accepted

Test #11:

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

input:

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

output:

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

result:

ok Accepted

Test #12:

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

input:

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

output:

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

result:

ok Accepted

Test #13:

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

input:

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

output:

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

result:

ok Accepted

Test #14:

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

input:

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

output:

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

result:

ok Accepted

Test #15:

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

input:

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

output:

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

result:

ok Accepted

Test #16:

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

input:

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

output:

0 4 4 4 4 4 4 4 4 13 13 13 13 13 13 13 
0 13 13 13 13 13 13 13 13 15 15 15 15 15 15 15 
0 15 15 15 15 15 15 15 15 9 9 9 9 9 9 9 
0 9 9 9 9 9 9 9 9 2 2 2 2 2 2 2 
0 1 1 1 1 1 1 1 1 14 14 14 14 14 14 14 
0 11 11 11 11 11 11 11 11 3 3 3 3 3 3 3 
0 8 8 8 8 8 8 8 8 10 10 10 10 10 10 10 
0 5 5 5 5 5 5 5 5...

result:

ok Accepted

Test #17:

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

input:

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

output:

0 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 557 55...

result:

ok Accepted

Test #18:

score: 0
Accepted
time: 232ms
memory: 3952kb

input:

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

output:

0 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 31...

result:

ok Accepted

Test #19:

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

input:

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

output:

0 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 354 35...

result:

ok Accepted

Test #20:

score: 0
Accepted
time: 247ms
memory: 4196kb

input:

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

output:

0 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 25...

result:

ok Accepted

Test #21:

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

input:

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

output:

0 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 95...

result:

ok Accepted

Test #22:

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

input:

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

output:

0 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 56...

result:

ok Accepted

Test #23:

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

input:

981
1
0
1
1
1
2
1
1
0
0
1
1
2
2
1
1
2
0
1
1
0
2
1
1
1
0
1
1
2
1
0
2
2
0
1
1
1
1
1
2
1
1
1
0
1
2
1
1
0
1
1
1
1
1
2
0
2
0
1
1
1
2
1
1
2
1
0
1
1
0
2
2
0
2
2
1
2
2
1
2
2
2
0
1
1
2
1
0
0
2
1
1
1
0
1
1
0
2
0
1
2
0
2
0
2
0
1
0
1
2
1
2
2
1
1
1
1
0
0
0
2
1
1
0
0
1
1
1
1
2
0
1
1
1
2
1
2
1
0
0
0
0
2
0
0
1
0
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 #24:

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

input:

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

output:

0 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 81...

result:

ok Accepted

Test #25:

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

input:

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

output:

0 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 89...

result:

ok Accepted

Test #26:

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

input:

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

output:

0 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 13...

result:

ok Accepted

Test #27:

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

input:

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

output:

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

result:

ok Accepted

Test #28:

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

input:

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

output:

0 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 463 46...

result:

ok Accepted

Test #29:

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

input:

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

output:

0 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 488 48...

result:

ok Accepted

Test #30:

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

input:

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

output:

0 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 797 79...

result:

ok Accepted

Test #31:

score: 0
Accepted
time: 247ms
memory: 3892kb

input:

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

output:

0 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 76...

result:

ok Accepted

Test #32:

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

input:

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

output:

0 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 1...

result:

ok Accepted

Test #33:

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

input:

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

output:

0 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 614 61...

result:

ok Accepted

Test #34:

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

input:

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

output:

0 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 896 89...

result:

ok Accepted

Test #35:

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

input:

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

output:

0 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 919 91...

result:

ok Accepted

Test #36:

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

input:

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

output:

0 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 31...

result:

ok Accepted

Test #37:

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

input:

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

output:

0 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155 15...

result:

ok Accepted

Test #38:

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

input:

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

output:

0 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 471 47...

result:

ok Accepted

Test #39:

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

input:

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

output:

0 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 60...

result:

ok Accepted

Test #40:

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

input:

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

output:

0 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 341 34...

result:

ok Accepted

Test #41:

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

input:

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

output:

0 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 55...

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed