結果

問題 No.26 シャッフルゲーム
ユーザー masa
提出日時 2015-01-25 21:43:15
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 385 bytes
コンパイル時間 889 ms
コンパイル使用メモリ 62,240 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-23 02:42:25
合計ジャッジ時間 1,712 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>

using namespace std;

int main() {
	int n, m;
	vector<bool> cup(4, false);

	cin >> n >> m;
	cup[n] = true;
	int p, q;
	for (int i = 0; i < m; i++) {
		cin >> p >> q;
		swap(cup[p], cup[q]);
	}
	auto it = find(cup.begin(), cup.end(), true);
	cout << it - cup.begin() << endl;
	return 0;
}
0