直接上代码
2026-09-08 23:05:45
发布于:湖北
7阅读
0回复
0点赞
#include<bits/stdc++.h>
using namespace std;
const int N=1e7+5;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin>>t;
for(int i=1;i<=t;i++){
long long a[N];
int n,k;
cin>>n>>k;
for(int j=1;j<=n;j++){
cin>>a[j];
}
if(k==0||k>n) cout<<-1<<"\n";
else cout<<a[k]<<"\n";
}
return 0;
}
这里空空如也




有帮助,赞一个