QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#740416#9432. PermutationHuluoboRE 276ms3884kbC++141.5kb2024-11-13 09:50:022024-11-13 09:50:10

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
0
1
2
0
0
0
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1

output:

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

result:

ok Accepted

Test #2:

score: 0
Accepted
time: 251ms
memory: 3584kb

input:

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

output:

0 202 929 202 929 202 929 202 929 202 929 202 929 202 929 202 929 202 929 202 929 202 929 202 929 202 929 202 929 202 929 202 929 202 929 202 929 202 929 202 929 202 929 202 929 202 929 202 929 202 929 202 929 202 929 202 929 202 929 202 929 202 929 202 929 202 929 202 929 202 929 202 929 202 929 20...

result:

ok Accepted

Test #3:

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

input:

1

output:

1 1 

result:

ok Accepted

Test #4:

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

input:

2
0
2
1
1
1
1
1
1
1
1

output:

0 1 2 
0 2 1 
0 2 2 
0 1 1 
0 2 2 
0 2 2 
0 2 2 
0 2 2 
0 2 2 
0 2 2 
1 2 1 

result:

ok Accepted

Test #5:

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

input:

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

output:

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

result:

ok Accepted

Test #6:

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

input:

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

output:

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

result:

ok Accepted

Test #7:

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

input:

6
2
1
1
0
0
2
0
2
0
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1

output:

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

result:

ok Accepted

Test #8:

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

input:

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

output:

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

result:

ok Accepted

Test #9:

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

input:

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

output:

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

result:

ok Accepted

Test #10:

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

input:

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

output:

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

result:

ok Accepted

Test #11:

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

input:

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

output:

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

result:

ok Accepted

Test #12:

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

input:

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

output:

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

result:

ok Accepted

Test #13:

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

input:

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

output:

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

result:

ok Accepted

Test #14:

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

input:

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

output:

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

result:

ok Accepted

Test #15:

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

input:

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

output:

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

result:

ok Accepted

Test #16:

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

input:

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

output:

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

result:

ok Accepted

Test #17:

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

input:

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

output:

0 481 530 481 530 481 530 481 530 481 530 481 530 481 530 481 530 481 530 481 530 481 530 481 530 481 530 481 530 481 530 481 530 481 530 481 530 481 530 481 530 481 530 481 530 481 530 481 530 481 530 481 530 481 530 481 530 481 530 481 530 481 530 481 530 481 530 481 530 481 530 481 530 481 530 48...

result:

ok Accepted

Test #18:

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

input:

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

output:

0 540 720 540 720 540 720 540 720 540 720 540 720 540 720 540 720 540 720 540 720 540 720 540 720 540 720 540 720 540 720 540 720 540 720 540 720 540 720 540 720 540 720 540 720 540 720 540 720 540 720 540 720 540 720 540 720 540 720 540 720 540 720 540 720 540 720 540 720 540 720 540 720 540 720 54...

result:

ok Accepted

Test #19:

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

input:

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

output:

0 167 537 167 537 167 537 167 537 167 537 167 537 167 537 167 537 167 537 167 537 167 537 167 537 167 537 167 537 167 537 167 537 167 537 167 537 167 537 167 537 167 537 167 537 167 537 167 537 167 537 167 537 167 537 167 537 167 537 167 537 167 537 167 537 167 537 167 537 167 537 167 537 167 537 16...

result:

ok Accepted

Test #20:

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

input:

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

output:

0 792 799 792 799 792 799 792 799 792 799 792 799 792 799 792 799 792 799 792 799 792 799 792 799 792 799 792 799 792 799 792 799 792 799 792 799 792 799 792 799 792 799 792 799 792 799 792 799 792 799 792 799 792 799 792 799 792 799 792 799 792 799 792 799 792 799 792 799 792 799 792 799 792 799 79...

result:

ok Accepted

Test #21:

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

input:

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

output:

