結果

問題 No.26 シャッフルゲーム
ユーザー hiyorihiyori
提出日時 2016-09-19 02:03:32
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 578 bytes
コンパイル時間 772 ms
コンパイル使用メモリ 70,096 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-28 15:43:40
合計ジャッジ時間 1,199 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#define REP(i, a) for(int i = 0; i < a; i++)

/* for文ぐるぐる丸を探すバージョン */

using namespace std;

int main ()
{
  int N, M;  /* 丸印のある位置(N)は左から数える */
  vector<int> cups(4, 0);  // 要素0, 1, 2, 3
  cin >> N >> M;

  cups[N] = 1;  // 丸印のある位置を1とする
  cout << cups[N] << endl;

  int a, b;
  REP (i, M) {
    cin >> a >> b;
    swap(cups[a], cups[b]);  // 入れ替える
  }
  REP (i, 4) {
    if (cups[i] > 0) cout << i << endl;
  }
  return 0;
}
0