QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#284560#7942. $K$ Subsequencesucup-team1126#AC ✓25ms7852kbC++201.9kb2023-12-16 13:51:412023-12-16 13:51:41

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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 1 
1 1 2 1 
1 2 3 1 2 3 1 
1 2 3 1 1 2 1 2 2 3 
1 2 3 4 1 2 3 4 1 2 3 4 

result:

ok Correct (5 test cases)

Test #2:

score: 0
Accepted
time: 18ms
memory: 3584kb

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 
1 1 1 1 2 1 1 1 2 1 
1 1 1 1 1 1 2 1 1 1 
1 2 1 1 2 2 3 1 2 1 
1 1 1 1 1 1 1 1 1 
1 1 1 1 1 1 1 1 
1 1 1 1 2 3 1 1 2 3 
1 1 1 1 1 1 1 1 1 
1 1 2 3 4 5 6 7 8 9 
1 1 1 1 1 1 2 1 1 3 
1 2 1 2 1 1 2 2 1 
1 2 1 1 3 4 2 2 
1 1 2 3 4 5 6 7 1 1 
1 1 1 1 1 1 1 2 1 
1 1 1 1 1 1 1 1 1 
1 2...

result:

ok Correct (18434 test cases)

Test #3:

score: 0
Accepted
time: 17ms
memory: 5084kb

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

result:

ok Correct (1 test case)

Test #4:

score: 0
Accepted
time: 14ms
memory: 5200kb

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:

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

result:

ok Correct (1 test case)

Test #5:

score: 0
Accepted
time: 19ms
memory: 5136kb

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:

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

result:

ok Correct (1 test case)

Test #6:

score: 0
Accepted
time: 15ms
memory: 6280kb

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 1 1 3 4 5 6 7 2 2 8 1 1 3 4 5 3 4 5 9 10 11 12 6 6 13 14 15 16 7 7 2 8 1 3 4 5 9 10 2 11 12 8 6 13 14 15 1 3 16 7 2 4 5 8 1 9 10 3 11 4 12 5 6 9 13 14 15 16 7 10 2 11 8 12 1 6 13 3 4 5 14 15 16 7 2 8 9 10 11 12 1 3 4 6 13 5 9 14 10 15 16 7 11 12 6 2 13 14 15 16 8 1 7 2 3 8 4 1 3 5 4 5 1 1 1 1 9 ...

result:

ok Correct (1 test case)

Test #7:

score: 0
Accepted
time: 10ms
memory: 7852kb

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 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 3 1 2 3 1 1 1 1 2 3 2 1 3 2 1 3 1 4 2 3 1 4 2 2 1 1 3 3 1 1 1 1 1 4 2 3 1 5 4 4 6 2 2 7 8 9 3 1 5 3 1 4 6 5 4 2 7 8 6 9 3 1 2 5 4 6 7 2 7 8 8 9 9 1 3 3 1 1 5 4 5 4 1 1 6 6 1 2 2 1 1 1 1 1 1 7 7 1 1 1 1 1 1 8 8 1 1 1 1 9 3 9 1 5 4 3 6 2 1 7 5 4 8 6 ...

result:

ok Correct (1 test case)

Test #8:

score: 0
Accepted
time: 21ms
memory: 6284kb

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 1 1 4 5 2 2 6 7 3 1 3 4 5 1 4 5 2 6 2 7 6 7 8 3 1 4 3 5 2 6 7 8 1 3 4 1 4 5 5 1 2 6 2 6 1 1 7 8 3 7 1 8 3 1 1 4 5 2 6 4 7 8 5 3 2 1 6 7 4 8 5 3 1 2 4 6 7 5 8 3 2 6 7 1 4 5 2 6 8 7 8 3 3 9 1 4 5 2 1 4 6 7 8 5 3 2 6 9 1 7 8 3 4 5 2 9 6 7 8 1 3 9 4 1 5 2 6 4 5 7 8 3 2 9 1 6 7 4 5 8 2 6 7 3 9 8 3 ...

result:

ok Correct (2 test cases)

Test #9:

score: 0
Accepted
time: 16ms
memory: 4428kb

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 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 2 3 ...

result:

ok Correct (2 test cases)

Test #11:

score: 0
Accepted
time: 18ms
memory: 5104kb

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: 17ms
memory: 5084kb

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: 17ms
memory: 4868kb

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

result:

ok Correct (3 test cases)

Test #14:

score: 0
Accepted
time: 17ms
memory: 4496kb

input:

4
25729 81
-1 -1 -1 -1 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1 2 1 1 2 1 2 2 1 2 1 1 1 1 1 2 1 2 1 2 1 2 1 1 2 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 1 2 1 2 2 1 2 1 2 1 1 2 2 1 1 2 2 1 2 1 1 2 1 2 2 1 1 2 2 1 1 2 1 1 1 1 2 1 2 2 1 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 ...

result:

ok Correct (5 test cases)

Test #16:

score: 0
Accepted
time: 13ms
memory: 4408kb

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:

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

result:

ok Correct (6 test cases)

Test #17:

score: 0
Accepted
time: 12ms
memory: 4388kb

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

result:

ok Correct (8 test cases)

Test #19:

score: 0
Accepted
time: 13ms
memory: 4208kb

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: 13ms
memory: 4572kb

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

result:

ok Correct (10 test cases)

Test #21:

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

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:

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

result:

ok Correct (100 test cases)

Test #22:

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

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

result:

ok Correct (101 test cases)

Test #23:

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

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:

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

result:

ok Correct (102 test cases)

Test #24:

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

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 1 1 1 1 1 1 1 2 3 1 1 4 2 3 2 1 3 4 1 2 3 4 2 3 5 1 4 1 4 6 2 2 3 5 3 1 5 4 1 6 4 6 7 8 9 10 2 3 2 5 1 3 5 1 11 12 13 4 6 4 6 14 15 7 8 9 7 10 8 2 9 10 2 16 3 3 5 1 11 12 5 13 4 1 6 14 15 11 7 8 9 12 10 13 4 2 6 14 16 15 3 7 5 1 11 12 13 4 8 9 10 2 6 14 15 16 3 7 5 1 8 11 12 9 13 10 4 6 14 15 2 ...

result:

ok Correct (103 test cases)

Test #25:

score: 0
Accepted
time: 25ms
memory: 3856kb

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

result:

ok Correct (105 test cases)

Test #27:

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

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

result:

ok Correct (1000 test cases)

Test #28:

score: 0
Accepted
time: 19ms
memory: 3628kb

input:

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

result:

ok Correct (1002 test cases)

Test #30:

score: 0
Accepted
time: 19ms
memory: 3608kb

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

result:

ok Correct (1003 test cases)

Test #31:

score: 0
Accepted
time: 19ms
memory: 3608kb

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:

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

result:

ok Correct (1004 test cases)

Test #32:

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

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

result:

ok Correct (1005 test cases)

Test #33:

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

input:

9995
9 7
-1 1 -1 -1 -1 1 -1 -1 1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1 2 3 2 3 1 
1 1 1 1 1 1 1 1 1 1 2 1 1 3 2 2 1 1 3 3 2 2 1 1 3 3 2 2 4 1 2 3 4 1 1 1 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 2 3 4 5 6 7 1 2 3 4 5 1 
1 2 1 1...

result:

ok Correct (9996 test cases)

Test #35:

score: 0
Accepted
time: 20ms
memory: 3536kb

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:

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

result:

ok Correct (9997 test cases)

Test #36:

score: 0
Accepted
time: 15ms
memory: 3536kb

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 1 1
12 2
-1 -1 -1 1 -1 -1 1 -1 1 1 -1 1
8 6
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2 1 1 1 2 2 2 1 1 2 1 2 2 1 2 1 2 1 1 2 2 1 1 2 2 1 1 2 2 1 2 1 2 1 2 1 1 1 1 2 2 1 1 1 2 1 2 1 2 1 2 1 2 1 1 2 ...

result:

ok Correct (9999 test cases)

Test #38:

score: 0
Accepted
time: 20ms
memory: 3592kb

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:

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
1 1 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 2 1 2 1 1 1 2 1 
1 2 1 
1 1 1 2 1 1 1 2 2 1 2 1 1 2 1 1 1 2 1 2 2 2 1 1 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 2 1 2 1 2 1 1 2 2 1 2 1 2 1 1 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 ...

result:

ok Correct (10000 test cases)

Extra Test:

score: 0
Extra Test Passed