QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#746711#9432. PermutationHuluoboAC ✓283ms4228kbC++142.1kb2024-11-14 15:20:392024-11-14 15:20:40

详细

Test #1:

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

input:

5
2
0
1
2
1
2
2

output:

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

result:

ok Accepted

Test #2:

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

input:

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

output:

0 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 1...

result:

ok Accepted

Test #3:

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

input:

1

output:

1 1

result:

ok Accepted

Test #4:

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

input:

2
0

output:

0 1 2
1 2 1

result:

ok Accepted

Test #5:

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

input:

3
0
1
2

output:

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

result:

ok Accepted

Test #6:

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

input:

4
1
2
2
0
0

output:

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

result:

ok Accepted

Test #7:

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

input:

6
1
0
2
1
0
1
2
0
1
2

output:

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

result:

ok Accepted

Test #8:

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

input:

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

output:

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

result:

ok Accepted

Test #9:

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

input:

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

output:

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

input:

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

output:

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

result:

ok Accepted

Test #11:

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

input:

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

output:

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

result:

ok Accepted

Test #12:

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

input:

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

output:

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

result:

ok Accepted

Test #13:

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

input:

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

output:

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

result:

ok Accepted

Test #14:

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

input:

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

output:

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

result:

ok Accepted

Test #15:

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

input:

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

output:

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

result:

ok Accepted

Test #16:

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

input:

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

output:

0 1 1 1 1 1 1 1 1 7 7 7 7 7 7 7
0 1 1 1 1 1 1 1 1 5 5 5 5 5 5 5
0 14 14 14 14 14 14 14 14 6 6 6 6 6 6 6
0 14 14 14 14 14 14 14 14 15 15 15 15 15 15 15
0 10 10 10 10 10 10 10 10 11 11 11 11 11 11 11
0 10 10 10 10 10 10 10 10 9 9 9 9 9 9 9
0 10 10 10 10 10 10 10 10 2 2 2 2 2 2 2
0 13 13 13 13 13 13 13...

result:

ok Accepted

Test #17:

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

input:

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

output:

0 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 663 66...

result:

ok Accepted

Test #18:

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

input:

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

output:

0 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 801 80...

result:

ok Accepted

Test #19:

score: 0
Accepted
time: 246ms
memory: 3944kb

input:

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

output:

0 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 309 30...

result:

ok Accepted

Test #20:

score: 0
Accepted
time: 242ms
memory: 3944kb

input:

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

output:

0 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 26...

result:

ok Accepted

Test #21:

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

input:

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

output:

0 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 454 45...

result:

ok Accepted

Test #22:

score: 0
Accepted
time: 251ms
memory: 3912kb

input:

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

output:

0 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 435 43...

result:

ok Accepted

Test #23:

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

input:

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

output:

0 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 715 71...

result:

ok Accepted

Test #24:

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

input:

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

output:

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

result:

ok Accepted

Test #25:

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

input:

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

output:

0 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 838 83...

result:

ok Accepted

Test #26:

score: 0
Accepted
time: 242ms
memory: 3908kb

input:

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

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

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

input:

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

output:

0 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 41...

result:

ok Accepted

Test #28:

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

input:

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

output:

0 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 47...

result:

ok Accepted

Test #29:

score: 0
Accepted
time: 261ms
memory: 4144kb

input:

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

output:

0 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 51...

result:

ok Accepted

Test #30:

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

input:

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

output:

0 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 610 61...

result:

ok Accepted

Test #31:

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

input:

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

output:

0 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 983 98...

result:

ok Accepted

Test #32:

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

input:

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

output:

0 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 535 53...

result:

ok Accepted

Test #33:

score: 0
Accepted
time: 250ms
memory: 3844kb

input:

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

output:

0 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 11...

result:

ok Accepted

Test #34:

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

input:

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

output:

0 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 41...

result:

ok Accepted

Test #35:

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

input:

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

output:

0 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 278 27...

result:

ok Accepted

Test #36:

score: 0
Accepted
time: 255ms
memory: 3912kb

input:

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

output:

0 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 10...

result:

ok Accepted

Test #37:

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

input:

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

output:

0 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 61...

result:

ok Accepted

Test #38:

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

input:

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

output:

0 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 954 95...

result:

ok Accepted

Test #39:

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

input:

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

output:

0 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 69...

result:

ok Accepted

Test #40:

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

input:

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

output:

0 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 64...

result:

ok Accepted

Test #41:

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

input:

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

output:

0 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 51...

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed