QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#599334#9432. Permutationucup-team907#AC ✓299ms3972kbC++175.1kb2024-09-29 03:31:562024-09-29 03:31:56

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
1
2
0
1
1
1
0
2

output:

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

result:

ok Accepted

Test #2:

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

input:

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

output:

0 203 199 203 199 203 199 203 199 203 199 203 199 203 199 203 199 203 199 203 199 203 199 203 199 203 199 203 199 203 199 203 199 203 199 203 199 203 199 203 199 203 199 203 199 203 199 203 199 203 199 203 199 203 199 203 199 203 199 203 199 203 199 203 199 203 199 203 199 203 199 203 199 203 199 20...

result:

ok Accepted

Test #3:

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

input:

1

output:

1 1 

result:

ok Accepted

Test #4:

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

input:

2
2

output:

0 2 1 
1 2 1 

result:

ok Accepted

Test #5:

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

input:

3
1
0
0

output:

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

result:

ok Accepted

Test #6:

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

input:

4
2
0
2
2

output:

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

result:

ok Accepted

Test #7:

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

input:

6
1
1
2
2
0
1
2
1
2
0

output:

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

result:

ok Accepted

Test #8:

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

input:

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

output:

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

result:

ok Accepted

Test #9:

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

input:

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

output:

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

result:

ok Accepted

Test #10:

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

input:

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

output:

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

result:

ok Accepted

Test #11:

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

input:

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

output:

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

result:

ok Accepted

Test #12:

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

input:

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

output:

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

result:

ok Accepted

Test #13:

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

input:

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

output:

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

result:

ok Accepted

Test #14:

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

input:

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

output:

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

result:

ok Accepted

Test #15:

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

input:

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

output:

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

result:

ok Accepted

Test #16:

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

input:

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

output:

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

result:

ok Accepted

Test #17:

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

input:

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

output:

0 228 723 228 723 228 723 228 723 228 723 228 723 228 723 228 723 228 723 228 723 228 723 228 723 228 723 228 723 228 723 228 723 228 723 228 723 228 723 228 723 228 723 228 723 228 723 228 723 228 723 228 723 228 723 228 723 228 723 228 723 228 723 228 723 228 723 228 723 228 723 228 723 228 723 22...

result:

ok Accepted

Test #18:

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

input:

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

output:

0 666 712 666 712 666 712 666 712 666 712 666 712 666 712 666 712 666 712 666 712 666 712 666 712 666 712 666 712 666 712 666 712 666 712 666 712 666 712 666 712 666 712 666 712 666 712 666 712 666 712 666 712 666 712 666 712 666 712 666 712 666 712 666 712 666 712 666 712 666 712 666 712 666 712 66...

result:

ok Accepted

Test #19:

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

input:

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

output:

0 699 32 699 32 699 32 699 32 699 32 699 32 699 32 699 32 699 32 699 32 699 32 699 32 699 32 699 32 699 32 699 32 699 32 699 32 699 32 699 32 699 32 699 32 699 32 699 32 699 32 699 32 699 32 699 32 699 32 699 32 699 32 699 32 699 32 699 32 699 32 699 32 699 32 699 32 699 32 699 32 699 32 699 32 699 ...

result:

ok Accepted

Test #20:

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

input:

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

output:

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

result:

ok Accepted

Test #21:

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

input:

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

output:

0 483 685 483 685 483 685 483 685 483 685 483 685 483 685 483 685 483 685 483 685 483 685 483 685 483 685 483 685 483 685 483 685 483 685 483 685 483 685 483 685 483 685 483 685 483 685 483 685 483 685 483 685 483 685 483 685 483 685 483 685 483 685 483 685 483 685 483 685 483 685 483 685 483 685 48...

result:

ok Accepted

Test #22:

score: 0
Accepted
time: 287ms
memory: 3940kb

input:

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

output:

0 40 855 40 855 40 855 40 855 40 855 40 855 40 855 40 855 40 855 40 855 40 855 40 855 40 855 40 855 40 855 40 855 40 855 40 855 40 855 40 855 40 855 40 855 40 855 40 855 40 855 40 855 40 855 40 855 40 855 40 855 40 855 40 855 40 855 40 855 40 855 40 855 40 855 40 855 40 855 40 855 40 855 40 855 40 8...

result:

ok Accepted

Test #23:

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

input:

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

output:

0 570 250 570 250 570 250 570 250 570 250 570 250 570 250 570 250 570 250 570 250 570 250 570 250 570 250 570 250 570 250 570 250 570 250 570 250 570 250 570 250 570 250 570 250 570 250 570 250 570 250 570 250 570 250 570 250 570 250 570 250 570 250 570 250 570 250 570 250 570 250 570 250 570 250 57...

result:

ok Accepted

Test #24:

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

input:

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

output:

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

result:

ok Accepted

Test #25:

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

input:

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

output:

0 286 870 286 870 286 870 286 870 286 870 286 870 286 870 286 870 286 870 286 870 286 870 286 870 286 870 286 870 286 870 286 870 286 870 286 870 286 870 286 870 286 870 286 870 286 870 286 870 286 870 286 870 286 870 286 870 286 870 286 870 286 870 286 870 286 870 286 870 286 870 286 870 286 870 28...

result:

ok Accepted

Test #26:

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

input:

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

output:

0 601 470 601 470 601 470 601 470 601 470 601 470 601 470 601 470 601 470 601 470 601 470 601 470 601 470 601 470 601 470 601 470 601 470 601 470 601 470 601 470 601 470 601 470 601 470 601 470 601 470 601 470 601 470 601 470 601 470 601 470 601 470 601 470 601 470 601 470 601 470 601 470 601 470 60...

result:

ok Accepted

Test #27:

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

input:

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

output:

0 976 40 976 40 976 40 976 40 976 40 976 40 976 40 976 40 976 40 976 40 976 40 976 40 976 40 976 40 976 40 976 40 976 40 976 40 976 40 976 40 976 40 976 40 976 40 976 40 976 40 976 40 976 40 976 40 976 40 976 40 976 40 976 40 976 40 976 40 976 40 976 40 976 40 976 40 976 40 976 40 976 40 976 40 976 ...

result:

ok Accepted

Test #28:

score: 0
Accepted
time: 267ms
memory: 3748kb

input:

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

output:

0 73 75 73 75 73 75 73 75 73 75 73 75 73 75 73 75 73 75 73 75 73 75 73 75 73 75 73 75 73 75 73 75 73 75 73 75 73 75 73 75 73 75 73 75 73 75 73 75 73 75 73 75 73 75 73 75 73 75 73 75 73 75 73 75 73 75 73 75 73 75 73 75 73 75 73 75 73 75 73 75 73 75 73 75 73 75 73 75 73 75 73 75 73 75 73 75 73 75 73 7...

result:

ok Accepted

Test #29:

score: 0
Accepted
time: 270ms
memory: 3748kb

input:

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

output:

0 884 341 884 341 884 341 884 341 884 341 884 341 884 341 884 341 884 341 884 341 884 341 884 341 884 341 884 341 884 341 884 341 884 341 884 341 884 341 884 341 884 341 884 341 884 341 884 341 884 341 884 341 884 341 884 341 884 341 884 341 884 341 884 341 884 341 884 341 884 341 884 341 884 341 88...

result:

ok Accepted

Test #30:

score: 0
Accepted
time: 291ms
memory: 3940kb

input:

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

output:

0 267 235 267 235 267 235 267 235 267 235 267 235 267 235 267 235 267 235 267 235 267 235 267 235 267 235 267 235 267 235 267 235 267 235 267 235 267 235 267 235 267 235 267 235 267 235 267 235 267 235 267 235 267 235 267 235 267 235 267 235 267 235 267 235 267 235 267 235 267 235 267 235 267 235 26...

result:

ok Accepted

Test #31:

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

input:

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

output:

0 231 636 231 636 231 636 231 636 231 636 231 636 231 636 231 636 231 636 231 636 231 636 231 636 231 636 231 636 231 636 231 636 231 636 231 636 231 636 231 636 231 636 231 636 231 636 231 636 231 636 231 636 231 636 231 636 231 636 231 636 231 636 231 636 231 636 231 636 231 636 231 636 231 636 23...

result:

ok Accepted

Test #32:

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

input:

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

output:

0 423 25 423 25 423 25 423 25 423 25 423 25 423 25 423 25 423 25 423 25 423 25 423 25 423 25 423 25 423 25 423 25 423 25 423 25 423 25 423 25 423 25 423 25 423 25 423 25 423 25 423 25 423 25 423 25 423 25 423 25 423 25 423 25 423 25 423 25 423 25 423 25 423 25 423 25 423 25 423 25 423 25 423 25 423 ...

