QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#597972#9432. Permutationucup-team3944#AC ✓219ms3984kbC++143.2kb2024-09-28 19:47:092024-09-28 19:47:09

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
1
0
0
2
1
0
0

output:

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

result:

ok Accepted

Test #2:

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

input:

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

output:

0 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 93...

result:

ok Accepted

Test #3:

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

input:

1

output:

1 1 

result:

ok Accepted

Test #4:

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

input:

2
2

output:

0 2 1 
1 2 1 

result:

ok Accepted

Test #5:

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

input:

3
0
2

output:

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

result:

ok Accepted

Test #6:

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

input:

4
0
0
2
2

output:

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

result:

ok Accepted

Test #7:

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

input:

6
1
2
2
2
0
1
0
0

output:

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

result:

ok Accepted

Test #8:

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

input:

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

output:

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

result:

ok Accepted

Test #9:

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

input:

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

output:

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

input:

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

output:

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

result:

ok Accepted

Test #11:

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

input:

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

output:

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

result:

ok Accepted

Test #12:

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

input:

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

output:

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

result:

ok Accepted

Test #13:

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

input:

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

output:

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

result:

ok Accepted

Test #14:

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

input:

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

output:

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

result:

ok Accepted

Test #15:

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

input:

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

output:

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

result:

ok Accepted

Test #16:

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

input:

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

output:

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

result:

ok Accepted

Test #17:

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

input:

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

output:

0 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 76...

result:

ok Accepted

Test #18:

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

input:

976
2
0
0
1
1
2
1
0
0
2
2
1
1
0
1
0
0
1
0
1
2
1
1
2
1
1
1
2
1
1
0
1
2
1
2
1
2
0
1
1
1
1
1
2
1
1
0
1
0
0
1
1
2
1
1
2
1
2
1
0
2
1
1
2
2
2
1
1
1
1
1
0
1
1
1
2
2
1
2
1
1
1
0
1
1
1
0
0
0
0
2
1
1
1
1
0
0
1
0
1
0
0
0
1
2
2
1
1
1
0
1
0
2
1
1
1
0
2
1
1
1
0
1
2
1
1
2
2
1
2
2
0
1
0
1
0
1
1
1
2
1
1
2
0
1
0
0
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 #19:

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

input:

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

output:

0 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 29...

result:

ok Accepted

Test #20:

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

input:

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

output:

0 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 51...

result:

ok Accepted

Test #21:

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

input:

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

output:

0 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 4...

result:

ok Accepted

Test #22:

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

input:

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

output:

0 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 899 89...

result:

ok Accepted

Test #23:

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

input:

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

output:

0 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 24...

result:

ok Accepted

Test #24:

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

input:

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

output:

0 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 84...

result:

ok Accepted

Test #25:

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

input:

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

output:

0 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 97...

result:

ok Accepted

Test #26:

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

input:

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

output:

0 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 778 77...

result:

ok Accepted

Test #27:

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

input:

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

output:

0 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 90...

result:

ok Accepted

Test #28:

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

input:

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

output:

0 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 846 84...

result:

ok Accepted

Test #29:

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

input:

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

output:

0 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 79...

result:

ok Accepted

Test #30:

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

input:

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

output:

0 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 2...

result:

ok Accepted

Test #31:

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

input:

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

output:

0 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 90...

result:

ok Accepted

Test #32:

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

input:

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

output:

0 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 277 27...

result:

ok Accepted

Test #33:

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

input:

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

output:

0 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 458 45...

result:

ok Accepted

Test #34:

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

input:

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

output:

0 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 225 22...

result:

ok Accepted

Test #35:

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

input:

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

output:

0 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 83...

result:

ok Accepted

Test #36:

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

input:

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

output:

0 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 52...

result:

ok Accepted

Test #37:

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

input:

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

output:

0 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 258 25...

result:

ok Accepted

Test #38:

score: 0
Accepted
time: 174ms
memory: 3964kb

input:

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

output:

0 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 854 85...

result:

ok Accepted

Test #39:

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

input:

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

output:

0 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 7...

result:

ok Accepted

Test #40:

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

input:

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

output:

0 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 213 21...

result:

ok Accepted

Test #41:

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

input:

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

output:

0 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 129 12...

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed