QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#598768#9432. Permutationucup-team3705#AC ✓277ms3924kbC++238.3kb2024-09-28 23:18:582024-09-28 23:19:07

详细

Test #1:

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

input:

5
2
2
0
2
0

output:

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

result:

ok Accepted

Test #2:

score: 0
Accepted
time: 248ms
memory: 3872kb

input:

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

output:

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

result:

ok Accepted

Test #3:

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

input:

1

output:

1 1

result:

ok Accepted

Test #4:

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

input:

2
0

output:

0 1 2
1 2 1

result:

ok Accepted

Test #5:

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

input:

3
0
0

output:

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

result:

ok Accepted

Test #6:

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

input:

4
1
0
0
2

output:

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

result:

ok Accepted

Test #7:

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

input:

6
0
1
0
0
2
0
2

output:

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

result:

ok Accepted

Test #8:

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

input:

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

output:

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

result:

ok Accepted

Test #9:

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

input:

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

output:

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

result:

ok Accepted

Test #10:

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

input:

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

output:

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

result:

ok Accepted

Test #11:

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

input:

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

output:

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

result:

ok Accepted

Test #12:

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

input:

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

output:

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

result:

ok Accepted

Test #13:

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

input:

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

output:

0 8 4 8 4 8 4 8 4 8 4 8 4
0 9 8 9 8 9 8 9 8 9 8 9 8
0 12 9 12 9 12 9 12 9 12 9 12 9
0 10 12 10 12 10 12 10 12 10 12 10 12
0 3 10 3 10 3 10 3 10 3 10 3 10
0 2 3 2 3 2 3 2 3 2 3 2 3
0 8 8 4 4 8 8 4 4 8 8 4 4
0 9 9 8 8 9 9 8 8 9 9 8 8
0 10 10 12 12 10 10 12 12 10 10 12 12
0 12 12 12 12 9 9 9 9 12 12 12...

result:

ok Accepted

Test #14:

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

input:

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

output:

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

result:

ok Accepted

Test #15:

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

input:

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

output:

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

result:

ok Accepted

Test #16:

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

input:

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

output:

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

result:

ok Accepted

Test #17:

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

input:

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

output:

0 854 886 854 886 854 886 854 886 854 886 854 886 854 886 854 886 854 886 854 886 854 886 854 886 854 886 854 886 854 886 854 886 854 886 854 886 854 886 854 886 854 886 854 886 854 886 854 886 854 886 854 886 854 886 854 886 854 886 854 886 854 886 854 886 854 886 854 886 854 886 854 886 854 886 85...

result:

ok Accepted

Test #18:

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

input:

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

output:

0 258 916 258 916 258 916 258 916 258 916 258 916 258 916 258 916 258 916 258 916 258 916 258 916 258 916 258 916 258 916 258 916 258 916 258 916 258 916 258 916 258 916 258 916 258 916 258 916 258 916 258 916 258 916 258 916 258 916 258 916 258 916 258 916 258 916 258 916 258 916 258 916 258 916 25...

result:

ok Accepted

Test #19:

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

input:

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

output:

0 279 629 279 629 279 629 279 629 279 629 279 629 279 629 279 629 279 629 279 629 279 629 279 629 279 629 279 629 279 629 279 629 279 629 279 629 279 629 279 629 279 629 279 629 279 629 279 629 279 629 279 629 279 629 279 629 279 629 279 629 279 629 279 629 279 629 279 629 279 629 279 629 279 629 27...

result:

ok Accepted

Test #20:

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

input:

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

output:

0 931 529 931 529 931 529 931 529 931 529 931 529 931 529 931 529 931 529 931 529 931 529 931 529 931 529 931 529 931 529 931 529 931 529 931 529 931 529 931 529 931 529 931 529 931 529 931 529 931 529 931 529 931 529 931 529 931 529 931 529 931 529 931 529 931 529 931 529 931 529 931 529 931 529 93...

result:

ok Accepted

Test #21:

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

input:

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

output:

0 767 572 767 572 767 572 767 572 767 572 767 572 767 572 767 572 767 572 767 572 767 572 767 572 767 572 767 572 767 572 767 572 767 572 767 572 767 572 767 572 767 572 767 572 767 572 767 572 767 572 767 572 767 572 767 572 767 572 767 572 767 572 767 572 767 572 767 572 767 572 767 572 767 572 76...

result:

ok Accepted

Test #22:

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

input:

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

output:

0 241 722 241 722 241 722 241 722 241 722 241 722 241 722 241 722 241 722 241 722 241 722 241 722 241 722 241 722 241 722 241 722 241 722 241 722 241 722 241 722 241 722 241 722 241 722 241 722 241 722 241 722 241 722 241 722 241 722 241 722 241 722 241 722 241 722 241 722 241 722 241 722 241 722 24...

result:

ok Accepted

Test #23:

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

input:

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

output:

0 416 365 416 365 416 365 416 365 416 365 416 365 416 365 416 365 416 365 416 365 416 365 416 365 416 365 416 365 416 365 416 365 416 365 416 365 416 365 416 365 416 365 416 365 416 365 416 365 416 365 416 365 416 365 416 365 416 365 416 365 416 365 416 365 416 365 416 365 416 365 416 365 416 365 41...

result:

ok Accepted

Test #24:

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

input:

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

output:

0 556 630 556 630 556 630 556 630 556 630 556 630 556 630 556 630 556 630 556 630 556 630 556 630 556 630 556 630 556 630 556 630 556 630 556 630 556 630 556 630 556 630 556 630 556 630 556 630 556 630 556 630 556 630 556 630 556 630 556 630 556 630 556 630 556 630 556 630 556 630 556 630 556 630 55...

result:

ok Accepted

Test #25:

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

input:

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

output:

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

result:

ok Accepted

Test #26:

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

input:

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

output:

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

result:

ok Accepted

Test #27:

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

input:

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

output:

0 87 127 87 127 87 127 87 127 87 127 87 127 87 127 87 127 87 127 87 127 87 127 87 127 87 127 87 127 87 127 87 127 87 127 87 127 87 127 87 127 87 127 87 127 87 127 87 127 87 127 87 127 87 127 87 127 87 127 87 127 87 127 87 127 87 127 87 127 87 127 87 127 87 127 87 127 87 127 87 127 87 127 87 127 87 1...

result:

ok Accepted

Test #28:

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

input:

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

output:

0 561 689 561 689 561 689 561 689 561 689 561 689 561 689 561 689 561 689 561 689 561 689 561 689 561 689 561 689 561 689 561 689 561 689 561 689 561 689 561 689 561 689 561 689 561 689 561 689 561 689 561 689 561 689 561 689 561 689 561 689 561 689 561 689 561 689 561 689 561 689 561 689 561 689 56...

result:

ok Accepted

Test #29:

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

input:

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

output:

0 509 767 509 767 509 767 509 767 509 767 509 767 509 767 509 767 509 767 509 767 509 767 509 767 509 767 509 767 509 767 509 767 509 767 509 767 509 767 509 767 509 767 509 767 509 767 509 767 509 767 509 767 509 767 509 767 509 767 509 767 509 767 509 767 509 767 509 767 509 767 509 767 509 767 50...

result:

ok Accepted

Test #30:

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

input:

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

output:

0 907 937 907 937 907 937 907 937 907 937 907 937 907 937 907 937 907 937 907 937 907 937 907 937 907 937 907 937 907 937 907 937 907 937 907 937 907 937 907 937 907 937 907 937 907 937 907 937 907 937 907 937 907 937 907 937 907 937 907 937 907 937 907 937 907 937 907 937 907 937 907 937 907 937 90...

result:

ok Accepted

Test #31:

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

input:

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

output:

0 415 449 415 449 415 449 415 449 415 449 415 449 415 449 415 449 415 449 415 449 415 449 415 449 415 449 415 449 415 449 415 449 415 449 415 449 415 449 415 449 415 449 415 449 415 449 415 449 415 449 415 449 415 449 415 449 415 449 415 449 415 449 415 449 415 449 415 449 415 449 415 449 415 449 41...

result:

ok Accepted

Test #32:

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

input:

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

output:

0 360 116 360 116 360 116 360 116 360 116 360 116 360 116 360 116 360 116 360 116 360 116 360 116 360 116 360 116 360 116 360 116 360 116 360 116 360 116 360 116 360 116 360 116 360 116 360 116 360 116 360 116 360 116 360 116 360 116 360 116 360 116 360 116 360 116 360 116 360 116 360 116 360 116 36...

result:

ok Accepted

Test #33:

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

input:

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

output:

0 201 255 201 255 201 255 201 255 201 255 201 255 201 255 201 255 201 255 201 255 201 255 201 255 201 255 201 255 201 255 201 255 201 255 201 255 201 255 201 255 201 255 201 255 201 255 201 255 201 255 201 255 201 255 201 255 201 255 201 255 201 255 201 255 201 255 201 255 201 255 201 255 201 255 20...

result:

ok Accepted

Test #34:

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

input:

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

output:

0 353 333 353 333 353 333 353 333 353 333 353 333 353 333 353 333 353 333 353 333 353 333 353 333 353 333 353 333 353 333 353 333 353 333 353 333 353 333 353 333 353 333 353 333 353 333 353 333 353 333 353 333 353 333 353 333 353 333 353 333 353 333 353 333 353 333 353 333 353 333 353 333 353 333 35...

result:

ok Accepted

Test #35:

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

input:

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

output:

0 919 624 919 624 919 624 919 624 919 624 919 624 919 624 919 624 919 624 919 624 919 624 919 624 919 624 919 624 919 624 919 624 919 624 919 624 919 624 919 624 919 624 919 624 919 624 919 624 919 624 919 624 919 624 919 624 919 624 919 624 919 624 919 624 919 624 919 624 919 624 919 624 919 624 91...

result:

ok Accepted

Test #36:

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

input:

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

output:

0 543 306 543 306 543 306 543 306 543 306 543 306 543 306 543 306 543 306 543 306 543 306 543 306 543 306 543 306 543 306 543 306 543 306 543 306 543 306 543 306 543 306 543 306 543 306 543 306 543 306 543 306 543 306 543 306 543 306 543 306 543 306 543 306 543 306 543 306 543 306 543 306 543 306 54...

result:

ok Accepted

Test #37:

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

input:

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

output:

0 63 622 63 622 63 622 63 622 63 622 63 622 63 622 63 622 63 622 63 622 63 622 63 622 63 622 63 622 63 622 63 622 63 622 63 622 63 622 63 622 63 622 63 622 63 622 63 622 63 622 63 622 63 622 63 622 63 622 63 622 63 622 63 622 63 622 63 622 63 622 63 622 63 622 63 622 63 622 63 622 63 622 63 622 63 6...

result:

ok Accepted

Test #38:

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

input:

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

output:

0 676 629 676 629 676 629 676 629 676 629 676 629 676 629 676 629 676 629 676 629 676 629 676 629 676 629 676 629 676 629 676 629 676 629 676 629 676 629 676 629 676 629 676 629 676 629 676 629 676 629 676 629 676 629 676 629 676 629 676 629 676 629 676 629 676 629 676 629 676 629 676 629 676 629 67...

result:

ok Accepted

Test #39:

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

input:

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

output:

0 550 430 550 430 550 430 550 430 550 430 550 430 550 430 550 430 550 430 550 430 550 430 550 430 550 430 550 430 550 430 550 430 550 430 550 430 550 430 550 430 550 430 550 430 550 430 550 430 550 430 550 430 550 430 550 430 550 430 550 430 550 430 550 430 550 430 550 430 550 430 550 430 550 430 55...

result:

ok Accepted

Test #40:

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

input:

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

output:

0 41 608 41 608 41 608 41 608 41 608 41 608 41 608 41 608 41 608 41 608 41 608 41 608 41 608 41 608 41 608 41 608 41 608 41 608 41 608 41 608 41 608 41 608 41 608 41 608 41 608 41 608 41 608 41 608 41 608 41 608 41 608 41 608 41 608 41 608 41 608 41 608 41 608 41 608 41 608 41 608 41 608 41 608 41 6...

result:

ok Accepted

Test #41:

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

input:

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

output:

0 713 144 713 144 713 144 713 144 713 144 713 144 713 144 713 144 713 144 713 144 713 144 713 144 713 144 713 144 713 144 713 144 713 144 713 144 713 144 713 144 713 144 713 144 713 144 713 144 713 144 713 144 713 144 713 144 713 144 713 144 713 144 713 144 713 144 713 144 713 144 713 144 713 144 71...

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed