結果

問題 No.26 シャッフルゲーム
ユーザー toshiro_yanagi
提出日時 2019-01-06 16:01:13
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 488 bytes
コンパイル時間 618 ms
コンパイル使用メモリ 68,608 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-23 23:51:14
合計ジャッジ時間 1,206 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;

int n, m;
vector<bool> cups(3);

int main()
{
    cin >> n;
    cups[n - 1] = true;

    cin >> m;
    for (int i = 0; i < m; i++)
    {
        int p, q;
        cin >> p >> q;
        p--;
        q--;

        bool tmp = cups[p];
        cups[p] = cups[q];
        cups[q] = tmp;
    }
    for (int i = 0; i < cups.size(); i++)
    {
        if (cups[i] == true)
        {
            cout << i + 1 << "\n";
        }
    }
}
0