QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#599181#9432. Permutationucup-team244#AC ✓307ms3968kbC++172.9kb2024-09-29 01:59:372024-09-29 01:59:39

詳細信息

Test #1:

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

input:

5
0
2
1
0
2
1
0

output:

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

result:

ok Accepted

Test #2:

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

input:

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

output:

0 939 483 939 483 939 483 939 483 939 483 939 483 939 483 939 483 939 483 939 483 939 483 939 483 939 483 939 483 939 483 939 483 939 483 939 483 939 483 939 483 939 483 939 483 939 483 939 483 939 483 939 483 939 483 939 483 939 483 939 483 939 483 939 483 939 483 939 483 939 483 939 483 939 483 93...

result:

ok Accepted

Test #3:

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

input:

1

output:

1 1

result:

ok Accepted

Test #4:

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

input:

2
2

output:

0 2 1
1 2 1

result:

ok Accepted

Test #5:

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

input:

3
0
1
0

output:

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

result:

ok Accepted

Test #6:

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

input:

4
1
2
2
0

output:

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

result:

ok Accepted

Test #7:

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

input:

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

output:

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

result:

ok Accepted

Test #8:

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

input:

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

output:

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

result:

ok Accepted

Test #9:

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

input:

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

output:

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

result:

ok Accepted

Test #10:

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

input:

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

output:

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

result:

ok Accepted

Test #11:

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

input:

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

output:

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

result:

ok Accepted

Test #12:

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

input:

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

output:

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

result:

ok Accepted

Test #13:

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

input:

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

output:

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

result:

ok Accepted

Test #14:

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

input:

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

output:

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

result:

ok Accepted

Test #15:

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

input:

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

output:

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

result:

ok Accepted

Test #16:

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

input:

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

output:

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

result:

ok Accepted

Test #17:

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

input:

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

output:

0 76 783 76 783 76 783 76 783 76 783 76 783 76 783 76 783 76 783 76 783 76 783 76 783 76 783 76 783 76 783 76 783 76 783 76 783 76 783 76 783 76 783 76 783 76 783 76 783 76 783 76 783 76 783 76 783 76 783 76 783 76 783 76 783 76 783 76 783 76 783 76 783 76 783 76 783 76 783 76 783 76 783 76 783 76 7...

result:

ok Accepted

Test #18:

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

input:

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

output:

0 49 103 49 103 49 103 49 103 49 103 49 103 49 103 49 103 49 103 49 103 49 103 49 103 49 103 49 103 49 103 49 103 49 103 49 103 49 103 49 103 49 103 49 103 49 103 49 103 49 103 49 103 49 103 49 103 49 103 49 103 49 103 49 103 49 103 49 103 49 103 49 103 49 103 49 103 49 103 49 103 49 103 49 103 49 1...

result:

ok Accepted

Test #19:

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

input:

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

output:

0 462 926 462 926 462 926 462 926 462 926 462 926 462 926 462 926 462 926 462 926 462 926 462 926 462 926 462 926 462 926 462 926 462 926 462 926 462 926 462 926 462 926 462 926 462 926 462 926 462 926 462 926 462 926 462 926 462 926 462 926 462 926 462 926 462 926 462 926 462 926 462 926 462 926 46...

result:

ok Accepted

Test #20:

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

input:

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

output:

0 596 201 596 201 596 201 596 201 596 201 596 201 596 201 596 201 596 201 596 201 596 201 596 201 596 201 596 201 596 201 596 201 596 201 596 201 596 201 596 201 596 201 596 201 596 201 596 201 596 201 596 201 596 201 596 201 596 201 596 201 596 201 596 201 596 201 596 201 596 201 596 201 596 201 59...

result:

ok Accepted

Test #21:

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

input:

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

output:

0 760 753 760 753 760 753 760 753 760 753 760 753 760 753 760 753 760 753 760 753 760 753 760 753 760 753 760 753 760 753 760 753 760 753 760 753 760 753 760 753 760 753 760 753 760 753 760 753 760 753 760 753 760 753 760 753 760 753 760 753 760 753 760 753 760 753 760 753 760 753 760 753 760 753 76...

result:

ok Accepted

Test #22:

score: 0
Accepted
time: 274ms
memory: 3964kb

input:

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

output:

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

result:

ok Accepted

Test #23:

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

input:

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

output:

0 625 167 625 167 625 167 625 167 625 167 625 167 625 167 625 167 625 167 625 167 625 167 625 167 625 167 625 167 625 167 625 167 625 167 625 167 625 167 625 167 625 167 625 167 625 167 625 167 625 167 625 167 625 167 625 167 625 167 625 167 625 167 625 167 625 167 625 167 625 167 625 167 625 167 62...

result:

ok Accepted

Test #24:

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

input:

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

output:

0 144 896 144 896 144 896 144 896 144 896 144 896 144 896 144 896 144 896 144 896 144 896 144 896 144 896 144 896 144 896 144 896 144 896 144 896 144 896 144 896 144 896 144 896 144 896 144 896 144 896 144 896 144 896 144 896 144 896 144 896 144 896 144 896 144 896 144 896 144 896 144 896 144 896 14...

result:

ok Accepted

Test #25:

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

input:

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

output:

0 358 692 358 692 358 692 358 692 358 692 358 692 358 692 358 692 358 692 358 692 358 692 358 692 358 692 358 692 358 692 358 692 358 692 358 692 358 692 358 692 358 692 358 692 358 692 358 692 358 692 358 692 358 692 358 692 358 692 358 692 358 692 358 692 358 692 358 692 358 692 358 692 358 692 35...

result:

ok Accepted

Test #26:

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

input:

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

output:

0 795 970 795 970 795 970 795 970 795 970 795 970 795 970 795 970 795 970 795 970 795 970 795 970 795 970 795 970 795 970 795 970 795 970 795 970 795 970 795 970 795 970 795 970 795 970 795 970 795 970 795 970 795 970 795 970 795 970 795 970 795 970 795 970 795 970 795 970 795 970 795 970 795 970 79...

result:

ok Accepted

Test #27:

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

input:

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

output:

0 673 538 673 538 673 538 673 538 673 538 673 538 673 538 673 538 673 538 673 538 673 538 673 538 673 538 673 538 673 538 673 538 673 538 673 538 673 538 673 538 673 538 673 538 673 538 673 538 673 538 673 538 673 538 673 538 673 538 673 538 673 538 673 538 673 538 673 538 673 538 673 538 673 538 67...

result:

ok Accepted

Test #28:

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

input:

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

output:

0 686 867 686 867 686 867 686 867 686 867 686 867 686 867 686 867 686 867 686 867 686 867 686 867 686 867 686 867 686 867 686 867 686 867 686 867 686 867 686 867 686 867 686 867 686 867 686 867 686 867 686 867 686 867 686 867 686 867 686 867 686 867 686 867 686 867 686 867 686 867 686 867 686 867 68...

result:

ok Accepted

Test #29:

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

input:

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

output:

0 190 127 190 127 190 127 190 127 190 127 190 127 190 127 190 127 190 127 190 127 190 127 190 127 190 127 190 127 190 127 190 127 190 127 190 127 190 127 190 127 190 127 190 127 190 127 190 127 190 127 190 127 190 127 190 127 190 127 190 127 190 127 190 127 190 127 190 127 190 127 190 127 190 127 19...

result:

ok Accepted

Test #30:

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

input:

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

output:

0 210 7 210 7 210 7 210 7 210 7 210 7 210 7 210 7 210 7 210 7 210 7 210 7 210 7 210 7 210 7 210 7 210 7 210 7 210 7 210 7 210 7 210 7 210 7 210 7 210 7 210 7 210 7 210 7 210 7 210 7 210 7 210 7 210 7 210 7 210 7 210 7 210 7 210 7 210 7 210 7 210 7 210 7 210 7 210 7 210 7 210 7 210 7 210 7 210 7 210 ...

result:

ok Accepted

Test #31:

score: 0
Accepted
time: 260ms
memory: 3784kb

input:

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

output:

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

result:

ok Accepted

Test #32:

score: 0
Accepted
time: 240ms
memory: 3924kb

input:

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

output:

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

result:

ok Accepted

Test #33:

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

input:

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

output:

0 485 790 485 790 485 790 485 790 485 790 485 790 485 790 485 790 485 790 485 790 485 790 485 790 485 790 485 790 485 790 485 790 485 790 485 790 485 790 485 790 485 790 485 790 485 790 485 790 485 790 485 790 485 790 485 790 485 790 485 790 485 790 485 790 485 790 485 790 485 790 485 790 485 790 48...

result:

ok Accepted

Test #34:

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

input:

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

output:

0 590 405 590 405 590 405 590 405 590 405 590 405 590 405 590 405 590 405 590 405 590 405 590 405 590 405 590 405 590 405 590 405 590 405 590 405 590 405 590 405 590 405 590 405 590 405 590 405 590 405 590 405 590 405 590 405 590 405 590 405 590 405 590 405 590 405 590 405 590 405 590 405 590 405 59...

result:

ok Accepted

Test #35:

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

input:

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

output:

0 846 120 846 120 846 120 846 120 846 120 846 120 846 120 846 120 846 120 846 120 846 120 846 120 846 120 846 120 846 120 846 120 846 120 846 120 846 120 846 120 846 120 846 120 846 120 846 120 846 120 846 120 846 120 846 120 846 120 846 120 846 120 846 120 846 120 846 120 846 120 846 120 846 120 84...

result:

ok Accepted

Test #36:

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

input:

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

output:

0 131 842 131 842 131 842 131 842 131 842 131 842 131 842 131 842 131 842 131 842 131 842 131 842 131 842 131 842 131 842 131 842 131 842 131 842 131 842 131 842 131 842 131 842 131 842 131 842 131 842 131 842 131 842 131 842 131 842 131 842 131 842 131 842 131 842 131 842 131 842 131 842 131 842 13...

result:

ok Accepted

Test #37:

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

input:

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

output:

0 279 214 279 214 279 214 279 214 279 214 279 214 279 214 279 214 279 214 279 214 279 214 279 214 279 214 279 214 279 214 279 214 279 214 279 214 279 214 279 214 279 214 279 214 279 214 279 214 279 214 279 214 279 214 279 214 279 214 279 214 279 214 279 214 279 214 279 214 279 214 279 214 279 214 27...

result:

ok Accepted

Test #38:

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

input:

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

output:

0 940 303 940 303 940 303 940 303 940 303 940 303 940 303 940 303 940 303 940 303 940 303 940 303 940 303 940 303 940 303 940 303 940 303 940 303 940 303 940 303 940 303 940 303 940 303 940 303 940 303 940 303 940 303 940 303 940 303 940 303 940 303 940 303 940 303 940 303 940 303 940 303 940 303 94...

result:

ok Accepted

Test #39:

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

input:

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

output:

0 842 565 842 565 842 565 842 565 842 565 842 565 842 565 842 565 842 565 842 565 842 565 842 565 842 565 842 565 842 565 842 565 842 565 842 565 842 565 842 565 842 565 842 565 842 565 842 565 842 565 842 565 842 565 842 565 842 565 842 565 842 565 842 565 842 565 842 565 842 565 842 565 842 565 84...

result:

ok Accepted

Test #40:

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

input:

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

output:

0 421 904 421 904 421 904 421 904 421 904 421 904 421 904 421 904 421 904 421 904 421 904 421 904 421 904 421 904 421 904 421 904 421 904 421 904 421 904 421 904 421 904 421 904 421 904 421 904 421 904 421 904 421 904 421 904 421 904 421 904 421 904 421 904 421 904 421 904 421 904 421 904 421 904 42...

result:

ok Accepted

Test #41:

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

input:

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

output:

0 701 519 701 519 701 519 701 519 701 519 701 519 701 519 701 519 701 519 701 519 701 519 701 519 701 519 701 519 701 519 701 519 701 519 701 519 701 519 701 519 701 519 701 519 701 519 701 519 701 519 701 519 701 519 701 519 701 519 701 519 701 519 701 519 701 519 701 519 701 519 701 519 701 519 70...

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed