QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#598486#9432. Permutationucup-team121#AC ✓244ms3900kbC++207.8kb2024-09-28 22:06:542024-09-28 22:06:54

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
1
2
0
1
2
1
1
2
0

output:

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

result:

ok Accepted

Test #2:

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

input:

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

output:

0 930 930 203 203 930 930 203 203 930 930 203 203 930 930 203 203 930 930 203 203 930 930 203 203 930 930 203 203 930 930 203 203 930 930 203 203 930 930 203 203 930 930 203 203 930 930 203 203 930 930 203 203 930 930 203 203 930 930 203 203 930 930 203 203 930 930 203 203 930 930 203 203 930 930 20...

result:

ok Accepted

Test #3:

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

input:

1

output:

1 1

result:

ok Accepted

Test #4:

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

input:

2
0

output:

0 1 2
1 2 1

result:

ok Accepted

Test #5:

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

input:

3
2
1
0

output:

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

result:

ok Accepted

Test #6:

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

input:

4
0
0
2
0

output:

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

result:

ok Accepted

Test #7:

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

input:

6
0
2
1
1
0
1
0
1
2
0
0

output:

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

result:

ok Accepted

Test #8:

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

input:

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

output:

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

result:

ok Accepted

Test #9:

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

input:

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

output:

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

input:

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

output:

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

result:

ok Accepted

Test #11:

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

input:

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

output:

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

result:

ok Accepted

Test #12:

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

input:

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

output:

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

result:

ok Accepted

Test #13:

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

input:

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

output:

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

result:

ok Accepted

Test #14:

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

input:

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

output:

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

result:

ok Accepted

Test #15:

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

input:

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

output:

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

result:

ok Accepted

Test #16:

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

input:

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

output:

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

result:

ok Accepted

Test #17:

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

input:

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

output:

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

result:

ok Accepted

Test #18:

score: 0
Accepted
time: 228ms
memory: 3524kb

input:

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

output:

0 910 910 438 438 910 910 438 438 910 910 438 438 910 910 438 438 910 910 438 438 910 910 438 438 910 910 438 438 910 910 438 438 910 910 438 438 910 910 438 438 910 910 438 438 910 910 438 438 910 910 438 438 910 910 438 438 910 910 438 438 910 910 438 438 910 910 438 438 910 910 438 438 910 910 43...

result:

ok Accepted

Test #19:

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

input:

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

output:

0 798 798 376 376 798 798 376 376 798 798 376 376 798 798 376 376 798 798 376 376 798 798 376 376 798 798 376 376 798 798 376 376 798 798 376 376 798 798 376 376 798 798 376 376 798 798 376 376 798 798 376 376 798 798 376 376 798 798 376 376 798 798 376 376 798 798 376 376 798 798 376 376 798 798 37...

result:

ok Accepted

Test #20:

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

input:

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

output:

0 160 160 605 605 160 160 605 605 160 160 605 605 160 160 605 605 160 160 605 605 160 160 605 605 160 160 605 605 160 160 605 605 160 160 605 605 160 160 605 605 160 160 605 605 160 160 605 605 160 160 605 605 160 160 605 605 160 160 605 605 160 160 605 605 160 160 605 605 160 160 605 605 160 160 60...

result:

ok Accepted

Test #21:

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

input:

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

output:

0 893 893 684 684 893 893 684 684 893 893 684 684 893 893 684 684 893 893 684 684 893 893 684 684 893 893 684 684 893 893 684 684 893 893 684 684 893 893 684 684 893 893 684 684 893 893 684 684 893 893 684 684 893 893 684 684 893 893 684 684 893 893 684 684 893 893 684 684 893 893 684 684 893 893 68...

result:

ok Accepted

Test #22:

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

input:

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

output:

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

result:

ok Accepted

Test #23:

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

input:

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

output:

0 433 433 766 766 433 433 766 766 433 433 766 766 433 433 766 766 433 433 766 766 433 433 766 766 433 433 766 766 433 433 766 766 433 433 766 766 433 433 766 766 433 433 766 766 433 433 766 766 433 433 766 766 433 433 766 766 433 433 766 766 433 433 766 766 433 433 766 766 433 433 766 766 433 433 76...

result:

ok Accepted

Test #24:

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

input:

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

output:

0 493 493 731 731 493 493 731 731 493 493 731 731 493 493 731 731 493 493 731 731 493 493 731 731 493 493 731 731 493 493 731 731 493 493 731 731 493 493 731 731 493 493 731 731 493 493 731 731 493 493 731 731 493 493 731 731 493 493 731 731 493 493 731 731 493 493 731 731 493 493 731 731 493 493 73...

result:

ok Accepted

Test #25:

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

input:

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

output:

0 393 393 561 561 393 393 561 561 393 393 561 561 393 393 561 561 393 393 561 561 393 393 561 561 393 393 561 561 393 393 561 561 393 393 561 561 393 393 561 561 393 393 561 561 393 393 561 561 393 393 561 561 393 393 561 561 393 393 561 561 393 393 561 561 393 393 561 561 393 393 561 561 393 393 56...

result:

ok Accepted

Test #26:

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

input:

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

output:

0 627 627 156 156 627 627 156 156 627 627 156 156 627 627 156 156 627 627 156 156 627 627 156 156 627 627 156 156 627 627 156 156 627 627 156 156 627 627 156 156 627 627 156 156 627 627 156 156 627 627 156 156 627 627 156 156 627 627 156 156 627 627 156 156 627 627 156 156 627 627 156 156 627 627 15...

result:

ok Accepted

Test #27:

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

input:

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

output:

0 185 185 577 577 185 185 577 577 185 185 577 577 185 185 577 577 185 185 577 577 185 185 577 577 185 185 577 577 185 185 577 577 185 185 577 577 185 185 577 577 185 185 577 577 185 185 577 577 185 185 577 577 185 185 577 577 185 185 577 577 185 185 577 577 185 185 577 577 185 185 577 577 185 185 57...

result:

ok Accepted

Test #28:

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

input:

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

output:

0 765 765 764 764 765 765 764 764 765 765 764 764 765 765 764 764 765 765 764 764 765 765 764 764 765 765 764 764 765 765 764 764 765 765 764 764 765 765 764 764 765 765 764 764 765 765 764 764 765 765 764 764 765 765 764 764 765 765 764 764 765 765 764 764 765 765 764 764 765 765 764 764 765 765 76...

result:

ok Accepted

Test #29:

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

input:

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

output:

0 570 570 814 814 570 570 814 814 570 570 814 814 570 570 814 814 570 570 814 814 570 570 814 814 570 570 814 814 570 570 814 814 570 570 814 814 570 570 814 814 570 570 814 814 570 570 814 814 570 570 814 814 570 570 814 814 570 570 814 814 570 570 814 814 570 570 814 814 570 570 814 814 570 570 81...

result:

ok Accepted

Test #30:

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

input:

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

output:

0 370 370 273 273 370 370 273 273 370 370 273 273 370 370 273 273 370 370 273 273 370 370 273 273 370 370 273 273 370 370 273 273 370 370 273 273 370 370 273 273 370 370 273 273 370 370 273 273 370 370 273 273 370 370 273 273 370 370 273 273 370 370 273 273 370 370 273 273 370 370 273 273 370 370 27...

result:

ok Accepted

Test #31:

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

input:

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

output:

0 54 54 612 612 54 54 612 612 54 54 612 612 54 54 612 612 54 54 612 612 54 54 612 612 54 54 612 612 54 54 612 612 54 54 612 612 54 54 612 612 54 54 612 612 54 54 612 612 54 54 612 612 54 54 612 612 54 54 612 612 54 54 612 612 54 54 612 612 54 54 612 612 54 54 612 612 54 54 612 612 54 54 612 612 54 5...

