結果
| 問題 | No.26 シャッフルゲーム | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2020-07-24 05:49:47 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 504 bytes | 
| コンパイル時間 | 695 ms | 
| コンパイル使用メモリ | 77,304 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-06-24 08:53:00 | 
| 合計ジャッジ時間 | 1,236 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 10 | 
ソースコード
#include <iostream>	//cin, cout
#include <vector>	//vector
#include <algorithm> //sort,min,max
#include <string>	//string
#include <ios>		//fixed
#include <iomanip>	//setprecision
#include <utility> //swap
using namespace std;
int main() {
	int N, M, P, Q;
	cin >> N >> M;
	vector<int> A(4);
	A[N] = 1;
	for (int i = 0; i < M; i++) {
		cin >> P >> Q;
		swap(A[P], A[Q]);
	}
	
	int max_index = std::distance(A.begin(), std::max_element(A.begin(), A.end()));
	cout << max_index << endl;
	return 0;
}
            
            
            
        