答案是:
查看原帖
答案是:
1197346
Tommy12345楼主2024/3/23 09:39
#include<iostream>
using namespace std;
const int N = 1E6;
int a[N+1];
int main()
{
	int q, c, x, y, next;
	cin >> q;
	while(q--)
	{
		cin >> c;
		if(c == 1)
		{
			cin >> x >> y;
			next = a[x];
			a[x] = y;
			a[y] = next;
		}
		else if(c == 2)
		{
			cin >> x;
			cout << a[x] << endl;
		}
		else
		{
			cin >> x;
			next = a[x];
			a[x] = a[next];
		}
	}
	return 0;
}
2024/3/23 09:39
加载中...