結果

問題 No.123 カードシャッフル
ユーザー hiyori
提出日時 2017-08-05 16:32:54
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 21 ms / 5,000 ms
コード長 402 bytes
コンパイル時間 632 ms
コンパイル使用メモリ 73,376 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-11 20:36:19
合計ジャッジ時間 1,396 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<algorithm>
#define REP(i,a) for(i=0;i<a;i++)
using namespace std;

int main () {
    int n,m,i;
    cin >> n >> m;
    vector<int> v;
    REP(i,n) { v.push_back(i+1); }
    
    int shuffle;
    REP(i,m) {
        cin >> shuffle;
        v.insert(v.begin(),v[shuffle-1]);
        v.erase(v.begin() + shuffle);
    }
    cout << v[0] << endl;
    return 0;
}
0