結果

問題 No.26 シャッフルゲーム
ユーザー twice_l
提出日時 2017-12-23 00:04:59
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 374 bytes
コンパイル時間 600 ms
コンパイル使用メモリ 62,120 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-17 23:51:38
合計ジャッジ時間 1,261 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

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

using namespace std;

int main()
{
  int N, M;
  cin >> N >> M;

  vector<int> a(3,0);
  a[N-1] = 1;

  int x1, x2;
  for(int i=0; i<M; i++){
    cin >> x1 >> x2;
    swap(a[x1-1], a[x2-1]);
  }
  cout << find(a.begin(), a.end(), 1) - a.begin() + 1 << endl;
  return 0;
}
0