QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#745287#9432. PermutationHuluoboAC ✓306ms4088kbC++144.5kb2024-11-14 08:57:312024-11-14 08:57:34

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
0
2
1
2
0
0

output:

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

result:

ok Accepted

Test #2:

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

input:

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

output:

0 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 82...

result:

ok Accepted

Test #3:

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

input:

1

output:

1 1 

result:

ok Accepted

Test #4:

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

input:

2
0

output:

0 1 2 
1 2 1 

result:

ok Accepted

Test #5:

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

input:

3
1
2
2

output:

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

result:

ok Accepted

Test #6:

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

input:

4
2
2
0
2

output:

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

result:

ok Accepted

Test #7:

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

input:

6
1
2
2
2
2
1
0
0

output:

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

result:

ok Accepted

Test #8:

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

input:

7
0
0
1
2
2
0
0
0
2
2

output:

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

result:

ok Accepted

Test #9:

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

input:

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

output:

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

result:

ok Accepted

Test #10:

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

input:

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

output:

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

result:

ok Accepted

Test #11:

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

input:

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

output:

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

result:

ok Accepted

Test #12:

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

input:

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

output:

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

result:

ok Accepted

Test #13:

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

input:

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

output:

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

result:

ok Accepted

Test #14:

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

input:

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

output:

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

result:

ok Accepted

Test #15:

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

input:

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

output:

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

result:

ok Accepted

Test #16:

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

input:

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

output:

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

result:

ok Accepted

Test #17:

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

input:

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

output:

0 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 294 29...

result:

ok Accepted

Test #18:

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

input:

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

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

score: 0
Accepted
time: 293ms
memory: 3796kb

input:

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

output:

0 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 252 25...

result:

ok Accepted

Test #20:

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

input:

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

output:

0 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 239 23...

result:

ok Accepted

Test #21:

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

input:

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

output:

0 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 1...

result:

ok Accepted

Test #22:

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

input:

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

output:

0 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 41...

result:

ok Accepted

Test #23:

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

input:

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

output:

0 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 57...

result:

ok Accepted

Test #24:

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

input:

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

output:

0 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 336 33...

result:

ok Accepted

Test #25:

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

input:

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

output:

0 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 19...

result:

ok Accepted

Test #26:

score: 0
Accepted
time: 268ms
memory: 4088kb

input:

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

output:

0 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 409 40...

result:

ok Accepted

Test #27:

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

input:

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

output:

0 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 352 35...

result:

ok Accepted

Test #28:

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

input:

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

output:

0 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 91...

result:

ok Accepted

Test #29:

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

input:

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

output:

0 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 ...

result:

ok Accepted

Test #30:

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

input:

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

output:

0 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 38...

result:

ok Accepted

Test #31:

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

input:

989
0
1
0
2
1
2
1
0
0
2
0
0
1
1
1
1
0
2
1
0
0
0
1
2
0
2
1
0
1
1
0
0
1
1
0
0
1
1
1
1
1
1
1
0
0
2
2
1
1
0
1
0
1
2
1
0
0
1
0
1
1
1
0
0
1
2
2
0
1
0
1
1
2
2
0
0
1
1
0
0
2
2
1
1
1
2
2
1
1
1
1
1
0
2
1
1
1
2
0
0
2
0
2
1
0
2
1
1
1
1
2
2
0
1
0
0
2
1
1
0
2
2
1
2
0
1
0
1
0
1
1
0
2
2
1
2
1
1
1
1
1
1
0
1
1
1
1
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 #32:

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

input:

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

output:

0 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 688 68...

result:

ok Accepted

Test #33:

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

input:

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

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

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

input:

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

output:

0 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 38...

result:

ok Accepted

Test #35:

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

input:

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

output:

0 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 3...

result:

ok Accepted

Test #36:

score: 0
Accepted
time: 290ms
memory: 4068kb

input:

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

output:

0 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 89...

result:

ok Accepted

Test #37:

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

input:

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

output:

0 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 16...

result:

ok Accepted

Test #38:

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

input:

996
1
1
1
1
1
2
1
1
1
1
1
2
2
1
0
0
2
0
1
1
1
0
1
0
1
1
1
1
0
1
1
2
0
0
1
2
0
2
2
0
1
2
1
1
1
2
1
1
2
1
1
2
0
0
0
0
1
0
0
0
2
0
2
1
1
0
2
1
0
0
2
1
1
1
0
1
1
1
2
0
1
2
1
1
0
1
1
1
1
1
1
2
0
1
0
2
0
1
1
1
1
1
1
1
1
1
2
1
0
0
1
2
1
1
2
1
1
0
2
1
2
2
1
1
1
2
0
2
2
0
2
1
2
1
1
1
0
0
1
1
2
1
1
1
2
1
0
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 #39:

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

input:

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

output:

0 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 78...

result:

ok Accepted

Test #40:

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

input:

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

output:

0 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 645 64...

result:

ok Accepted

Test #41:

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

input:

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

output:

0 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 59 5...

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed