QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#597731#9432. Permutationucup-team311#AC ✓296ms4084kbC++234.6kb2024-09-28 18:33:572024-09-28 18:33:57

詳細信息

Test #1:

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

input:

5
1
1
0
2
3
1
5

output:

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

result:

ok Accepted

Test #2:

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

input:

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

output:

0 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 18...

result:

ok Accepted

Test #3:

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

input:

1
1

output:

0 1
1 1

result:

ok Accepted

Test #4:

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

input:

2
0
2

output:

0 1 2
0 2 1
1 2 1

result:

ok Accepted

Test #5:

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

input:

3
0
1
3

output:

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

result:

ok Accepted

Test #6:

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

input:

4
1
1
2
2
0
4

output:

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

result:

ok Accepted

Test #7:

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

input:

6
1
2
2
2
1
2
2
0
4
6

output:

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

result:

ok Accepted

Test #8:

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

input:

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

output:

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

result:

ok Accepted

Test #9:

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

input:

8
2
1
2
1
2
1
0
0
1
0
4
2
6
8
6

output:

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

result:

ok Accepted

Test #10:

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

input:

9
1
0
1
1
1
2
0
1
0
1
0
2
1
0
5
3
7
9
7

output:

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

result:

ok Accepted

Test #11:

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

input:

10
0
1
1
1
2
2
1
0
1
1
1
2
1
0
1
1
2
4
2
6
8
6
10

output:

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

result:

ok Accepted

Test #12:

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

input:

11
1
0
1
2
2
2
1
2
0
1
1
0
1
2
1
2
5
3
7
9
7
11

output:

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

result:

ok Accepted

Test #13:

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

input:

12
1
1
1
1
2
0
1
2
0
1
1
0
1
1
1
2
2
1
0
1
1
1
1
1
2
4
2
6
8
6
10
12

output:

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

result:

ok Accepted

Test #14:

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

input:

13
1
0
1
1
1
0
2
1
0
1
0
2
0
1
0
1
0
2
1
1
0
3
5
7
9
7
11
13

output:

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

result:

ok Accepted

Test #15:

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

input:

14
1
2
1
1
2
0
2
0
1
1
1
0
1
1
2
2
2
2
1
1
2
1
0
2
0
6
8
10
8
8
12
14
12

output:

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

result:

ok Accepted

Test #16:

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

input:

15
1
0
2
1
0
0
2
2
0
2
0
2
0
1
2
2
2
0
1
0
0
1
2
7
9
11
9
9
13
15
13

output:

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

result:

ok Accepted

Test #17:

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

input:

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

output:

0 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 18...

result:

ok Accepted

Test #18:

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

input:

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

output:

0 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 18...

result:

ok Accepted

Test #19:

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

input:

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

output:

0 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 18...

result:

ok Accepted

Test #20:

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

input:

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

output:

0 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 18...

result:

ok Accepted

Test #21:

score: 0
Accepted
time: 287ms
memory: 3788kb

input:

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

output:

0 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 18...

result:

ok Accepted

Test #22:

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

input:

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

output:

0 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 18...

result:

ok Accepted

Test #23:

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

input:

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

output:

0 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 18...

result:

ok Accepted

Test #24:

score: 0
Accepted
time: 266ms
memory: 4084kb

input:

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

output:

0 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 18...

result:

ok Accepted

Test #25:

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

input:

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

output:

0 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 18...

result:

ok Accepted

Test #26:

score: 0
Accepted
time: 263ms
memory: 3760kb

input:

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

output:

0 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 18...

result:

ok Accepted

Test #27:

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

input:

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

output:

0 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 18...

result:

ok Accepted

Test #28:

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

input:

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

output:

0 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 18...

result:

ok Accepted

Test #29:

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

input:

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

output:

0 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 18...

result:

ok Accepted

Test #30:

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

input:

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

output:

0 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 18...

result:

ok Accepted

Test #31:

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

input:

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

output:

0 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 18...

result:

ok Accepted

Test #32:

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

input:

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

output:

0 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 18...

result:

ok Accepted

Test #33:

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

input:

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

output:

0 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 18...

result:

ok Accepted

Test #34:

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

input:

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

output:

0 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 18...

result:

ok Accepted

Test #35:

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

input:

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

output:

0 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 18...

result:

ok Accepted

Test #36:

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

input:

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

output:

0 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 18...

result:

ok Accepted

Test #37:

score: 0
Accepted
time: 262ms
memory: 4072kb

input:

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

output:

0 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 18...

result:

ok Accepted

Test #38:

score: 0
Accepted
time: 262ms
memory: 3792kb

input:

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

output:

0 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 18...

result:

ok Accepted

Test #39:

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

input:

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

output:

0 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 18...

result:

ok Accepted

Test #40:

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

input:

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

output:

0 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 18...

result:

ok Accepted

Test #41:

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

input:

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

output:

0 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 188 18...

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed