Files
python/TangDou/XiTi/1256.cpp

34 lines
486 B
C++
Raw Normal View History

2025-08-30 18:35:01 +08:00
#include <bits/stdc++.h>
using namespace std;
/*
测试用例:
4 5
1 5
5 2
3 4
2 3
答案:3
*/
int n, m;
const int N = 1e5 + 10;
int w[N];
int main() {
cin >> n >> m;
w[1] = 1; // 1号碗里放小球
for (int i = 1; i <= n; i++) {
int x, y;
cin >> x >> y;
swap(w[x], w[y]);
}
for (int i = 1; i <= m; i++)
if (w[i]) {
printf("%d\n", i);
break;
}
return 0;
}