QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#595625#9432. Permutationucup-team3502#AC ✓320ms3992kbC++202.4kb2024-09-28 14:08:182024-09-28 14:08:25

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
0
2
1
0
0
2

output:

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

result:

ok Accepted

Test #2:

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

input:

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

output:

0 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 742 74...

result:

ok Accepted

Test #3:

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

input:

1

output:

1 1

result:

ok Accepted

Test #4:

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

input:

2
2

output:

0 2 1
1 2 1

result:

ok Accepted

Test #5:

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

input:

3
1
0
2

output:

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

result:

ok Accepted

Test #6:

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

input:

4
2
2
2
2

output:

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

result:

ok Accepted

Test #7:

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

input:

6
2
2
2
1
0
2
2
2

output:

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

result:

ok Accepted

Test #8:

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

input:

7
0
2
0
2
0
2
0
2
0

output:

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

result:

ok Accepted

Test #9:

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

input:

8
2
0
2
0
0
2
2
2
2
2
0
2

output:

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

result:

ok Accepted

Test #10:

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

input:

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

output:

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

result:

ok Accepted

Test #11:

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

input:

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

output:

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

result:

ok Accepted

Test #12:

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

input:

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

output:

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

result:

ok Accepted

Test #13:

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

input:

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

output:

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

result:

ok Accepted

Test #14:

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

input:

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

output:

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

result:

ok Accepted

Test #15:

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

input:

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

output:

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

result:

ok Accepted

Test #16:

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

input:

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

output:

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

result:

ok Accepted

Test #17:

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

input:

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

output:

0 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 232 23...

result:

ok Accepted

Test #18:

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

input:

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

output:

0 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 375 37...

result:

ok Accepted

Test #19:

score: 0
Accepted
time: 284ms
memory: 3732kb

input:

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

output:

0 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 8...

result:

ok Accepted

Test #20:

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

input:

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

output:

0 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 831 83...

result:

ok Accepted

Test #21:

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

input:

979
1
0
0
1
1
2
1
2
0
0
1
0
0
1
2
1
0
2
1
1
2
0
2
1
2
0
1
1
2
1
1
1
2
2
2
0
2
0
0
1
0
1
2
2
1
0
0
1
2
1
0
2
0
0
0
1
0
1
1
0
0
1
2
2
1
2
1
1
1
2
2
1
1
1
0
2
1
1
1
1
2
1
2
2
2
2
1
0
0
1
2
1
1
1
1
1
2
1
1
1
1
2
2
0
1
0
1
1
0
1
1
0
0
0
1
0
2
1
2
1
1
0
1
1
2
2
0
1
0
0
0
2
1
1
1
1
2
1
1
1
2
1
1
2
1
1
1
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 #22:

score: 0
Accepted
time: 296ms
memory: 3804kb

input:

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

output:

0 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 602 60...

result:

ok Accepted

Test #23:

score: 0
Accepted
time: 310ms
memory: 3992kb

input:

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

output:

0 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 243 24...

result:

ok Accepted

Test #24:

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

input:

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

output:

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

result:

ok Accepted

Test #25:

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

input:

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

output:

0 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 788 78...

result:

ok Accepted

Test #26:

score: 0
Accepted
time: 299ms
memory: 3992kb

input:

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

output:

0 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 441 44...

result:

ok Accepted

Test #27:

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

input:

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

output:

0 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 893 89...

result:

ok Accepted

Test #28:

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

input:

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

output:

0 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 683 68...

result:

ok Accepted

Test #29:

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

input:

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

output:

0 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 907 90...

result:

ok Accepted

Test #30:

score: 0
Accepted
time: 293ms
memory: 3732kb

input:

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

output:

0 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 92...

result:

ok Accepted

Test #31:

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

input:

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

output:

0 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 52...

result:

ok Accepted

Test #32:

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

input:

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

output:

0 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 711 71...

result:

ok Accepted

Test #33:

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

input:

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

output:

0 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 80...

result:

ok Accepted

Test #34:

score: 0
Accepted
time: 317ms
memory: 3736kb

input:

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

output:

0 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 594 59...

result:

ok Accepted

Test #35:

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

input:

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

output:

0 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 853 85...

result:

ok Accepted

Test #36:

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

input:

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

output:

0 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 1...

result:

ok Accepted

Test #37:

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

input:

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

output:

0 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 687 68...

result:

ok Accepted

Test #38:

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

input:

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

output:

0 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 978 97...

result:

ok Accepted

Test #39:

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

input:

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

output:

0 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 554 55...

result:

ok Accepted

Test #40:

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

input:

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

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

score: 0
Accepted
time: 319ms
memory: 3796kb

input:

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

output:

0 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 5...

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed