Codeforces Round 1016 (Div. 3):2093E - Min Max MEX

打印 上一主题 下一主题

主题 1556|帖子 1556|积分 4668

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

x
2093E - Min Max MEX

题目:https://codeforces.com/contest/2093/problem/E
E. Min Max MEX

time limit per test :2 seconds
memory limit per test :256  megabytes

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 equal to the minimum MEX(bi)
, for i∈[1..k] MEX(v) denotes the smallest non-negative integer that is not present in the array v
.
Input
The first line contains an integer t
(1≤t≤104)    — the number of test cases.
The first line of each test case contains two integers nk  (1 ≤ k ≤ n ≤ 2⋅105)
— 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 (0≤ai≤109)
— the elements of the array.
It is guaranteed that the sum of n
across all test cases does not exceed 2e5
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 .
让我们说中文:
给你一个长度为 n 的数组 a 和一个整数 k。
我们界说 子数组 为数组中一段一连的元素序列。
你必要将整个数组 a 分成 k 个互不重叠的子数组 b₁, b₂, ..., bₖ,使得这些子数组的并集恰好等于整个数组 a。
别的,你必要最大化一个值 x,这个值是全部子数组中 MEX(bᵢ) 的最小值
即:x = min(MEX(b₁), MEX(b₂), ..., MEX(bₖ))


免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

冬雨财经

论坛元老
这个人很懒什么都没写!
快速回复 返回顶部 返回列表