result:

ok Accepted

Test #33:

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

input:

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

output:

0 30 126 30 126 30 126 30 126 30 126 30 126 30 126 30 126 30 126 30 126 30 126 30 126 30 126 30 126 30 126 30 126 30 126 30 126 30 126 30 126 30 126 30 126 30 126 30 126 30 126 30 126 30 126 30 126 30 126 30 126 30 126 30 126 30 126 30 126 30 126 30 126 30 126 30 126 30 126 30 126 30 126 30 126 30 1...

result:

ok Accepted

Test #34:

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

input:

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

output:

0 463 648 463 648 463 648 463 648 463 648 463 648 463 648 463 648 463 648 463 648 463 648 463 648 463 648 463 648 463 648 463 648 463 648 463 648 463 648 463 648 463 648 463 648 463 648 463 648 463 648 463 648 463 648 463 648 463 648 463 648 463 648 463 648 463 648 463 648 463 648 463 648 463 648 46...

result:

ok Accepted

Test #35:

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

input:

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

output:

0 84 521 84 521 84 521 84 521 84 521 84 521 84 521 84 521 84 521 84 521 84 521 84 521 84 521 84 521 84 521 84 521 84 521 84 521 84 521 84 521 84 521 84 521 84 521 84 521 84 521 84 521 84 521 84 521 84 521 84 521 84 521 84 521 84 521 84 521 84 521 84 521 84 521 84 521 84 521 84 521 84 521 84 521 84 5...

result:

ok Accepted

Test #36:

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

input:

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

output:

0 594 17 594 17 594 17 594 17 594 17 594 17 594 17 594 17 594 17 594 17 594 17 594 17 594 17 594 17 594 17 594 17 594 17 594 17 594 17 594 17 594 17 594 17 594 17 594 17 594 17 594 17 594 17 594 17 594 17 594 17 594 17 594 17 594 17 594 17 594 17 594 17 594 17 594 17 594 17 594 17 594 17 594 17 594 ...

result:

ok Accepted

Test #37:

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

input:

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

output:

0 508 261 508 261 508 261 508 261 508 261 508 261 508 261 508 261 508 261 508 261 508 261 508 261 508 261 508 261 508 261 508 261 508 261 508 261 508 261 508 261 508 261 508 261 508 261 508 261 508 261 508 261 508 261 508 261 508 261 508 261 508 261 508 261 508 261 508 261 508 261 508 261 508 261 50...

result:

ok Accepted

Test #38:

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

input:

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

output:

0 879 619 879 619 879 619 879 619 879 619 879 619 879 619 879 619 879 619 879 619 879 619 879 619 879 619 879 619 879 619 879 619 879 619 879 619 879 619 879 619 879 619 879 619 879 619 879 619 879 619 879 619 879 619 879 619 879 619 879 619 879 619 879 619 879 619 879 619 879 619 879 619 879 619 87...

result:

ok Accepted

Test #39:

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

input:

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

output:

0 416 257 416 257 416 257 416 257 416 257 416 257 416 257 416 257 416 257 416 257 416 257 416 257 416 257 416 257 416 257 416 257 416 257 416 257 416 257 416 257 416 257 416 257 416 257 416 257 416 257 416 257 416 257 416 257 416 257 416 257 416 257 416 257 416 257 416 257 416 257 416 257 416 257 41...

result:

ok Accepted

Test #40:

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

input:

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

output:

0 252 393 252 393 252 393 252 393 252 393 252 393 252 393 252 393 252 393 252 393 252 393 252 393 252 393 252 393 252 393 252 393 252 393 252 393 252 393 252 393 252 393 252 393 252 393 252 393 252 393 252 393 252 393 252 393 252 393 252 393 252 393 252 393 252 393 252 393 252 393 252 393 252 393 25...

result:

ok Accepted

Test #41:

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

input:

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

output:

0 369 35 369 35 369 35 369 35 369 35 369 35 369 35 369 35 369 35 369 35 369 35 369 35 369 35 369 35 369 35 369 35 369 35 369 35 369 35 369 35 369 35 369 35 369 35 369 35 369 35 369 35 369 35 369 35 369 35 369 35 369 35 369 35 369 35 369 35 369 35 369 35 369 35 369 35 369 35 369 35 369 35 369 35 369 ...

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed