代码求调
  • 板块灌水区
  • 楼主Prince0618
  • 当前回复4
  • 已保存回复4
  • 发布时间2025/2/4 19:34
  • 上次更新2025/2/5 08:40:17
查看原帖
代码求调
958627
Prince0618楼主2025/2/4 19:34

rtrt

#include<bits/stdc++.h>
using namespace std;
int v[1000],pos[1000],next[1000];
int main(){
	int q,op,x,y,num=0;
	cin>>q;
	next[0]=1;
	v[1]=1;
	pos[1]=1;
	while(q--){
		int op;
		cin>>op;
		if(op==1){
			cin>>x>>y;
			if(!pos[x]) pos[x]=num++,v[pos[x]]=x;
			if(!pos[y]) pos[y]=num++,v[pos[y]]=y;
			next[pos[y]]=next[pos[x]];
			next[pos[x]]=pos[y];
		}
		else if(op==2){
		    cin>>x;
			cout<<v[next[pos[x]]]<<endl;	
		}
		else{
			next[pos[x]]=next[next[pos[x]]];
		}
	}
	return 0;
} 

在本地C++上报错,报错信息为:

[Error]reference to'next' is ambiguous

中文意思(貌似):【错误】'next'是摸棱两可的参考/查阅

???

2025/2/4 19:34
加载中...