result:

ok Accepted

Test #32:

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

input:

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

output:

0 348 348 734 734 348 348 734 734 348 348 734 734 348 348 734 734 348 348 734 734 348 348 734 734 348 348 734 734 348 348 734 734 348 348 734 734 348 348 734 734 348 348 734 734 348 348 734 734 348 348 734 734 348 348 734 734 348 348 734 734 348 348 734 734 348 348 734 734 348 348 734 734 348 348 73...

result:

ok Accepted

Test #33:

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

input:

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

output:

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

result:

ok Accepted

Test #34:

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

input:

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

output:

0 650 650 379 379 650 650 379 379 650 650 379 379 650 650 379 379 650 650 379 379 650 650 379 379 650 650 379 379 650 650 379 379 650 650 379 379 650 650 379 379 650 650 379 379 650 650 379 379 650 650 379 379 650 650 379 379 650 650 379 379 650 650 379 379 650 650 379 379 650 650 379 379 650 650 37...

result:

ok Accepted

Test #35:

score: 0
Accepted
time: 244ms
memory: 3600kb

input:

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

output:

0 399 399 843 843 399 399 843 843 399 399 843 843 399 399 843 843 399 399 843 843 399 399 843 843 399 399 843 843 399 399 843 843 399 399 843 843 399 399 843 843 399 399 843 843 399 399 843 843 399 399 843 843 399 399 843 843 399 399 843 843 399 399 843 843 399 399 843 843 399 399 843 843 399 399 84...

result:

ok Accepted

Test #36:

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

input:

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

output:

0 399 399 763 763 399 399 763 763 399 399 763 763 399 399 763 763 399 399 763 763 399 399 763 763 399 399 763 763 399 399 763 763 399 399 763 763 399 399 763 763 399 399 763 763 399 399 763 763 399 399 763 763 399 399 763 763 399 399 763 763 399 399 763 763 399 399 763 763 399 399 763 763 399 399 76...

result:

ok Accepted

Test #37:

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

input:

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

output:

0 928 928 657 657 928 928 657 657 928 928 657 657 928 928 657 657 928 928 657 657 928 928 657 657 928 928 657 657 928 928 657 657 928 928 657 657 928 928 657 657 928 928 657 657 928 928 657 657 928 928 657 657 928 928 657 657 928 928 657 657 928 928 657 657 928 928 657 657 928 928 657 657 928 928 65...

result:

ok Accepted

Test #38:

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

input:

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

output:

0 661 661 814 814 661 661 814 814 661 661 814 814 661 661 814 814 661 661 814 814 661 661 814 814 661 661 814 814 661 661 814 814 661 661 814 814 661 661 814 814 661 661 814 814 661 661 814 814 661 661 814 814 661 661 814 814 661 661 814 814 661 661 814 814 661 661 814 814 661 661 814 814 661 661 81...

result:

ok Accepted

Test #39:

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

input:

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

output:

0 566 566 92 92 566 566 92 92 566 566 92 92 566 566 92 92 566 566 92 92 566 566 92 92 566 566 92 92 566 566 92 92 566 566 92 92 566 566 92 92 566 566 92 92 566 566 92 92 566 566 92 92 566 566 92 92 566 566 92 92 566 566 92 92 566 566 92 92 566 566 92 92 566 566 92 92 566 566 92 92 566 566 92 92 566 ...

result:

ok Accepted

Test #40:

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

input:

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

output:

0 980 980 128 128 980 980 128 128 980 980 128 128 980 980 128 128 980 980 128 128 980 980 128 128 980 980 128 128 980 980 128 128 980 980 128 128 980 980 128 128 980 980 128 128 980 980 128 128 980 980 128 128 980 980 128 128 980 980 128 128 980 980 128 128 980 980 128 128 980 980 128 128 980 980 12...

result:

ok Accepted

Test #41:

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

input:

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

output:

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

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed