10pts数组求调
查看原帖
10pts数组求调
776337
sugawara楼主2024/1/24 15:53
#include<iostream>
using namespace std;
const int N=1e6+10;
int list[N];
int n,op,x,y,top;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&op);
		if(op==1)scanf("%d%d",&x,&y),list[x]=y;
		if(op==2) scanf("%d",&x),printf("%d\n",list[x]);
		if(op==3) scanf("%d",&x),list[x]=list[list[x]];
	}
	return 0;
}
2024/1/24 15:53
加载中...