QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#334982#7942. $K$ SubsequencesGuanYunchangAC ✓61ms25608kbC++171.2kb2024-02-22 15:51:572024-02-22 15:51:57

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 9692kb

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

result:

ok Correct (5 test cases)

Test #2:

score: 0
Accepted
time: 30ms
memory: 9684kb

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

result:

ok Correct (18434 test cases)

Test #3:

score: 0
Accepted
time: 28ms
memory: 13144kb

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

result:

ok Correct (1 test case)

Test #4:

score: 0
Accepted
time: 40ms
memory: 14124kb

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 2 2 3 4 4 5 6 7 8 9 10 10 11 12 12 13 14 15 15 16 17 17 18 18 18 18 19 19 19 19 19 19 20 20 21 21 22 22 22 22 23 24 25 26 27 28 29 29 30 30 30 30 31 31 31 32 31 32 32 33 32 33 33 34 33 34 34 34 35 35 36 36 36 36 36 37 37 37 36 36 37 36 37 38 38 37 37 37 38 39 38 39 40 40 41 41 41 42 42 41 42 43 42...

result:

ok Correct (1 test case)

Test #5:

score: 0
Accepted
time: 29ms
memory: 13472kb

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 2 2 2 3 3 2 3 2 2 4 3 4 4 3 3 5 5 5 6 6 4 6 4 4 7 5 7 7 5 5 8 6 6 8 6 8 9 9 9 10 10 7 7 7 8 10 8 8 9 9 9 10 10 10 11 11 11 11 12 12 12 11 13 13 13 14 14 11 12 14 12 15 12 13 15 15 16 16 13 16 13 14 14 14 17 17 15 15 15 16 17 16 18 18 18 19 19 16 17 19 20 20 20 21 21 21 22 22 22 23 17 17 18 23 23 2...

result:

ok Correct (1 test case)

Test #6:

score: 0
Accepted
time: 50ms
memory: 23976kb

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

result:

ok Correct (1 test case)

Test #7:

score: 0
Accepted
time: 52ms
memory: 25608kb

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

result:

ok Correct (1 test case)

Test #8:

score: 0
Accepted
time: 61ms
memory: 22344kb

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

result:

ok Correct (2 test cases)

Test #9:

score: 0
Accepted
time: 30ms
memory: 11636kb

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

result:

ok Correct (2 test cases)

Test #10:

score: 0
Accepted
time: 41ms
memory: 17240kb

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:

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

result:

ok Correct (2 test cases)

Test #11:

score: 0
Accepted
time: 44ms
memory: 19236kb

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: 39ms
memory: 12876kb

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: 27ms
memory: 13104kb

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

result:

ok Correct (3 test cases)

Test #14:

score: 0
Accepted
time: 43ms
memory: 12696kb

input:

4
25729 81
-1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 1 -1 -1 -1 1 -1 -1 1 -1 1 1 1 -1 -1 1 1 -1 1 -1 -1 1 -1 -1 -1 1 -1 1 -1 -1 -1 -1 -1 -1 1 1 -1 -1 1 -1 1 1 1 1 1 1 -1 1 1 1 -1 -1 -1 1 1 1 1 1 1 1 -1 -1 -1 -1 1 -1 -1 -1 -1 1 -1 1 -1 1 1 -1 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 5 5 6 7 8 9 10 11 12 13 13 14 14 15 16 17 17 18 19 19 20 20 20 20 20 21 21 20 21 21 21 22 21 22 23 24 24 25 25 26 27 28 29 30 31 31 31 31 32 32 33 33 33 34 34 34 33 35 35 35 33 33 34 36 36 36 37 37 37 38 34 34 35 35 38 35 36 36 36 38 37 39 37 39 39 37 40 38 40 40 38 38 41 41 41 42 42 42 39 3...

result:

ok Correct (4 test cases)

Test #15:

score: 0
Accepted
time: 44ms
memory: 16748kb

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:

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

result:

ok Correct (5 test cases)

Test #16:

score: 0
Accepted
time: 40ms
memory: 13968kb

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

result:

ok Correct (6 test cases)

Test #17:

score: 0
Accepted
time: 38ms
memory: 10556kb

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: 33ms
memory: 13272kb

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:

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

result:

ok Correct (8 test cases)

Test #19:

score: 0
Accepted
time: 38ms
memory: 10812kb

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: 36ms
memory: 14136kb

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

result:

ok Correct (10 test cases)

Test #21:

score: 0
Accepted
time: 28ms
memory: 10480kb

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 2 3 4 4 5 5 5 5 6 7 7 8 9 9 9 10 10 10 9 9 11 11 9 11 10 10 10 12 11 11 12 12 13 13 11 13 14 12 14 12 14 15 15 12 13 13 13 14 15 16 14 16 16 14 15 17 17 15 15 17 18 16 16 18 16 17 17 18 17 18 18 19 19 19 20 20 18 19 20 19 19 20 20 20 21 22 22 23 23 23 24 24 23 24 25 25 23 25 26 26 23 26 24 27 24 2...

result:

ok Correct (100 test cases)

Test #22:

score: 0
Accepted
time: 32ms
memory: 9956kb

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 2 2 3 4 5 6 4 7 8 9 10 5 11 6 7 12 8 9 10 13 11 12 13 14 15 14 15 16 16 17 18 19 20 21 22 21 22 23 24 25 26 27 25...

result:

ok Correct (101 test cases)

Test #23:

score: 0
Accepted
time: 27ms
memory: 10124kb

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

result:

ok Correct (102 test cases)

Test #24:

score: 0
Accepted
time: 27ms
memory: 9116kb

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

result:

ok Correct (103 test cases)

Test #25:

score: 0
Accepted
time: 31ms
memory: 9108kb

input:

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

result:

ok Correct (105 test cases)

Test #27:

score: 0
Accepted
time: 26ms
memory: 9264kb

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

result:

ok Correct (1000 test cases)

Test #28:

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

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

result:

ok Correct (1002 test cases)

Test #30:

score: 0
Accepted
time: 26ms
memory: 8384kb

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

result:

ok Correct (1003 test cases)

Test #31:

score: 0
Accepted
time: 26ms
memory: 8464kb

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

result:

ok Correct (1004 test cases)

Test #32:

score: 0
Accepted
time: 29ms
memory: 8388kb

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

result:

ok Correct (1005 test cases)

Test #33:

score: 0
Accepted
time: 31ms
memory: 9156kb

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

result:

ok Correct (9996 test cases)

Test #35:

score: 0
Accepted
time: 29ms
memory: 8500kb

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

result:

ok Correct (9997 test cases)

Test #36:

score: 0
Accepted
time: 31ms
memory: 8260kb

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

result:

ok Correct (9999 test cases)

Test #38:

score: 0
Accepted
time: 27ms
memory: 8316kb

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