0pts WA求调
查看原帖
0pts WA求调
1408395
_lxc__楼主2025/1/9 20:50

样例过了,全红,不知道哪里错了

#include<bits/stdc++.h>
using namespace std;
int n,m,k,p[1010];
bool vis[1010];
int main(){
	cin>>n>>m>>k;
	for(int i=1;i<=m;i++){
		cin>>p[i];
		vis[p[i]]=1;
	}
	while(k--){
		int x;
		cin>>x;
		if(!vis[p[x]+1]&&p[x]<n){
			cout<<p[x]+1<<"\n";
			vis[p[x]+1]=1;
			vis[p[x]]=0;
		}else{
			cout<<"error!\n";
		}
	}
	return 0;
}

2025/1/9 20:50
加载中...