QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#600891#9432. Permutation3un_larryfuncAC ✓317ms3936kbC++203.7kb2024-09-29 19:50:482024-09-29 19:50:49

详细

Test #1:

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

input:

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

output:

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

result:

ok Accepted

Test #2:

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

input:

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

output:

0 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 717 71...

result:

ok Accepted

Test #3:

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

input:

1
1

output:

0 1
1 1

result:

ok Accepted

Test #4:

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

input:

2
0
2

output:

0 1 2
0 2 1
1 2 1

result:

ok Accepted

Test #5:

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

input:

3
0
1
1
0
3

output:

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

result:

ok Accepted

Test #6:

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

input:

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

output:

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

result:

ok Accepted

Test #7:

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

input:

6
0
0
0
0
0
1
2
1

output:

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

result:

ok Accepted

Test #8:

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

input:

7
1
2
2
0
1
2
1
0
0
1

output:

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

result:

ok Accepted

Test #9:

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

input:

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

output:

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

result:

ok Accepted

Test #10:

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

input:

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

output:

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

result:

ok Accepted

Test #11:

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

input:

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

output:

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

result:

ok Accepted

Test #12:

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

input:

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

output:

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

result:

ok Accepted

Test #13:

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

input:

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

output:

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

result:

ok Accepted

Test #14:

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

input:

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

output:

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

result:

ok Accepted

Test #15:

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

input:

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

output:

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

result:

ok Accepted

Test #16:

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

input:

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

output:

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

result:

ok Accepted

Test #17:

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

input:

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

output:

0 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 25...

result:

ok Accepted

Test #18:

score: 0
Accepted
time: 282ms
memory: 3720kb

input:

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

output:

0 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 909 90...

result:

ok Accepted

Test #19:

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

input:

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

output:

0 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 39...

result:

ok Accepted

Test #20:

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

input:

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

output:

0 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 49...

result:

ok Accepted

Test #21:

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

input:

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

output:

0 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 678 67...

result:

ok Accepted

Test #22:

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

input:

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

output:

0 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 75...

result:

ok Accepted

Test #23:

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

input:

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

output:

0 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 86...

result:

ok Accepted

Test #24:

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

input:

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

output:

0 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 2...

result:

ok Accepted

Test #25:

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

input:

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

output:

0 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 74...

result:

ok Accepted

Test #26:

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

input:

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

output:

0 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 716 71...

result:

ok Accepted

Test #27:

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

input:

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

output:

0 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 93...

result:

ok Accepted

Test #28:

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

input:

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

output:

0 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 901 90...

result:

ok Accepted

Test #29:

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

input:

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

output:

0 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 428 42...

result:

ok Accepted

Test #30:

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

input:

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

output:

0 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 490 49...

result:

ok Accepted

Test #31:

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

input:

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

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

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

input:

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

output:

0 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 84...

result:

ok Accepted

Test #33:

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

input:

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

output:

0 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 77...

result:

ok Accepted

Test #34:

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

input:

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

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

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

input:

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

output:

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

result:

ok Accepted

Test #36:

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

input:

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

output:

0 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 947 94...

result:

ok Accepted

Test #37:

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

input:

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

output:

0 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 133 13...

result:

ok Accepted

Test #38:

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

input:

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

output:

0 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 51...

result:

ok Accepted

Test #39:

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

input:

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

output:

0 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 1...

result:

ok Accepted

Test #40:

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

input:

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

output:

0 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 938 93...

result:

ok Accepted

Test #41:

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

input:

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

output:

0 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 929 92...

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed