You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
486 B

2 years ago
#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;
}