QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#597156#9432. Permutationucup-team3479#AC ✓241ms3852kbC++235.6kb2024-09-28 17:10:272024-09-28 17:10:27

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
1
0
2
3
3
1

output:

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

result:

ok Accepted

Test #2:

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

input:

1000
1
2
1
1
1
2
1
1
1
1
2
2
1
2
2
2
1
2
2
2
2
1
3
2
1
1
3
1
3
1
2
1
2
2
1
3
2
1
1
2
2
3
1
2
2
2
1
3
2
2
1
2
1
2
1
2
2
2
1
1
1
2
1
1
1
3
1
1
1
1
1
1
2
1
3
3
2
1
2
2
1
2
2
2
1
1
2
2
2
1
3
2
2
2
1
3
3
1
2
1
1
1
1
1
2
1
1
2
1
2
2
2
2
2
2
2
2
2
2
3
2
2
2
2
2
1
1
2
2
2
2
2
1
2
2
2
2
3
2
2
2
1
1
2
1
2
2
3...

output:

0 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 88...

result:

ok Accepted

Test #3:

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

input:

1

output:

1 1 

result:

ok Accepted

Test #4:

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

input:

2
2

output:

0 2 1 
1 2 1 

result:

ok Accepted

Test #5:

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

input:

3
1
1
2
1

output:

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

result:

ok Accepted

Test #6:

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

input:

4
1
0
1
2
1
3

output:

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

result:

ok Accepted

Test #7:

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

input:

6
0
1
1
3
1
1
2
1
1

output:

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

result:

ok Accepted

Test #8:

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

input:

7
0
1
2
1
1
1
1
3
3

output:

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

result:

ok Accepted

Test #9:

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

input:

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

output:

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

result:

ok Accepted

Test #10:

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

input:

9
2
1
2
2
1
2
1
3
1
2
2
1
2
1
3
3

output:

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

result:

ok Accepted

Test #11:

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

input:

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

output:

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

result:

ok Accepted

Test #12:

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

input:

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

output:

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

result:

ok Accepted

Test #13:

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

input:

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

output:

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

result:

ok Accepted

Test #14:

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

input:

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

output:

0 6 6 6 6 6 6 13 13 13 13 13 13 13 
0 13 13 13 6 6 6 6 6 6 6 6 6 6 
0 13 6 6 6 6 6 6 6 6 6 6 6 6 
0 13 2 2 1 2 1 1 2 2 1 1 2 1 
0 13 13 13 1 13 1 1 13 13 1 1 13 1 
0 13 13 13 2 13 2 1 13 13 1 1 13 2 
0 13 13 13 1 13 13 2 13 13 13 13 13 13 
0 13 13 13 1 13 13 13 13 13 13 13 13 13 
0 13 13 13 13 13 13...

result:

ok Accepted

Test #15:

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

input:

14
2
2
1
2
2
2
2
2
1
1
3
2
1
2
2
2
1
2
2
3
2
2
2
1
1
3
1
3
3
2
1

output:

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

result:

ok Accepted

Test #16:

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

input:

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

output:

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

result:

ok Accepted

Test #17:

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

input:

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

output:

0 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 812 81...

result:

ok Accepted

Test #18:

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

input:

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

output:

0 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 16...

result:

ok Accepted

Test #19:

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

input:

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

output:

0 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 877 87...

result:

ok Accepted

Test #20:

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

input:

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

output:

0 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 10...

result:

ok Accepted

Test #21:

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

input:

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

output:

0 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 61...

result:

ok Accepted

Test #22:

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

input:

980
1
2
2
2
2
1
1
2
1
1
2
3
3
3
3
3
2
1
2
2
1
2
1
2
1
2
2
2
1
2
1
2
1
1
2
1
1
3
2
1
2
1
3
3
3
2
1
2
2
2
1
2
1
3
2
1
1
1
2
2
3
2
1
2
1
2
2
2
1
3
2
2
2
2
2
1
1
2
1
1
2
1
1
3
3
1
2
1
2
1
1
2
2
2
1
2
2
3
2
1
2
2
1
3
2
1
1
2
2
3
2
1
2
1
2
1
2
2
2
2
2
2
2
2
2
1
2
2
1
2
1
1
3
2
1
2
2
2
2
1
3
1
3
2
2
1
3
2
...

output:

0 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 874 87...

result:

ok Accepted

Test #23:

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

input:

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

output:

0 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 66...

result:

ok Accepted

Test #24:

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

input:

982
1
1
1
2
2
2
1
1
1
1
1
2
2
2
1
2
1
1
3
2
2
1
2
1
2
2
1
2
1
2
1
1
1
2
2
1
2
1
3
2
1
1
3
2
1
3
2
2
2
2
1
3
3
2
2
1
3
2
1
2
2
3
2
2
1
3
2
2
2
2
3
1
3
2
2
2
2
2
1
3
1
1
2
1
1
1
1
1
3
1
2
2
3
2
2
2
1
3
2
1
1
2
1
1
2
1
2
1
3
2
2
2
1
3
3
1
3
3
1
1
2
1
3
2
2
3
3
3
2
1
2
2
2
1
3
3
1
2
2
3
2
2
2
2
3
3
1
3
...

output:

0 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 793 79...

result:

ok Accepted

Test #25:

score: 0
Accepted
time: 221ms
memory: 3516kb

input:

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

output:

0 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 783 78...

result:

ok Accepted

Test #26:

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

input:

984
1
2
1
2
2
1
1
2
2
2
1
2
1
3
2
2
1
1
3
3
2
1
3
1
1
2
1
2
1
2
2
1
1
3
1
2
2
3
3
1
1
2
1
2
1
3
3
2
2
2
1
1
1
3
2
1
2
1
2
1
3
2
1
1
2
1
2
1
1
2
1
2
1
2
2
1
2
2
3
2
1
3
2
2
2
2
1
2
2
3
2
1
2
2
2
1
3
2
1
2
2
1
2
1
3
2
2
1
2
1
2
1
3
3
2
2
2
1
3
2
2
2
2
2
2
1
2
2
2
1
2
2
2
2
2
1
2
1
2
1
2
2
3
2
1
2
2
2
...

output:

0 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 65...

result:

ok Accepted

Test #27:

score: 0
Accepted
time: 224ms
memory: 3532kb

input:

985
2
2
1
1
2
1
1
1
1
2
2
1
2
2
1
1
3
2
1
1
1
2
2
2
2
2
1
1
1
2
2
2
1
1
2
2
2
2
1
1
3
2
2
3
3
2
2
2
1
2
1
1
3
2
2
3
1
2
2
1
3
1
1
2
1
3
2
1
2
2
1
2
1
1
3
2
1
1
2
1
2
2
3
3
2
2
1
1
2
1
3
1
1
1
2
2
1
2
1
2
1
2
2
1
3
1
2
2
1
2
1
2
2
2
2
1
1
2
1
2
1
2
1
3
1
2
2
2
2
3
1
3
2
1
3
2
2
2
1
2
2
2
2
3
2
2
2
2
...

output:

0 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 75...

result:

ok Accepted

Test #28:

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

input:

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

output:

0 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 592 59...

result:

ok Accepted

Test #29:

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

input:

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

output:

0 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 940 94...

result:

ok Accepted

Test #30:

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

input:

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

output:

0 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 320 32...

result:

ok Accepted

Test #31:

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

input:

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

output:

0 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 53...

result:

ok Accepted

Test #32:

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

input:

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

output:

0 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 72...

result:

ok Accepted

Test #33:

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

input:

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

output:

0 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 13...

result:

ok Accepted

Test #34:

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

input:

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

output:

0 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 64...

result:

ok Accepted

Test #35:

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

input:

993
1
0
1
2
1
2
2
1
1
1
2
1
2
1
1
2
2
3
2
2
2
1
1
1
2
2
2
2
2
2
2
1
3
1
1
1
2
1
1
1
2
1
2
1
2
2
2
2
2
1
2
2
3
2
1
1
3
1
2
1
2
1
2
1
2
2
2
2
3
1
2
1
3
2
1
3
1
2
2
2
2
3
1
2
1
2
2
2
2
2
1
3
2
1
2
1
2
2
3
2
2
2
2
1
2
2
1
3
2
2
1
2
1
1
1
2
1
3
2
2
2
1
3
1
1
2
1
2
1
2
2
2
2
2
2
2
1
2
2
2
2
2
1
2
2
1
2
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 #36:

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

input:

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

output:

0 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 9...

result:

ok Accepted

Test #37:

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

input:

995
1
2
1
2
1
1
1
2
1
1
1
2
2
2
1
3
2
1
2
2
2
1
2
1
2
2
3
3
1
2
1
3
1
1
1
1
3
3
2
2
3
2
1
2
1
2
2
2
1
2
2
2
2
1
1
2
1
1
1
3
2
2
2
1
2
2
3
2
1
1
2
2
2
1
3
2
1
3
1
2
1
2
2
3
1
3
2
1
1
2
1
2
2
2
2
2
2
3
2
2
3
1
1
2
2
1
1
3
2
2
1
2
2
2
1
1
1
2
2
2
1
1
2
1
2
2
2
2
3
2
1
3
1
2
2
2
1
2
2
3
2
1
2
1
3
1
3
3
...

output:

0 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 859 85...

result:

ok Accepted

Test #38:

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

input:

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

output:

0 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 293 29...

result:

ok Accepted

Test #39:

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

input:

997
1
2
2
2
2
2
2
2
2
2
3
3
2
2
1
2
1
3
2
2
2
1
2
1
1
1
3
2
1
2
1
3
1
3
2
1
1
1
3
1
1
2
1
2
1
3
1
2
2
2
1
2
2
1
1
3
1
1
3
2
2
1
2
1
2
1
2
2
2
2
2
1
1
2
1
2
2
2
2
2
2
1
2
2
3
2
1
2
1
2
2
1
1
3
1
2
1
2
2
2
2
2
2
2
2
1
2
2
2
2
2
1
2
2
1
1
1
1
2
1
3
2
1
2
2
2
1
3
1
2
1
1
3
2
1
1
3
1
3
3
2
1
1
1
2
2
3
2
...

output:

0 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 31...

result:

ok Accepted

Test #40:

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

input:

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

output:

0 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 18...

result:

ok Accepted

Test #41:

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

input:

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

output:

0 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 57...

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed