QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#269845#7678. The Gameucup-team874#RE 73ms4732kbC++204.3kb2023-11-30 05:15:262023-11-30 05:15:26

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

2
1 3 
-1
3
2 4 4 
5
1 1 1 2 3 
2
1 1 
-1

result:

ok ok (6 test cases)

Test #2:

score: 0
Accepted
time: 4ms
memory: 3400kb

input:

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

result:

ok ok (7056 test cases)

Test #3:

score: 0
Accepted
time: 3ms
memory: 3440kb

input:

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

result:

ok ok (2640 test cases)

Test #5:

score: 0
Accepted
time: 7ms
memory: 3432kb

input:

14112
5 3
1 1 1 1 1
1 1 1
5 3
1 1 1 1 1
1 1 2
5 3
1 1 1 1 1
1 1 3
5 3
1 1 1 1 1
1 1 4
5 3
1 1 1 1 1
1 1 5
5 3
1 1 1 1 1
1 1 6
5 3
1 1 1 1 1
1 2 2
5 3
1 1 1 1 1
1 2 3
5 3
1 1 1 1 1
1 2 4
5 3
1 1 1 1 1
1 2 5
5 3
1 1 1 1 1
1 2 6
5 3
1 1 1 1 1
1 3 3
5 3
1 1 1 1 1
1 3 4
5 3
1 1 1 1 1
1 3 5
5 3
1 1 1 1 1
...

output:

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

result:

ok ok (14112 test cases)

Test #6:

score: 0
Accepted
time: 2ms
memory: 3436kb

input:

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

result:

ok ok (3234 test cases)

Test #8:

score: 0
Accepted
time: 5ms
memory: 3540kb

input:

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

result:

ok ok (8820 test cases)

Test #9:

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

input:

26460
6 5
1 1 1 1 1 1
1 1 1 1 1
6 5
1 1 1 1 1 1
1 1 1 1 2
6 5
1 1 1 1 1 1
1 1 1 1 3
6 5
1 1 1 1 1 1
1 1 1 1 4
6 5
1 1 1 1 1 1
1 1 1 1 5
6 5
1 1 1 1 1 1
1 1 1 2 2
6 5
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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 ok (50000 test cases)

Test #11:

score: 0
Accepted
time: 11ms
memory: 3420kb

input:

25872
6 3
1 1 1 1 1 1
1 1 1
6 3
1 1 1 1 1 1
1 1 2
6 3
1 1 1 1 1 1
1 1 3
6 3
1 1 1 1 1 1
1 1 4
6 3
1 1 1 1 1 1
1 1 5
6 3
1 1 1 1 1 1
1 1 6
6 3
1 1 1 1 1 1
1 2 2
6 3
1 1 1 1 1 1
1 2 3
6 3
1 1 1 1 1 1
1 2 4
6 3
1 1 1 1 1 1
1 2 5
6 3
1 1 1 1 1 1
1 2 6
6 3
1 1 1 1 1 1
1 3 3
6 3
1 1 1 1 1 1
1 3 4
6 3
1 1 ...

output:

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

result:

ok ok (25872 test cases)

Test #12:

score: 0
Accepted
time: 11ms
memory: 3420kb

input:

25872
6 2
1 1 1 1 1 1
1 1
6 2
1 1 1 1 1 1
1 2
6 2
1 1 1 1 1 1
1 3
6 2
1 1 1 1 1 1
1 4
6 2
1 1 1 1 1 1
1 5
6 2
1 1 1 1 1 1
1 6
6 2
1 1 1 1 1 1
1 7
6 2
1 1 1 1 1 1
2 2
6 2
1 1 1 1 1 1
2 3
6 2
1 1 1 1 1 1
2 4
6 2
1 1 1 1 1 1
2 5
6 2
1 1 1 1 1 1
2 6
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ok (13728 test cases)

Test #14:

score: 0
Accepted
time: 7ms
memory: 3444kb

input:

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

result:

ok ok (10080 test cases)

Test #15:

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

input:

23100
7 4
1 1 1 1 1 1 1
1 1 1 1
7 4
1 1 1 1 1 1 1
1 1 1 2
7 4
1 1 1 1 1 1 1
1 1 1 3
7 4
1 1 1 1 1 1 1
1 1 1 4
7 4
1 1 1 1 1 1 1
1 1 1 5
7 4
1 1 1 1 1 1 1
1 1 2 2
7 4
1 1 1 1 1 1 1
1 1 2 3
7 4
1 1 1 1 1 1 1
1 1 2 4
7 4
1 1 1 1 1 1 1
1 1 2 5
7 4
1 1 1 1 1 1 1
1 1 3 3
7 4
1 1 1 1 1 1 1
1 1 3 4
7 4
1 1 ...

output:

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

result:

ok ok (23100 test cases)

Test #16:

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

input:

41580
7 5
1 1 1 1 1 1 1
1 1 1 1 1
7 5
1 1 1 1 1 1 1
1 1 1 1 2
7 5
1 1 1 1 1 1 1
1 1 1 1 3
7 5
1 1 1 1 1 1 1
1 1 1 1 4
7 5
1 1 1 1 1 1 1
1 1 1 1 5
7 5
1 1 1 1 1 1 1
1 1 1 2 2
7 5
1 1 1 1 1 1 1
1 1 1 2 3
7 5
1 1 1 1 1 1 1
1 1 1 2 4
7 5
1 1 1 1 1 1 1
1 1 1 2 5
7 5
1 1 1 1 1 1 1
1 1 1 3 3
7 5
1 1 1 1 1 ...

output:

-1
-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
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-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 ok (41580 test cases)

Test #17:

score: 0
Accepted
time: 8ms
memory: 3416kb

input:

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

result:

ok ok (16632 test cases)

Test #19:

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

input:

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

output:

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

result:

ok ok (27456 test cases)

Test #20:

score: 0
Accepted
time: 22ms
memory: 3452kb

input:

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

result:

ok ok (17325 test cases)

Test #22:

score: 0
Accepted
time: 11ms
memory: 3440kb

input:

13860
8 6
1 1 1 1 1 1 1 1
1 1 1 1 1 1
8 6
1 1 1 1 1 1 1 1
1 1 1 1 1 2
8 6
1 1 1 1 1 1 1 1
1 1 1 1 1 3
8 6
1 1 1 1 1 1 1 1
1 1 1 1 1 4
8 6
1 1 1 1 1 1 1 1
1 1 1 1 2 2
8 6
1 1 1 1 1 1 1 1
1 1 1 1 2 3
8 6
1 1 1 1 1 1 1 1
1 1 1 1 2 4
8 6
1 1 1 1 1 1 1 1
1 1 1 1 3 3
8 6
1 1 1 1 1 1 1 1
1 1 1 1 3 4
8 6
1 ...

output:

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

result:

ok ok (13860 test cases)

Test #23:

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

input:

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

result:

ok ok (15876 test cases)

Test #25:

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

input:

6000
50 30
2 3 3 1 10 6 8 8 6 8 6 2 4 7 1 2 9 10 3 7 2 4 9 7 10 8 1 2 10 9 2 2 1 10 8 2 6 3 3 9 1 1 9 7 6 6 5 8 10 8
5 4 4 4 9 2 3 4 8 3 10 5 7 3 7 7 10 2 8 5 9 10 1 5 10 8 2 4 2 8
50 30
5 2 2 8 10 9 4 1 8 8 6 10 6 9 2 1 2 2 3 9 10 10 5 1 6 7 4 4 6 5 7 3 1 2 5 2 4 7 10 5 8 5 2 10 8 6 1 1 10 7
2 6 4 ...

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

result:

ok ok (6000 test cases)

Test #26:

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

input:

6000
50 20
3 1 9 1 4 5 5 7 6 5 1 5 9 10 5 3 7 7 7 5 8 2 8 9 4 1 9 5 10 7 9 3 3 2 1 4 5 6 4 4 9 10 5 6 7 6 4 3 7 1
3 5 10 9 4 9 4 10 7 6 3 8 8 1 8 3 8 5 5 4
50 20
5 8 3 8 6 5 4 9 1 2 8 7 9 9 2 4 3 10 10 5 1 3 8 6 8 9 7 7 2 3 8 1 4 2 10 8 4 2 6 10 6 4 8 9 9 9 3 4 6 10
3 7 5 8 4 5 1 1 10 5 4 8 9 4 10 7...

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

result:

ok ok (6000 test cases)

Test #27:

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

input:

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

result:

ok ok (3000 test cases)

Test #28:

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

input:

1500
200 100
3 2 6 6 3 4 10 5 10 10 2 10 4 8 1 3 4 1 2 1 2 9 10 6 9 4 2 3 1 6 4 1 6 5 7 1 3 7 3 9 8 1 5 5 8 6 8 4 4 2 5 5 2 4 4 1 2 5 2 10 9 2 9 9 4 10 3 10 10 6 9 3 1 1 3 8 8 10 8 4 1 6 10 4 8 5 2 2 10 3 3 6 5 7 8 5 1 9 10 3 9 4 5 5 2 2 3 9 4 1 1 5 9 1 8 4 9 4 9 3 7 10 7 3 9 6 2 4 5 2 10 5 1 2 4 3 ...

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

result:

ok ok (1500 test cases)

Test #29:

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

input:

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

output:

-1
-1
-1

result:

ok ok (3 test cases)

Test #30:

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

input:

3
100000 100
26628 15576 98990 43976 49647 68346 23924 26821 38507 73889 64208 7286 8583 43126 43052 76461 583 97495 60100 38769 3107 93747 71788 5884 62213 23247 35912 89245 73679 25668 84434 1943 8147 35006 4375 60512 7641 68542 90586 51747 18780 49625 38064 55647 67725 65368 51875 80357 97039 783...

output:

-1
-1
-1

result:

ok ok (3 test cases)

Test #31:

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

input:

6000
50 20
1 1 2 1 2 1 2 1 1 1 2 1 2 1 1 2 2 1 1 1 1 2 1 2 1 2 2 2 2 1 1 2 1 1 2 2 2 2 1 1 1 1 2 2 1 2 1 2 1 2
2 2 2 1 2 2 2 1 2 1 1 1 1 2 2 1 1 1 2 1
50 20
1 1 1 1 1 2 1 1 1 2 2 1 1 2 2 1 1 2 2 1 1 1 2 2 1 2 1 2 1 1 1 1 2 1 1 1 2 2 2 2 1 1 1 2 2 1 2 1 1 1
1 2 1 2 2 2 2 1 2 2 2 2 1 2 1 1 1 2 2 1
50 ...

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

result:

ok ok (6000 test cases)

Test #32:

score: 0
Accepted
time: 49ms
memory: 3448kb

input:

30000
10 6
1 2 3 1 2 3 1 2 2 2
3 3 3 2 3 2
10 6
2 1 1 3 1 1 3 1 3 2
2 3 2 2 4 4
10 6
2 1 2 1 2 2 3 3 2 1
3 2 2 3 2 4
10 6
3 2 2 2 3 2 1 1 2 2
3 3 2 3 3 3
10 6
1 2 3 2 3 2 3 2 3 1
3 3 3 3 3 3
10 6
1 3 3 2 1 3 2 2 2 3
3 3 3 3 3 3
10 6
3 1 1 3 2 2 1 1 1 3
2 3 4 2 2 3
10 6
2 3 3 1 2 2 2 3 1 3
3 3 3 3 3 ...

output:

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

result:

ok ok (30000 test cases)

Test #33:

score: 0
Accepted
time: 63ms
memory: 3444kb

input:

6000
50 30
4 9 2 8 2 4 10 3 7 8 6 2 5 9 2 5 10 5 2 6 10 2 9 3 1 7 1 9 4 1 5 4 9 6 10 4 1 2 3 8 8 4 10 1 3 5 5 7 1 4
10 7 10 9 5 5 6 8 10 8 5 10 5 6 7 5 6 9 6 9 5 5 8 8 9 8 5 10 9 5
50 30
5 4 1 10 6 5 9 9 4 8 10 4 9 9 3 1 1 5 1 2 5 5 3 8 2 10 3 9 10 5 2 2 5 9 3 1 10 8 4 8 5 4 10 5 1 5 10 10 2 3
5 10 ...

output:

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

result:

ok ok (6000 test cases)

Test #34:

score: 0
Accepted
time: 73ms
memory: 3400kb

input:

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

output:

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

result:

ok ok (6000 test cases)

Test #35:

score: -100
Runtime Error

input:

6000
50 30
18 6 18 13 8 2 15 6 9 10 14 10 13 11 3 15 9 15 5 15 3 17 16 10 7 10 3 6 5 7 19 1 8 1 17 15 16 11 20 9 1 19 9 15 6 18 1 15 19 19
10 15 16 23 10 20 17 14 11 19 18 13 12 10 19 15 10 18 17 15 10 10 15 15 20 17 15 19 15 14
50 30
14 8 1 11 8 17 11 11 15 13 17 5 11 20 17 20 7 2 3 6 14 12 6 20 14...

output:

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

result: