AT_scpc2026_div2_f.The Kth Smallest Number
入门
通过率:0%
时间限制:2.00s
内存限制:1024MB
AC君温馨提醒
该题目为【atcoder】题库的题目,您提交的代码将被提交至atcoder进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
An infinite sequence (an) satisfies the following property.
- For every positive integer i satisfying i>N, ai is equal to the K-th element of ai−N,ai−N+1,…,ai−1 after these values are sorted in nondecreasing order.
Once the values of a1,…,aN are determined, the values of aN+1,aN+2,… are uniquely determined.
You are given the values of N, K, M and a1,…,aN. Find aM.
一个无限序列 (an) 满足如下性质:
- 对每个满足 i>N 的正整数 i,ai 等于将 ai−N,ai−N+1,…,ai−1 按非递减顺序排序后所得序列中的第 K 个元素。
一旦确定了 a1,…,aN 的值,则 aN+1,aN+2,… 的值被唯一确定。
给定 N、K、M 以及 a1,…,aN 的值,求 aM。
输入格式
The input is given from Standard Input in the following format:
N K M
a1 a2 … aN
输入从标准输入中按以下格式给出:
N K M
a1 a2 … aN
输出格式
Output the answer.
输出答案。
输入输出样例
输入#1
8 6 9 2 0 2 6 0 5 1 6
输出#1
5
输入#2
1 1 1 1
输出#2
1
说明/提示
表示言語
/ /
Sample 1 Explanation:
Sorting [2,0,2,6,0,5,1,6] in nondecreasing order, we have [0,0,1,2,2,5,6,6]. Since K=6, we have a9=5.
Sample 2 Explanation:
Constraints
- 1≤K≤N≤300000
- 1≤M≤1018
- −109≤ai≤109
- All input values are integers.
表示语言
/ /
样例 1 解释:
将 [2,0,2,6,0,5,1,6] 按非递减顺序排序,得到 [0,0,1,2,2,5,6,6]。由于 K=6,故 a9=5。
样例 2 解释:
约束条件
- 1≤K≤N≤300000
- 1≤M≤1018
- −109≤ai≤109
- 所有输入值均为整数。
输入解题思路,AI测评打分。不知道怎么写?