0 88 20 88 20 88 20 88 20 88 20 88 20 88 20 88 20 88 20 88 20 88 20 88 20 88 20 88 20 88 20 88 20 88 20 88 20 88 20 88 20 88 20 88 20 88 20 88 20 88 20 88 20 88 20 88 20 88 20 88 20 88 20 88 20 88 20 88 20 88 20 88 20 88 20 88 20 88 20 88 20 88 20 88 20 88 20 88 20 88 20 88 20 88 20 88 20 88 20 88 2...

result:

ok Accepted

Test #22:

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

input:

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

output:

0 584 172 584 172 584 172 584 172 584 172 584 172 584 172 584 172 584 172 584 172 584 172 584 172 584 172 584 172 584 172 584 172 584 172 584 172 584 172 584 172 584 172 584 172 584 172 584 172 584 172 584 172 584 172 584 172 584 172 584 172 584 172 584 172 584 172 584 172 584 172 584 172 584 172 58...

result:

ok Accepted

Test #23:

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

input:

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

output:

0 44 260 44 260 44 260 44 260 44 260 44 260 44 260 44 260 44 260 44 260 44 260 44 260 44 260 44 260 44 260 44 260 44 260 44 260 44 260 44 260 44 260 44 260 44 260 44 260 44 260 44 260 44 260 44 260 44 260 44 260 44 260 44 260 44 260 44 260 44 260 44 260 44 260 44 260 44 260 44 260 44 260 44 260 44 2...

result:

ok Accepted

Test #24:

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

input:

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

output:

0 524 796 524 796 524 796 524 796 524 796 524 796 524 796 524 796 524 796 524 796 524 796 524 796 524 796 524 796 524 796 524 796 524 796 524 796 524 796 524 796 524 796 524 796 524 796 524 796 524 796 524 796 524 796 524 796 524 796 524 796 524 796 524 796 524 796 524 796 524 796 524 796 524 796 52...

result:

ok Accepted

Test #25:

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

input:

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

output:

0 511 728 511 728 511 728 511 728 511 728 511 728 511 728 511 728 511 728 511 728 511 728 511 728 511 728 511 728 511 728 511 728 511 728 511 728 511 728 511 728 511 728 511 728 511 728 511 728 511 728 511 728 511 728 511 728 511 728 511 728 511 728 511 728 511 728 511 728 511 728 511 728 511 728 51...

result:

ok Accepted

Test #26:

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

input:

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

output:

0 535 569 535 569 535 569 535 569 535 569 535 569 535 569 535 569 535 569 535 569 535 569 535 569 535 569 535 569 535 569 535 569 535 569 535 569 535 569 535 569 535 569 535 569 535 569 535 569 535 569 535 569 535 569 535 569 535 569 535 569 535 569 535 569 535 569 535 569 535 569 535 569 535 569 53...

result:

ok Accepted

Test #27:

score: 0
Accepted
time: 233ms
memory: 3716kb

input:

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

output:

0 459 633 459 633 459 633 459 633 459 633 459 633 459 633 459 633 459 633 459 633 459 633 459 633 459 633 459 633 459 633 459 633 459 633 459 633 459 633 459 633 459 633 459 633 459 633 459 633 459 633 459 633 459 633 459 633 459 633 459 633 459 633 459 633 459 633 459 633 459 633 459 633 459 633 45...

result:

ok Accepted

Test #28:

score: 0
Accepted
time: 234ms
memory: 3724kb

input:

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

output:

0 864 374 864 374 864 374 864 374 864 374 864 374 864 374 864 374 864 374 864 374 864 374 864 374 864 374 864 374 864 374 864 374 864 374 864 374 864 374 864 374 864 374 864 374 864 374 864 374 864 374 864 374 864 374 864 374 864 374 864 374 864 374 864 374 864 374 864 374 864 374 864 374 864 374 86...

result:

ok Accepted

Test #29:

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

input:

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

output:

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

result:

ok Accepted

Test #30:

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

input:

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

output:

0 634 456 634 456 634 456 634 456 634 456 634 456 634 456 634 456 634 456 634 456 634 456 634 456 634 456 634 456 634 456 634 456 634 456 634 456 634 456 634 456 634 456 634 456 634 456 634 456 634 456 634 456 634 456 634 456 634 456 634 456 634 456 634 456 634 456 634 456 634 456 634 456 634 456 63...

result:

ok Accepted

Test #31:

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

input:

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

output:

0 262 725 262 725 262 725 262 725 262 725 262 725 262 725 262 725 262 725 262 725 262 725 262 725 262 725 262 725 262 725 262 725 262 725 262 725 262 725 262 725 262 725 262 725 262 725 262 725 262 725 262 725 262 725 262 725 262 725 262 725 262 725 262 725 262 725 262 725 262 725 262 725 262 725 26...

result:

ok Accepted

Test #32:

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

input:

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

output:

0 744 667 744 667 744 667 744 667 744 667 744 667 744 667 744 667 744 667 744 667 744 667 744 667 744 667 744 667 744 667 744 667 744 667 744 667 744 667 744 667 744 667 744 667 744 667 744 667 744 667 744 667 744 667 744 667 744 667 744 667 744 667 744 667 744 667 744 667 744 667 744 667 744 667 74...

result:

ok Accepted

Test #33:

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

input:

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

output:

0 402 507 402 507 402 507 402 507 402 507 402 507 402 507 402 507 402 507 402 507 402 507 402 507 402 507 402 507 402 507 402 507 402 507 402 507 402 507 402 507 402 507 402 507 402 507 402 507 402 507 402 507 402 507 402 507 402 507 402 507 402 507 402 507 402 507 402 507 402 507 402 507 402 507 40...

result:

ok Accepted

Test #34:

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

input:

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

output:

0 651 960 651 960 651 960 651 960 651 960 651 960 651 960 651 960 651 960 651 960 651 960 651 960 651 960 651 960 651 960 651 960 651 960 651 960 651 960 651 960 651 960 651 960 651 960 651 960 651 960 651 960 651 960 651 960 651 960 651 960 651 960 651 960 651 960 651 960 651 960 651 960 651 960 65...

result:

ok Accepted

Test #35:

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

input:

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

output:

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

result:

ok Accepted

Test #36:

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

input:

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

output:

0 561 29 561 29 561 29 561 29 561 29 561 29 561 29 561 29 561 29 561 29 561 29 561 29 561 29 561 29 561 29 561 29 561 29 561 29 561 29 561 29 561 29 561 29 561 29 561 29 561 29 561 29 561 29 561 29 561 29 561 29 561 29 561 29 561 29 561 29 561 29 561 29 561 29 561 29 561 29 561 29 561 29 561 29 561 ...

result:

ok Accepted

Test #37:

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

input:

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

output:

0 506 31 506 31 506 31 506 31 506 31 506 31 506 31 506 31 506 31 506 31 506 31 506 31 506 31 506 31 506 31 506 31 506 31 506 31 506 31 506 31 506 31 506 31 506 31 506 31 506 31 506 31 506 31 506 31 506 31 506 31 506 31 506 31 506 31 506 31 506 31 506 31 506 31 506 31 506 31 506 31 506 31 506 31 506 ...

result:

ok Accepted

Test #38:

score: 0
Accepted
time: 260ms
memory: 3608kb

input:

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

output:

0 699 992 699 992 699 992 699 992 699 992 699 992 699 992 699 992 699 992 699 992 699 992 699 992 699 992 699 992 699 992 699 992 699 992 699 992 699 992 699 992 699 992 699 992 699 992 699 992 699 992 699 992 699 992 699 992 699 992 699 992 699 992 699 992 699 992 699 992 699 992 699 992 699 992 69...

result:

ok Accepted

Test #39:

score: -100
Runtime Error

input:

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

output:

0 908 184 908 184 908 184 908 184 908 184 908 184 908 184 908 184 908 184 908 184 908 184 908 184 908 184 908 184 908 184 908 184 908 184 908 184 908 184 908 184 908 184 908 184 908 184 908 184 908 184 908 184 908 184 908 184 908 184 908 184 908 184 908 184 908 184 908 184 908 184 908 184 908 184 90...

result: