0% found this document useful (0 votes)
11 views

Problem - E - Codeforces

The document describes a problem from Codeforces Round 1016 (Div. 3) where participants must split an array into k non-overlapping subarrays to maximize the minimum MEX value. It includes details about the input format, constraints, and expected output for multiple test cases. The goal is to determine the maximum MEX value for each partitioning of the array.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Problem - E - Codeforces

The document describes a problem from Codeforces Round 1016 (Div. 3) where participants must split an array into k non-overlapping subarrays to maximize the minimum MEX value. It includes details about the input format, constraints, and expected output for multiple test cases. The goal is to determine the maximum MEX value for each partitioning of the array.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

23:21 8/4/25 Problem - E - Codeforces

 |
QuanVanHoang | Logout

HOME TOP CATALOG CONTESTS GYM PROBLEMSET GROUPS RATING EDU API CALENDAR HELP RAYAN

PROBLEMS SUBMIT CODE MY SUBMISSIONS STATUS STANDINGS CUSTOM INVOCATION

Codeforces Round 1016 (Div. 3)


E. Min Max MEX Contest is running
time limit per test: 2 seconds
00:28:49
memory limit per test: 256 megabytes
Contestant
You are given an array a of length n and a number k .

A subarray is defined as a sequence of one or more consecutive elements of the array. You need
to split the array a into k non-overlapping subarrays b1 , b2 , … , bk such that the union of these
subarrays equals the entire array. Additionally, you need to maximize the value of x , which is → Submit?
equal to the minimum MEX(bi ) , for i ∈ [1..k] .
Language: GNU G++20 13.2 (64 bit, wi
MEX(v) denotes the smallest non-negative integer that is not present in the array v.
Choose
Chọn tệp Không có …được chọn
file:
Input
The first line contains an integer t
4
(1 ≤ t ≤ 10 ) — the number of test cases. Submit

The first line of each test case contains two integers n, k (1 ≤ k ≤ n ≤ 2 ⋅ 10 )


5
— the length
of the array and the number of segments to split the array into.

The second line of each test case contains n integers ai


9
(0 ≤ ai ≤ 10 ) — the elements of the
array.

5
It is guaranteed that the sum of n across all test cases does not exceed 2 ⋅ 10 .

Output
For each query, output a single number — the maximum value x such that there exists a partition
of the array a into k subarrays where the minimum MEX equals x .

Example
input Copy

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

output Copy

1
5
3
1
0
1
0

Codeforces (c) Copyright 2010-2025 Mike Mirzayanov


The only programming contests Web 2.0 platform
https://codeforces.com/contest/2093/problem/E 1/2

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy