比赛 NOIP2025模拟赛1 评测结果 AAAAAAAAAAWAWWWWAAWW
题目名称 Ntarsis Set 最终得分 65
用户昵称 梦那边的美好TT 运行时间 0.703 s
代码语言 C++ 内存使用 3.92 MiB
提交时间 2025-11-24 11:35:59
显示代码纯文本
#include<bits/stdc++.h>
#define ll long long
#define N 200001
using namespace std;
int t,n,k,a[N],num,ans;
int main(){
	freopen("ntarsis_set.in","r",stdin);
	freopen("ntarsis_set.out","w",stdout);
	//cin>>t;
	t=1;
	while(t--){
		cin>>n>>k;
		for(int i=1;i<=n;i++) cin>>a[i];
		if(a[1]>1){
			cout<<1<<endl;
			continue;
		}
		ans=1;
		num=0;
		while(k--){
			ans+=num;
			while(num<n&&a[num+1]<=ans){
				num++;
				ans++;
			}
		}
		cout<<ans<<endl;
	}
	return 0;
}