結果
| 問題 | No.26 シャッフルゲーム | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2019-08-29 03:15:48 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 303 bytes | 
| コンパイル時間 | 578 ms | 
| コンパイル使用メモリ | 72,656 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-11-17 16:41:09 | 
| 合計ジャッジ時間 | 1,147 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 10 | 
ソースコード
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
using namespace std;
typedef long long int ll;
int main(){
	int n; cin >> n;
	int m; cin >> m;
	int ans=n;
	for(int i=0;i<m;i++){
		int x,y; cin >> x >> y;
		if(x==ans)ans=y;
		else if(y==ans)ans=x;
	}
	cout << ans << endl;
}
            
            
            
        