結果

問題 No.26 シャッフルゲーム
ユーザー forest3
提出日時 2020-03-19 17:07:21
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 335 bytes
コンパイル時間 1,818 ms
コンパイル使用メモリ 167,428 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-12-14 03:18:25
合計ジャッジ時間 2,240 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main()
{
	int N, M;
	cin >> N >> M;
	vector<int> cup( 3 );
	cup[N - 1] = 1;
	for( int i = 0; i < M; i++ ) {
		int P, Q;
		cin >> P >> Q;
		P--;
		Q--;;
		swap( cup[P], cup[Q] );
	}

	int ans = 0;
	for( int i = 0; i < 3; i++ ) {
		if( cup[i] ) ans = i + 1;
	}

	cout << ans << endl;
}
0