QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#746096#9432. PermutationHuluoboAC ✓211ms4008kbC++141.2kb2024-11-14 13:24:232024-11-14 13:24:23

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
0
1
2
2
0
0

output:

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

input:

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

output:

0 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 748 74...

result:

ok Accepted

Test #3:

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

input:

1

output:

1 1 

result:

ok Accepted

Test #4:

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

input:

2
0

output:

0 1 2 
1 2 1 

result:

ok Accepted

Test #5:

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

input:

3
2
2

output:

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

result:

ok Accepted

Test #6:

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

input:

4
0
2
0
0

output:

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

result:

ok Accepted

Test #7:

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

input:

6
1
0
0
2
0
0
2

output:

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

result:

ok Accepted

Test #8:

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

input:

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

output:

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

input:

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

output:

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

input:

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

output:

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

result:

ok Accepted

Test #11:

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

input:

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

output:

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

result:

ok Accepted

Test #12:

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

input:

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

output:

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

result:

ok Accepted

Test #13:

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

input:

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

output:

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

result:

ok Accepted

Test #14:

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

input:

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

output:

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

result:

ok Accepted

Test #15:

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

input:

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

output:

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

result:

ok Accepted

Test #16:

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

input:

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

output:

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

result:

ok Accepted

Test #17:

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

input:

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

output:

0 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 84...

result:

ok Accepted

Test #18:

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

input:

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

output:

0 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 542 54...

result:

ok Accepted

Test #19:

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

input:

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

output:

0 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 5...

result:

ok Accepted

Test #20:

score: 0
Accepted
time: 194ms
memory: 3692kb

input:

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

output:

0 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 235 23...

result:

ok Accepted

Test #21:

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

input:

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

output:

0 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 85...

result:

ok Accepted

Test #22:

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

input:

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

output:

0 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 43...

result:

ok Accepted

Test #23:

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

input:

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

output:

0 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 45...

result:

ok Accepted

Test #24:

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

input:

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

output:

0 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 96...

result:

ok Accepted

Test #25:

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

input:

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

output:

0 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 30...

result:

ok Accepted

Test #26:

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

input:

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

output:

0 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 698 69...

result:

ok Accepted

Test #27:

score: 0
Accepted
time: 205ms
memory: 3748kb

input:

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

output:

0 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 980 98...

result:

ok Accepted

Test #28:

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

input:

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

output:

0 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 206 20...

result:

ok Accepted

Test #29:

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

input:

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

output:

0 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 58...

result:

ok Accepted

Test #30:

score: 0
Accepted
time: 200ms
memory: 3740kb

input:

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

output:

0 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 56...

result:

ok Accepted

Test #31:

score: 0
Accepted
time: 197ms
memory: 3752kb

input:

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

output:

0 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 943 94...

result:

ok Accepted

Test #32:

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

input:

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

output:

0 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 144 14...

result:

ok Accepted

Test #33:

score: 0
Accepted
time: 186ms
memory: 3752kb

input:

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

output:

0 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 208 20...

result:

ok Accepted

Test #34:

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

input:

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

output:

0 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 396 39...

result:

ok Accepted

Test #35:

score: 0
Accepted
time: 189ms
memory: 3748kb

input:

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

output:

0 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 733 73...

result:

ok Accepted

Test #36:

score: 0
Accepted
time: 195ms
memory: 4008kb

input:

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

output:

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

result:

ok Accepted

Test #37:

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

input:

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

output:

0 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 789 78...

result:

ok Accepted

Test #38:

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

input:

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

output:

0 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 186 18...

result:

ok Accepted

Test #39:

score: 0
Accepted
time: 201ms
memory: 3688kb

input:

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

output:

0 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 977 97...

result:

ok Accepted

Test #40:

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

input:

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

output:

0 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 564 56...

result:

ok Accepted

Test #41:

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

input:

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

output:

0 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 71...

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed