QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#691598#9432. Permutationucup-team3475#AC ✓281ms4184kbC++203.6kb2024-10-31 12:10:152024-10-31 12:10:17

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
1
1
2
0
2
0

output:

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

result:

ok Accepted

Test #2:

score: 0
Accepted
time: 260ms
memory: 4184kb

input:

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

output:

0 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 71...

result:

ok Accepted

Test #3:

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

input:

1

output:

1 1

result:

ok Accepted

Test #4:

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

input:

2
0

output:

0 1 2
1 2 1

result:

ok Accepted

Test #5:

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

input:

3
0
2

output:

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

result:

ok Accepted

Test #6:

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

input:

4
2
0
0
0

output:

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

result:

ok Accepted

Test #7:

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

input:

6
0
1
1
0
2
0
1
2
2

output:

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

input:

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

output:

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

input:

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

output:

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

input:

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

output:

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

result:

ok Accepted

Test #11:

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

input:

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

output:

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

result:

ok Accepted

Test #12:

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

input:

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

output:

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

result:

ok Accepted

Test #13:

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

input:

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

output:

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

result:

ok Accepted

Test #14:

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

input:

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

output:

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

result:

ok Accepted

Test #15:

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

input:

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

output:

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

result:

ok Accepted

Test #16:

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

input:

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

output:

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

result:

ok Accepted

Test #17:

score: 0
Accepted
time: 257ms
memory: 3868kb

input:

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

output:

0 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...

result:

ok Accepted

Test #18:

score: 0
Accepted
time: 257ms
memory: 4184kb

input:

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

output:

0 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 8...

result:

ok Accepted

Test #19:

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

input:

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

output:

0 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 625 62...

result:

ok Accepted

Test #20:

score: 0
Accepted
time: 262ms
memory: 3892kb

input:

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

output:

0 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 17...

result:

ok Accepted

Test #21:

score: 0
Accepted
time: 257ms
memory: 3884kb

input:

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

output:

0 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 811 81...

result:

ok Accepted

Test #22:

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

input:

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

output:

0 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 296 29...

result:

ok Accepted

Test #23:

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

input:

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

output:

0 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 366 36...

result:

ok Accepted

Test #24:

score: 0
Accepted
time: 276ms
memory: 3888kb

input:

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

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

score: 0
Accepted
time: 245ms
memory: 3952kb

input:

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

output:

0 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 971 97...

result:

ok Accepted

Test #26:

score: 0
Accepted
time: 273ms
memory: 4180kb

input:

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

output:

0 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 346 34...

result:

ok Accepted

Test #27:

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

input:

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

output:

0 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 552 55...

result:

ok Accepted

Test #28:

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

input:

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

output:

0 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 297 29...

result:

ok Accepted

Test #29:

score: 0
Accepted
time: 256ms
memory: 3900kb

input:

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

output:

0 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 42...

result:

ok Accepted

Test #30:

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

input:

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

output:

0 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 282 28...

result:

ok Accepted

Test #31:

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

input:

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

output:

0 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 6...

result:

ok Accepted

Test #32:

score: 0
Accepted
time: 252ms
memory: 4180kb

input:

990
0
0
1
1
0
1
0
0
2
1
1
2
2
0
0
1
1
1
1
2
0
1
2
0
1
2
1
0
1
1
1
1
1
2
0
0
0
2
1
1
1
2
1
0
2
1
0
1
1
0
1
1
1
1
0
0
1
1
2
1
1
1
2
1
0
1
0
2
1
2
1
2
1
1
2
1
1
1
1
1
1
0
1
1
1
1
1
0
0
1
1
1
1
1
1
1
2
1
1
2
1
0
0
2
2
2
1
0
2
2
2
0
1
1
1
2
1
2
2
1
1
1
1
2
0
0
1
1
1
1
2
0
1
1
2
2
1
2
1
1
2
1
0
2
0
2
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 #33:

score: 0
Accepted
time: 265ms
memory: 3952kb

input:

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

output:

0 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 556 55...

result:

ok Accepted

Test #34:

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

input:

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

output:

0 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 48...

result:

ok Accepted

Test #35:

score: 0
Accepted
time: 278ms
memory: 4176kb

input:

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

output:

0 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 81...

result:

ok Accepted

Test #36:

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

input:

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

output:

0 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 145 14...

result:

ok Accepted

Test #37:

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

input:

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

output:

0 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 769 76...

result:

ok Accepted

Test #38:

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

input:

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

output:

0 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 86...

result:

ok Accepted

Test #39:

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

input:

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

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

score: 0
Accepted
time: 276ms
memory: 3900kb

input:

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

output:

0 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 168 16...

result:

ok Accepted

Test #41:

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

input:

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

output:

0 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 47...

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed