QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#400284#7942. $K$ Subsequencesucup-team2924#AC ✓794ms11988kbC++143.1kb2024-04-27 09:30:152024-04-27 09:30:15

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3888kb

input:

5
3 2
1 -1 1
4 2
-1 1 1 -1
7 3
1 1 1 1 1 1 1
10 3
1 1 1 1 -1 -1 1 1 1 1
12 4
1 1 1 1 -1 -1 -1 -1 1 1 1 1

output:

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

result:

ok Correct (5 test cases)

Test #2:

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

input:

18434
10 1
-1 1 1 -1 -1 1 -1 -1 1 1
10 2
-1 -1 -1 1 1 -1 1 1 1 1
10 2
1 -1 -1 -1 -1 1 1 -1 1 1
10 7
1 1 -1 1 -1 1 1 -1 -1 1
9 1
-1 1 -1 1 1 -1 1 -1 1
8 1
-1 -1 -1 -1 1 1 -1 -1
10 3
-1 -1 -1 1 1 1 1 -1 -1 -1
9 1
1 -1 -1 1 -1 -1 -1 -1 -1
10 10
-1 1 1 1 1 1 1 1 1 1
10 4
-1 1 -1 1 -1 1 1 -1 1 1
9 3
1 1 ...

output:

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

result:

ok Correct (18434 test cases)

Test #3:

score: 0
Accepted
time: 340ms
memory: 4900kb

input:

1
199996 3
1 -1 1 1 1 1 -1 -1 -1 1 1 -1 1 -1 1 1 -1 -1 1 1 1 1 -1 1 -1 -1 -1 1 -1 1 1 1 1 1 1 1 -1 -1 -1 1 -1 -1 1 1 -1 -1 -1 1 -1 1 1 -1 1 -1 -1 1 1 1 1 -1 1 1 1 1 1 1 1 1 -1 -1 -1 -1 1 1 -1 1 1 -1 1 -1 -1 -1 -1 -1 1 1 -1 -1 1 1 -1 1 -1 1 1 -1 1 1 1 -1 1 -1 1 1 1 -1 -1 -1 1 1 -1 -1 1 -1 -1 -1 -1 -1...

output:

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok Correct (1 test case)

Test #4:

score: 0
Accepted
time: 467ms
memory: 4688kb

input:

1
199998 152
-1 1 -1 -1 1 -1 -1 -1 -1 -1 -1 1 -1 -1 1 -1 -1 -1 1 -1 -1 1 -1 1 1 -1 -1 1 1 1 -1 -1 -1 1 -1 1 -1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 1 1 -1 -1 1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 -1 1 -1 1 1 1 1 -1 1 1 1 -1 -1 1 -1 -1 1 1 -1 -1 -1 -1 1 -1 -1 1 -1 1 1 -1 1 1 -1 -1 1 -1 -1 1 -1 1 -1 1 1 -1...

output:

152 1 1 152 1 1 152 152 152 152 152 1 1 152 1 1 152 152 1 1 152 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 152 152 152 152 152 152 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 1 2 2 2 2 2 2 2 1 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 2 2 3 3 3 3 3 4 4 4 4 4 3 5 4 ...

result:

ok Correct (1 test case)

Test #5:

score: 0
Accepted
time: 429ms
memory: 5072kb

input:

1
199996 136
-1 1 1 1 1 1 -1 1 -1 -1 1 -1 1 1 -1 -1 1 1 1 1 1 -1 1 -1 -1 1 -1 1 1 -1 -1 1 -1 -1 1 -1 1 1 1 1 1 1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 1 -1 1 1 1 -1 1 1 1 1 1 -1 -1 1 -1 1 -1 -1 1 1 1 1 -1 1 -1 -1 -1 -1 1 1 -1 -1 -1 -1 1 -1 1 1 1 1 1 -1 -1 1 1 1 1 1 1 1 1 1 1 1 -1 -1 -1 1 1 1 1 1...

output:

136 1 1 1 2 2 1 2 2 2 3 1 3 3 3 3 4 4 4 5 5 4 5 5 5 6 4 6 6 6 6 7 7 6 7 7 7 7 7 8 8 8 8 7 8 7 9 9 8 7 5 4 3 2 1 9 9 9 9 10 10 10 10 11 11 11 12 12 11 12 12 12 12 12 11 12 12 13 13 12 13 13 13 12 10 14 14 14 9 14 13 14 14 14 14 14 15 15 14 15 15 15 16 16 16 17 17 17 18 18 18 18 17 16 19 19 19 20 20 1...

result:

ok Correct (1 test case)

Test #6:

score: 0
Accepted
time: 607ms
memory: 8016kb

input:

1
199998 86240
1 1 -1 1 1 1 1 1 1 -1 1 1 -1 1 -1 -1 -1 1 1 1 1 1 1 1 -1 1 1 1 1 1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 1 -1 -1 -1 -1 1 1 -1 -1 -1 1 1 -1 -1 1 1 -1 1 -1 1 -1 1 -1 1 1 1 1 1 -1 1 -1 1 -1 1 -1 -1 1 1 1 -1 -1 -1 -1 -1 -1 1 1 1 1 -1 -1 -1 1 1 -1 -1 1 -1 1 1 1 -1 -1 -1 1 -1 -1 -1 -1 1 1 -1...

output:

1 2 2 3 4 5 6 7 8 8 9 10 10 11 11 9 7 12 13 14 15 16 17 18 18 19 20 21 22 23 23 24 24 22 21 20 19 17 16 15 25 25 14 26 26 13 12 6 27 28 28 27 5 29 30 30 29 31 32 32 33 33 34 34 35 35 36 37 38 39 40 40 41 41 42 42 43 43 39 44 45 46 46 45 44 38 37 36 47 48 49 50 50 49 48 51 52 52 51 53 53 54 55 56 56 ...

result:

ok Correct (1 test case)

Test #7:

score: 0
Accepted
time: 794ms
memory: 11988kb

input:

1
199998 196586
1 -1 -1 -1 1 -1 1 -1 1 -1 -1 -1 1 -1 -1 -1 1 -1 -1 -1 -1 -1 1 -1 1 1 1 -1 -1 -1 1 -1 -1 -1 1 1 -1 1 -1 1 -1 1 1 1 -1 -1 -1 -1 1 -1 -1 -1 1 -1 -1 1 -1 -1 -1 1 1 1 1 1 -1 1 1 -1 1 1 1 1 -1 -1 -1 1 1 -1 -1 1 1 -1 -1 -1 1 -1 -1 -1 1 -1 -1 -1 1 -1 -1 1 -1 1 -1 -1 1 -1 1 -1 1 1 -1 -1 -1 -1...

output:

1 1 196586 196586 2 2 3 3 4 4 196586 196586 5 5 196586 196586 6 6 196586 196586 196586 196586 7 7 8 9 10 10 9 8 11 11 196586 196586 12 13 13 14 14 15 15 16 17 18 18 17 16 12 19 19 196586 196586 20 20 196586 21 21 196586 196586 22 23 24 25 26 26 27 28 28 29 30 31 32 32 31 30 33 34 34 33 35 36 36 35 2...

result:

ok Correct (1 test case)

Test #8:

score: 0
Accepted
time: 709ms
memory: 7996kb

input:

2
53064 32664
1 1 1 -1 1 1 1 -1 1 1 1 -1 -1 1 -1 -1 1 1 1 -1 -1 1 -1 1 1 1 -1 -1 -1 1 -1 -1 -1 -1 -1 1 -1 1 -1 -1 1 -1 -1 1 1 -1 -1 -1 -1 1 1 1 -1 1 -1 -1 -1 -1 1 1 1 1 -1 1 1 -1 1 -1 1 -1 -1 1 -1 1 -1 -1 1 -1 1 1 -1 1 1 -1 -1 -1 1 1 1 1 1 -1 1 1 -1 1 1 -1 -1 -1 -1 1 1 -1 -1 -1 1 -1 1 1 -1 -1 1 1 1 ...

output:

1 2 3 3 4 5 6 6 7 8 9 9 8 10 10 7 11 12 13 13 12 14 14 15 16 17 17 16 15 18 18 11 5 4 2 19 19 20 20 1 21 21 32664 22 23 23 22 32664 32664 24 25 26 26 27 27 25 24 32664 28 29 30 31 31 32 33 33 34 34 35 35 32 36 36 37 37 30 38 38 39 40 40 41 42 42 41 39 43 44 45 46 47 47 48 49 49 50 51 51 50 48 46 52 ...

result:

ok Correct (2 test cases)

Test #9:

score: 0
Accepted
time: 322ms
memory: 4532kb

input:

2
86135 2
1 1 -1 -1 -1 1 1 -1 1 -1 -1 1 -1 1 -1 -1 -1 1 -1 1 1 1 1 -1 -1 1 -1 -1 1 1 1 -1 -1 1 1 -1 -1 -1 1 1 1 1 1 1 1 1 -1 -1 1 1 1 1 1 -1 1 -1 1 1 -1 1 -1 -1 1 -1 -1 -1 -1 1 -1 -1 1 1 1 -1 1 -1 1 1 -1 1 1 1 -1 1 -1 1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 -1 1 -1 1 1 1 1 1 1 1 -1 1 -1 1 -1 1 -1 1...

output:

1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok Correct (2 test cases)

Test #10:

score: 0
Accepted
time: 492ms
memory: 5648kb

input:

2
114819 248
-1 -1 -1 -1 -1 1 -1 1 -1 -1 1 -1 1 1 -1 1 -1 -1 1 -1 -1 1 -1 1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 1 -1 -1 1 -1 1 1 1 1 -1 -1 -1 -1 1 1 1 1 1 -1 -1 1 -1 -1 -1 1 -1 -1 -1 1 -1 -1 1 1 -1 -1 -1 1 1 -1 -1 -1 1 -1 1 -1 -1 -1 1 1 -1 -1 -1 -1 1 1 1 -1 -1 -1 -1 1 -1 -1 -1 1 1 1 -1 -1 -1 -1 -1 1 -...

output:

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

result:

ok Correct (2 test cases)

Test #11:

score: 0
Accepted
time: 475ms
memory: 6008kb

input:

2
51745 1
-1 1 1 -1 1 -1 -1 1 -1 1 -1 1 1 1 -1 -1 1 -1 1 1 1 1 1 -1 1 -1 -1 1 -1 -1 1 -1 1 1 -1 1 -1 1 1 -1 1 1 -1 1 1 1 -1 -1 1 -1 1 -1 -1 -1 1 -1 -1 1 1 -1 -1 1 1 -1 -1 -1 1 1 -1 1 -1 -1 1 1 1 -1 -1 1 -1 -1 1 -1 -1 -1 1 -1 -1 -1 1 -1 -1 1 -1 1 -1 -1 -1 -1 1 1 1 1 1 1 -1 -1 -1 -1 1 1 -1 1 1 -1 1 1 ...

output:

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok Correct (2 test cases)

Test #12:

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

input:

2
190655 1
1 -1 -1 -1 1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 1 1 1 -1 -1 1 1 -1 -1 -1 1 -1 -1 -1 1 1 -1 -1 1 -1 -1 1 1 1 1 1 -1 -1 1 -1 1 1 -1 1 1 -1 -1 -1 1 -1 -1 1 1 -1 -1 -1 1 1 1 -1 1 -1 -1 -1 1 1 1 -1 -1 -1 -1 -1 1 1 -1 1 -1 1 -1 1 -1 -1 -1 -1 1 1 -1 -1 -1 1 -1 -1 1 1 1 1 1 1 -1 -1 ...

output:

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok Correct (2 test cases)

Test #13:

score: 0
Accepted
time: 348ms
memory: 4528kb

input:

3
509 3
-1 -1 1 1 -1 -1 1 1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 1 1 -1 -1 1 1 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 5 6 6 6 7 6 5 6 5 7 7 3 2 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 8 9 9 9 9 8 10 10 10 10 10 10 10 11 9 11 11 11 11 8 12 12 11 12 12 10 12 12 12 12 12...

result:

ok Correct (4 test cases)

Test #15:

score: 0
Accepted
time: 487ms
memory: 5336kb

input:

5
7824 2
-1 -1 -1 -1 1 1 1 1 -1 1 1 1 -1 1 -1 -1 1 1 -1 -1 -1 1 -1 1 -1 1 -1 1 1 -1 1 1 1 1 -1 1 1 -1 1 1 1 -1 1 -1 -1 -1 1 -1 -1 -1 1 -1 -1 1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 1 1 -1 -1 1 1 1 1 -1 1 -1 -1 1 -1 1 -1 1 -1 1 -1 -1 1 1 -1 1 -1 1 -1 1 1 1 1 -1 1 -1 -1 -1 -1 -1 1 1 -1 1 -1 1 -1 1 1 1 -1 -1...

output:

2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok Correct (5 test cases)

Test #16:

score: 0
Accepted
time: 359ms
memory: 4568kb

input:

6
7149 4795
-1 -1 1 -1 -1 1 1 -1 1 1 1 1 -1 1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 1 -1 -1 1 -1 -1 -1 -1 1 1 1 1 -1 1 -1 1 1 1 -1 -1 1 -1 1 1 1 -1 1 1 1 1 -1 1 -1 1 -1 1 -1 1 1 1 1 1 1 1 1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 -1 1 1 -1 -1 -1 -1 1 1 1 -1 1 1 -1 1 -1 1 -1 1 1 -1 1 -1 -1 -1 1 1 1 1 1 1 -1 -1 -1...

output:

4795 4795 1 1 4795 2 3 3 4 5 6 7 7 8 8 6 5 4 2 4795 4795 9 9 4795 10 10 4795 11 11 4795 4795 4795 12 13 14 15 15 16 16 17 18 19 19 18 20 20 21 22 23 23 24 25 26 27 27 28 28 29 29 30 30 31 32 33 34 35 36 37 38 38 39 39 37 36 35 34 33 32 31 26 40 41 41 42 43 43 42 40 25 44 45 46 46 47 48 48 49 49 50 5...

result:

ok Correct (6 test cases)

Test #17:

score: 0
Accepted
time: 299ms
memory: 4244kb

input:

7
16819 1
1 1 1 1 1 1 -1 -1 -1 1 1 1 -1 1 1 1 -1 1 1 -1 -1 -1 1 1 1 1 -1 1 1 -1 1 -1 1 1 -1 -1 1 1 -1 1 -1 1 -1 1 1 -1 -1 1 -1 -1 -1 1 -1 1 -1 -1 -1 -1 -1 -1 -1 1 -1 1 1 -1 -1 1 -1 1 -1 1 1 -1 -1 -1 1 -1 -1 -1 -1 1 -1 1 -1 1 -1 -1 -1 1 1 1 1 1 1 -1 1 -1 1 -1 1 1 1 1 -1 -1 1 1 1 -1 1 -1 -1 1 -1 -1 1 ...

output:

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok Correct (7 test cases)

Test #18:

score: 0
Accepted
time: 461ms
memory: 4808kb

input:

8
29021 106
-1 -1 -1 -1 1 -1 1 -1 1 -1 1 1 1 -1 -1 1 1 1 1 1 -1 -1 1 1 -1 -1 -1 1 1 -1 -1 -1 -1 -1 -1 1 1 -1 1 1 1 -1 -1 -1 1 1 1 1 1 1 1 1 -1 1 -1 1 -1 -1 1 -1 1 -1 1 -1 1 1 -1 1 1 -1 1 -1 -1 -1 1 1 1 1 -1 -1 -1 -1 1 -1 1 -1 -1 1 1 -1 -1 -1 1 -1 1 1 -1 1 1 1 -1 1 -1 1 1 -1 -1 -1 1 -1 -1 -1 1 -1 -1 ...

output:

106 106 106 106 1 1 1 1 1 1 1 1 2 1 2 2 2 3 3 4 3 2 4 5 4 5 4 5 5 5 5 3 2 1 106 6 6 6 7 7 8 7 8 7 8 8 9 9 10 10 11 11 11 12 10 12 12 9 13 8 13 13 14 14 14 14 14 15 15 15 16 16 15 14 16 16 17 17 17 16 17 16 18 18 18 18 13 18 18 18 18 12 19 19 19 19 19 20 20 21 20 21 21 22 22 22 22 21 23 23 20 19 23 2...

result:

ok Correct (8 test cases)

Test #19:

score: 0
Accepted
time: 316ms
memory: 4240kb

input:

9
37136 1
-1 1 -1 -1 -1 -1 1 -1 1 -1 -1 1 1 1 1 1 1 1 -1 1 1 -1 1 1 1 -1 -1 1 1 1 1 -1 1 -1 1 -1 -1 1 -1 1 -1 -1 -1 -1 -1 1 -1 1 -1 1 1 -1 -1 1 -1 -1 1 1 1 1 1 -1 -1 -1 -1 -1 -1 -1 1 1 1 -1 -1 1 1 -1 1 1 1 1 1 1 -1 -1 -1 -1 -1 1 1 1 -1 1 -1 -1 -1 1 -1 -1 1 -1 1 1 1 1 1 -1 -1 1 -1 -1 1 1 1 1 -1 1 -1 ...

output:

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok Correct (9 test cases)

Test #20:

score: 0
Accepted
time: 488ms
memory: 5316kb

input:

10
5543 1596
1 1 1 -1 1 1 1 -1 -1 -1 1 1 -1 -1 -1 1 -1 1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 1 1 -1 1 -1 -1 -1 1 1 -1 1 -1 -1 -1 1 -1 1 1 -1 -1 1 1 1 1 1 -1 -1 1 1 -1 1 1 -1 1 -1 1 1 -1 -1 -1 1 -1 1 -1 -1 1 -1 -1 -1 1 -1 -1 1 -1 -1 1 -1 1 -1 -1 1 -1 -1 -1 -1 -1 -1 1 1 1 1 -1 -1 -1 -1 1 1 1 1 -1 -1 -1 -1 1 ...

output:

1 2 3 3 4 5 6 6 5 4 7 8 8 7 2 9 9 10 10 1 11 11 1596 1596 1596 1596 1596 1596 12 13 13 14 14 12 1596 15 16 16 17 17 15 1596 18 18 19 20 20 19 21 22 23 24 25 25 24 26 27 27 28 29 29 30 30 31 32 32 31 28 33 33 34 34 26 35 35 23 22 36 36 21 37 37 1596 38 38 39 39 1596 40 40 1596 1596 1596 1596 1596 41 ...

result:

ok Correct (10 test cases)

Test #21:

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

input:

100
2336 29
-1 -1 -1 1 -1 1 1 -1 -1 -1 1 -1 -1 1 1 1 1 1 1 -1 -1 1 1 -1 1 -1 -1 -1 1 -1 -1 1 1 1 1 -1 1 1 -1 1 -1 1 1 1 -1 -1 -1 -1 -1 1 1 -1 1 1 -1 -1 1 1 -1 -1 1 1 -1 -1 1 -1 -1 -1 1 -1 -1 -1 1 1 1 1 1 -1 -1 1 -1 -1 -1 -1 -1 -1 1 -1 1 1 1 1 1 -1 1 1 1 -1 1 1 1 -1 1 -1 1 -1 1 1 1 1 1 -1 1 -1 -1 -1 ...

output:

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

result:

ok Correct (100 test cases)

Test #22:

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

input:

101
92 1
1 1 -1 1 1 -1 -1 -1 -1 -1 1 -1 -1 1 -1 1 1 -1 1 -1 1 1 1 1 -1 -1 -1 1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 1 1 -1 1 -1 -1 1 -1 -1 1 -1 -1 -1 -1 -1 1 -1 1 -1 -1 -1 -1 1 1 -1 1 1 -1 1 1 1 1 -1 -1 1 1 1 1 1 1 1 1 1 1 -1 -1
2647 2314
-1 1 -1 -1 1 1 1 -1 1 1 1 1 -1 1 -1 -1 1 -1 -1...

output:

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

result:

ok Correct (101 test cases)

Test #23:

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

input:

102
8381 7064
-1 -1 1 1 -1 -1 1 -1 1 1 1 1 1 -1 -1 1 -1 1 -1 1 1 1 -1 -1 -1 1 -1 1 1 1 1 -1 -1 -1 -1 1 1 1 -1 -1 1 1 -1 1 -1 1 -1 -1 1 -1 -1 1 -1 1 1 -1 -1 1 1 1 -1 -1 -1 1 1 1 1 1 1 -1 -1 1 -1 1 -1 -1 -1 -1 1 1 -1 1 1 -1 -1 1 -1 -1 1 -1 -1 -1 1 -1 -1 1 -1 1 1 -1 -1 1 1 1 1 -1 -1 1 1 1 -1 1 -1 -1 -1...

output:

7064 7064 1 2 2 1 3 3 4 5 6 7 8 8 7 9 9 10 10 11 12 13 13 12 11 14 14 15 16 17 18 18 17 16 15 19 20 21 21 20 22 23 23 24 24 25 25 22 26 26 19 27 27 28 29 29 28 30 31 32 32 31 30 33 34 35 36 37 38 38 37 39 39 40 40 36 35 34 41 42 42 43 44 44 43 45 45 41 46 46 33 6 47 47 5 48 48 49 50 50 49 51 52 53 5...

result:

ok Correct (102 test cases)

Test #24:

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

input:

103
1976 404
1 -1 -1 1 -1 -1 -1 -1 1 1 1 -1 1 1 -1 -1 1 -1 1 -1 1 -1 -1 1 1 1 1 -1 -1 1 1 1 -1 1 -1 -1 1 -1 1 -1 1 -1 1 1 1 1 1 1 -1 -1 1 -1 -1 1 1 1 1 1 1 -1 -1 1 1 1 1 -1 -1 -1 1 -1 1 -1 1 1 1 1 -1 1 -1 -1 -1 -1 1 -1 -1 1 -1 -1 -1 1 -1 -1 -1 1 -1 1 1 -1 1 1 -1 1 -1 1 -1 -1 -1 -1 -1 -1 1 1 1 1 -1 -...

output:

1 1 404 2 2 404 404 404 3 4 5 5 6 7 7 6 8 8 9 9 10 10 4 11 12 13 14 14 13 15 16 17 17 18 18 16 19 19 20 20 21 21 22 23 24 25 26 27 27 26 28 28 25 29 30 31 32 33 34 34 33 35 36 37 38 38 37 36 39 39 40 40 41 42 43 44 44 45 45 43 42 41 46 46 35 47 47 32 31 48 48 30 29 49 49 50 51 51 52 53 53 54 54 55 5...

result:

ok Correct (103 test cases)

Test #25:

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

input:

104
3135 3
1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 -1 -1 1 1 1 -1 -1 -1 -1 1 1 -1 1 -1 -1 -1 -1 -1 -1 1 1 -1 -1 -1 1 1 -1 -1 1 1 -1 -1 -1 1 -1 1 1 -1 -1 -1 -1 1 -1 -1 -1 1 -1 1 -1 1 -1 1 -1 -1 1 1 -1 -1 1 -1 -1 -1 -1 1 -1 1 1 1 1 1 1 -1 1 -1 -1 1 1 1 1 1 1 1 1 -1 -1 1 1 1 1 1 1 -1 1 1 1 1 -1 1 -1 1 1 -1...

output:

1 1 3 3 3 3 3 3 3 3 3 1 1 1 1 1 1 1 1 1 1 3 1 1 1 1 1 1 3 3 3 3 1 1 1 1 3 1 1 1 1 1 1 1 1 3 1 1 1 1 1 1 3 3 1 1 3 3 1 1 1 1 1 1 1 1 3 1 1 1 1 1 1 3 3 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 ...

result:

ok Correct (104 test cases)

Test #26:

score: 0
Accepted
time: 299ms
memory: 5980kb

input:

105
1344 10
1 1 1 -1 1 -1 1 -1 -1 -1 -1 -1 1 1 1 1 1 -1 1 1 1 -1 1 -1 1 1 1 1 1 -1 -1 -1 1 1 -1 -1 -1 1 -1 -1 1 -1 -1 -1 1 -1 1 1 -1 1 -1 1 1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 1 -1 -1 -1 1 -1 -1 1 -1 1 1 1 -1 1 -1 1 1 1 1 -1 1 1 1 -1 1 -1 -1 -1 1 -1 1 1 -1 1 -1 1 1 1 -1 1 -1 1 -1 -1 1 1 -1 -1 1 1 -1...

output:

1 1 1 1 1 1 1 1 1 1 10 10 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 1 1 1 2 2 1 1 2 2 2 1 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 1 10 2 2 2 2 10 10 2 2 10 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 2 3 2 2 3 3 2 3 3 3 3 3 3 3 2 3 3 3 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 3 4 4 4 4 ...

result:

ok Correct (105 test cases)

Test #27:

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

input:

1000
1284 8
1 1 1 1 -1 1 -1 -1 -1 -1 1 1 -1 -1 1 1 1 1 -1 1 -1 1 1 -1 1 1 1 1 -1 -1 1 -1 1 -1 1 1 1 -1 1 -1 -1 1 -1 -1 -1 1 1 1 -1 -1 1 1 -1 -1 -1 -1 1 1 1 -1 1 1 -1 -1 1 -1 -1 1 1 1 1 -1 1 -1 1 1 1 -1 1 1 1 -1 1 1 -1 1 -1 1 -1 -1 -1 1 1 -1 1 1 1 1 1 -1 -1 -1 1 -1 -1 -1 1 -1 1 -1 -1 -1 -1 1 1 1 1 -1...

output:

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

result:

ok Correct (1000 test cases)

Test #28:

score: 0
Accepted
time: 180ms
memory: 5856kb

input:

1001
151 3
1 1 -1 1 -1 1 -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 5 1 1 1 1 4 2 2 2 2 3 2 2 2 2 2 3 3 3 4 3 3 2 4 3 4 4 4 4 4 4 4 4 4 4 4 5 4 5 5 5 5 4 5 6 6 6 1 1 2 2 6 3 2 1 6 3 3 2 1 6 3 3 3 3 4 3 4 4 4 4 4 5 4 5 5 6 5 6 6 5 4 6 6 6 5 4 6 6 2 6 6 1 6 6 6 6 6 6 6 6 6 2 6 6 ...

result:

ok Correct (1002 test cases)

Test #30:

score: 0
Accepted
time: 185ms
memory: 5884kb

input:

1003
95 16
1 -1 -1 1 1 1 -1 -1 -1 -1 -1 1 1 1 -1 -1 -1 -1 1 1 1 -1 1 -1 1 1 -1 -1 -1 -1 1 -1 1 -1 -1 -1 1 -1 -1 1 -1 1 -1 -1 1 -1 -1 1 -1 -1 -1 1 1 1 -1 1 1 1 -1 -1 -1 -1 1 1 -1 1 1 1 1 1 -1 -1 1 1 -1 -1 -1 1 -1 -1 -1 -1 -1 1 -1 -1 -1 1 1 1 1 -1 -1 1 1
526 3
1 -1 -1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1...

output:

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

result:

ok Correct (1003 test cases)

Test #31:

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

input:

1004
322 257
-1 1 1 1 1 1 1 -1 -1 1 1 -1 -1 -1 1 -1 -1 1 -1 1 -1 -1 -1 1 1 1 1 1 1 -1 1 1 -1 1 -1 1 -1 1 1 -1 1 -1 1 1 1 -1 1 1 -1 -1 1 -1 1 1 -1 -1 -1 1 -1 1 -1 1 -1 1 1 1 -1 1 1 1 -1 -1 1 1 -1 -1 -1 1 1 1 1 1 1 1 -1 -1 1 1 1 1 1 1 1 1 -1 -1 -1 1 -1 1 -1 1 1 -1 -1 -1 1 -1 1 1 1 1 -1 -1 1 -1 -1 1 -1...

output:

257 1 2 3 4 5 6 6 5 7 8 8 7 4 9 9 3 10 10 11 11 2 1 12 13 14 15 16 17 17 18 19 19 20 20 21 21 22 23 23 24 24 25 26 27 27 28 29 29 28 30 30 31 32 32 31 26 33 33 34 34 35 35 36 37 38 38 39 40 41 41 40 42 43 43 42 39 44 45 46 47 48 49 50 50 49 51 52 53 54 55 56 57 58 58 57 56 59 59 60 60 61 62 62 61 55...

result:

ok Correct (1004 test cases)

Test #32:

score: 0
Accepted
time: 182ms
memory: 5920kb

input:

1005
508 4
1 -1 -1 -1 1 1 1 1 1 1 1 -1 1 1 1 -1 1 -1 1 -1 1 1 -1 1 -1 -1 1 -1 -1 1 -1 -1 1 1 -1 1 1 -1 1 -1 -1 -1 -1 1 -1 -1 1 1 1 1 -1 1 -1 1 -1 1 1 1 -1 -1 -1 -1 1 1 -1 1 -1 1 -1 1 -1 1 -1 1 1 1 -1 -1 1 -1 -1 -1 -1 1 1 -1 -1 -1 -1 1 -1 1 -1 1 1 -1 -1 1 -1 -1 1 1 -1 -1 1 -1 -1 -1 1 1 1 -1 -1 1 1 1 ...

output:

1 1 4 4 1 1 1 1 1 1 2 1 2 2 2 1 2 2 2 2 2 2 2 3 2 2 3 1 2 3 3 1 3 3 3 3 3 3 3 3 3 3 3 3 3 2 3 3 3 3 3 3 3 3 3 3 3 4 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 3 4 4 4 4 1 4 4 4 4 4 4 4 4 4 4 4 3 4 4 4 4 4 4 2 1 4 4 4 4 4 4 4 4 4 4 4 1 1 1 1 1 4 1 2 2 1 1 2 4 1 4 2 2 2 2 2 3 3 2 2 2 3 3 2 1 4 3 ...

result:

ok Correct (1005 test cases)

Test #33:

score: 0
Accepted
time: 95ms
memory: 3812kb

input:

9995
9 7
-1 1 -1 -1 -1 1 -1 -1 1
1 1
-1
7 1
-1 -1 -1 -1 1 -1 -1
25 1
1 1 1 1 1 1 1 -1 -1 -1 -1 1 -1 -1 1 1 1 -1 1 -1 1 1 -1 -1 -1
24 22
1 -1 1 -1 1 -1 1 1 1 -1 1 1 1 1 -1 1 1 -1 1 -1 -1 1 -1 -1
6 3
1 -1 1 1 -1 -1
6 4
-1 1 -1 -1 -1 1
14 9
-1 -1 1 -1 1 -1 1 1 1 1 1 1 1 -1
24 3
1 -1 -1 -1 1 1 -1 1 1 1 ...

output:

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

result:

ok Correct (9995 test cases)

Test #34:

score: 0
Accepted
time: 94ms
memory: 3892kb

input:

9996
27 1
1 1 -1 -1 -1 -1 -1 -1 -1 1 1 1 -1 -1 -1 -1 1 -1 1 -1 -1 -1 1 1 -1 1 1
7 2
1 1 1 1 -1 -1 1
22 3
-1 -1 1 1 -1 -1 -1 1 1 1 -1 -1 -1 -1 -1 1 -1 1 1 -1 -1 1
37 4
-1 -1 -1 1 -1 1 -1 -1 -1 1 1 -1 1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 1 1 1 1 1 -1 1 1 1
7 1
-1 1 -1 -1 1 1 1
29 1
-1 -1 1 -1 1 -1 1...

output:

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

result:

ok Correct (9996 test cases)

Test #35:

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

input:

9997
15 9
-1 1 1 -1 1 1 -1 1 -1 1 1 1 1 1 1
1 1
1
37 20
-1 1 -1 -1 1 -1 -1 1 -1 -1 -1 1 -1 1 1 -1 1 1 -1 -1 -1 -1 1 1 -1 1 -1 -1 -1 1 -1 1 1 1 1 1 -1
64 2
-1 -1 -1 -1 -1 1 1 1 1 1 1 1 1 -1 -1 -1 -1 -1 -1 1 1 -1 -1 -1 -1 -1 1 -1 1 -1 1 1 1 1 -1 1 -1 -1 -1 1 1 -1 -1 1 1 -1 -1 1 -1 -1 -1 -1 1 1 -1 -1 -...

output:

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

result:

ok Correct (9997 test cases)

Test #36:

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

input:

9998
28 3
-1 1 1 -1 -1 -1 -1 -1 1 1 1 -1 -1 1 -1 1 -1 -1 -1 -1 -1 -1 -1 1 1 1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 1 3 3 3 3 
1 1 1 1 2 2 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 2 1 1 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 2 2 1 1 1 1 1 1 2 2 2 2 2 1 2 ...

result:

ok Correct (9999 test cases)

Test #38:

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

input:

10000
15 3
-1 1 -1 1 -1 -1 1 -1 1 -1 1 -1 -1 -1 1
3 3
-1 1 1
34 2
-1 -1 -1 -1 1 -1 1 -1 -1 -1 -1 1 -1 -1 -1 1 -1 -1 1 -1 1 -1 -1 1 -1 1 1 -1 -1 -1 1 -1 1 1
3 2
1 1 -1
25 2
-1 -1 1 1 1 -1 1 -1 1 -1 -1 -1 1 1 1 -1 1 1 1 1 -1 1 -1 1 -1
11 1
1 -1 -1 -1 -1 -1 1 -1 -1 -1 1
29 2
-1 -1 -1 1 -1 1 -1 -1 -1 -1...

output:

3 1 1 2 2 3 3 3 1 1 2 2 3 3 3 
3 1 2 
2 2 2 2 1 1 2 2 2 2 2 1 1 2 2 2 2 2 1 1 2 2 2 1 1 2 1 2 1 2 2 2 1 2 
1 2 2 
2 2 1 1 1 1 2 1 2 2 2 1 2 2 2 2 1 1 1 2 2 2 2 2 2 
1 1 1 1 1 1 1 1 1 1 1 
2 2 2 1 1 1 1 2 2 2 2 2 1 1 2 2 2 1 2 2 2 2 2 1 2 2 2 1 1 
1 1 4 2 
1 1 1 
1 1 1 
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok Correct (10000 test cases)

Extra Test:

score: 0
Extra Test Passed