QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#742974#9432. PermutationHuluoboAC ✓254ms3832kbC++141.0kb2024-11-13 17:46:542024-11-13 17:46:54

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
0
0
1
2
0
2

output:

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

result:

ok Accepted

Test #2:

score: 0
Accepted
time: 230ms
memory: 3760kb

input:

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

output:

0 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 244 24...

result:

ok Accepted

Test #3:

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

input:

1

output:

1 1 

result:

ok Accepted

Test #4:

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

input:

2
2

output:

0 2 1 
1 2 1 

result:

ok Accepted

Test #5:

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

input:

3
0
2

output:

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

result:

ok Accepted

Test #6:

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

input:

4
0
0
2
2

output:

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

result:

ok Accepted

Test #7:

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

input:

6
2
0
2
0
0
0
0

output:

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

input:

7
2
0
0
1
0
0
2
1
2
2

output:

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

input:

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

output:

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

input:

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

output:

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

result:

ok Accepted

Test #11:

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

input:

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

output:

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

result:

ok Accepted

Test #12:

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

input:

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

output:

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

result:

ok Accepted

Test #13:

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

input:

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

output:

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

result:

ok Accepted

Test #14:

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

input:

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

output:

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

result:

ok Accepted

Test #15:

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

input:

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

output:

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

result:

ok Accepted

Test #16:

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

input:

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

output:

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

result:

ok Accepted

Test #17:

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

input:

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

output:

0 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 808 80...

result:

ok Accepted

Test #18:

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

input:

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

output:

0 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 883 88...

result:

ok Accepted

Test #19:

score: 0
Accepted
time: 223ms
memory: 3640kb

input:

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

output:

0 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 507 50...

result:

ok Accepted

Test #20:

score: 0
Accepted
time: 212ms
memory: 3764kb

input:

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

output:

0 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 639 63...

result:

ok Accepted

Test #21:

score: 0
Accepted
time: 215ms
memory: 3636kb

input:

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

output:

0 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 41...

result:

ok Accepted

Test #22:

score: 0
Accepted
time: 230ms
memory: 3680kb

input:

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

output:

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

result:

ok Accepted

Test #23:

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

input:

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

output:

0 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 31...

result:

ok Accepted

Test #24:

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

input:

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

output:

0 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 130 13...

result:

ok Accepted

Test #25:

score: 0
Accepted
time: 222ms
memory: 3680kb

input:

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

output:

0 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 10...

result:

ok Accepted

Test #26:

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

input:

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

output:

0 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 80...

result:

ok Accepted

Test #27:

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

input:

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

output:

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

result:

ok Accepted

Test #28:

score: 0
Accepted
time: 209ms
memory: 3676kb

input:

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

output:

0 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 26...

result:

ok Accepted

Test #29:

score: 0
Accepted
time: 212ms
memory: 3772kb

input:

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

output:

0 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 408 40...

result:

ok Accepted

Test #30:

score: 0
Accepted
time: 226ms
memory: 3640kb

input:

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

output:

0 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 928 92...

result:

ok Accepted

Test #31:

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

input:

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

output:

0 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 85...

result:

ok Accepted

Test #32:

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

input:

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

output:

0 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 71...

result:

ok Accepted

Test #33:

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

input:

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

output:

0 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 510 51...

result:

ok Accepted

Test #34:

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

input:

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

output:

0 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 578 57...

result:

ok Accepted

Test #35:

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

input:

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

output:

0 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 51...

result:

ok Accepted

Test #36:

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

input:

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

output:

0 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 4...

result:

ok Accepted

Test #37:

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

input:

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

output:

0 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 49...

result:

ok Accepted

Test #38:

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

input:

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

output:

0 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 572 57...

result:

ok Accepted

Test #39:

score: 0
Accepted
time: 210ms
memory: 3768kb

input:

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

output:

0 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 607 60...

result:

ok Accepted

Test #40:

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

input:

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

output:

0 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 41...

result:

ok Accepted

Test #41:

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

input:

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

output:

0 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 330 33...

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed