結果

問題 No.123 カードシャッフル
ユーザー suibaka_ku
提出日時 2017-03-08 09:58:28
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 20 ms / 5,000 ms
コード長 500 bytes
コンパイル時間 835 ms
コンパイル使用メモリ 80,784 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-23 20:52:24
合計ジャッジ時間 1,633 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;
using ll = long long;

int main() {
    int N, M;
    cin >> N >> M;
    vector<int> v(N);
    for(int i=0; i<N; ++i) {
        v[i] = i+1;
    }
    for(int i=0; i<M; ++i) {
        int a;
        cin >> a;
        a--;
        int t = v[a];
        for(int j=a; j>=1; --j) {
            v[j] = v[j-1];
        }
        v[0] = t;
    }
    cout << v[0] << endl;
}
0