QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#594583#9432. Permutationucup-team3407#AC ✓272ms3968kbC++141.3kb2024-09-28 08:49:132024-09-28 08:49:14

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
0
1
2
0
0
0

output:

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

result:

ok Accepted

Test #2:

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

input:

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

output:

0 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 209 20...

result:

ok Accepted

Test #3:

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

input:

1

output:

1 1 

result:

ok Accepted

Test #4:

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

input:

2
0

output:

0 1 2 
1 2 1 

result:

ok Accepted

Test #5:

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

input:

3
1
2
2

output:

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

result:

ok Accepted

Test #6:

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

input:

4
2
0
0
2

output:

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

result:

ok Accepted

Test #7:

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

input:

6
1
2
2
2
0
1
2
2

output:

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

result:

ok Accepted

Test #8:

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

input:

7
1
0
1
2
1
0
0
2
0
0

output:

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

result:

ok Accepted

Test #9:

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

input:

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

output:

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

result:

ok Accepted

Test #10:

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

input:

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

output:

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

result:

ok Accepted

Test #11:

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

input:

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

output:

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

result:

ok Accepted

Test #12:

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

input:

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

output:

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

result:

ok Accepted

Test #13:

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

input:

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

output:

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

result:

ok Accepted

Test #14:

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

input:

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

output:

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

result:

ok Accepted

Test #15:

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

input:

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

output:

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

result:

ok Accepted

Test #16:

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

input:

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

output:

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

result:

ok Accepted

Test #17:

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

input:

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

output:

0 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 94...

result:

ok Accepted

Test #18:

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

input:

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

output:

0 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 599 59...

result:

ok Accepted

Test #19:

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

input:

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

output:

0 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 61...

result:

ok Accepted

Test #20:

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

input:

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

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

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

input:

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

output:

0 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 58...

result:

ok Accepted

Test #22:

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

input:

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

output:

0 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 81...

result:

ok Accepted

Test #23:

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

input:

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

output:

0 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 65...

result:

ok Accepted

Test #24:

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

input:

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

output:

0 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 927 92...

result:

ok Accepted

Test #25:

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

input:

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

output:

0 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 936 93...

result:

ok Accepted

Test #26:

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

input:

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

output:

0 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 861 86...

result:

ok Accepted

Test #27:

score: 0
Accepted
time: 248ms
memory: 3784kb

input:

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

output:

0 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 959 95...

result:

ok Accepted

Test #28:

score: 0
Accepted
time: 253ms
memory: 3968kb

input:

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

output:

0 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 466 46...

result:

ok Accepted

Test #29:

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

input:

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

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

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

input:

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

output:

0 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 837 83...

result:

ok Accepted

Test #31:

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

input:

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

output:

0 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 516 51...

result:

ok Accepted

Test #32:

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

input:

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

output:

0 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 422 42...

result:

ok Accepted

Test #33:

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

input:

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

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

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

input:

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

output:

0 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 565 56...

result:

ok Accepted

Test #35:

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

input:

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

output:

0 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 8...

result:

ok Accepted

Test #36:

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

input:

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

output:

0 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 672 67...

result:

ok Accepted

Test #37:

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

input:

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

output:

0 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 547 54...

result:

ok Accepted

Test #38:

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

input:

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

output:

0 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 7...

result:

ok Accepted

Test #39:

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

input:

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

output:

0 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 617 61...

result:

ok Accepted

Test #40:

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

input:

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

output:

0 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 406 40...

result:

ok Accepted

Test #41:

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

input:

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

output:

0 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 818 81...

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed