結果

問題 No.123 カードシャッフル
ユーザー maine_honzukimaine_honzuki
提出日時 2020-05-17 17:34:40
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 21 ms / 5,000 ms
コード長 367 bytes
コンパイル時間 1,633 ms
コンパイル使用メモリ 171,084 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-26 02:32:31
合計ジャッジ時間 2,414 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 17 ms
4,348 KB
testcase_11 AC 20 ms
4,348 KB
testcase_12 AC 21 ms
4,348 KB
testcase_13 AC 21 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
    int N, M;
    cin >> N >> M;
    vector<int> card(N);
    iota(card.begin(), card.end(), 1);

    while (M--) {
        int A;
        cin >> A;
        A--;

        int tmp = card[A];
        card.erase(card.begin() + A);

        card.insert(card.begin(), tmp);
    }

    cout << card[0] << endl;
}
0