結果
| 問題 | No.123 カードシャッフル | 
| コンテスト | |
| ユーザー |  h_noson | 
| 提出日時 | 2016-02-14 17:03:03 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 21 ms / 5,000 ms | 
| コード長 | 409 bytes | 
| コンパイル時間 | 500 ms | 
| コンパイル使用メモリ | 62,264 KB | 
| 実行使用メモリ | 6,948 KB | 
| 最終ジャッジ日時 | 2024-09-22 06:31:14 | 
| 合計ジャッジ時間 | 1,348 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 10 | 
ソースコード
#include <iostream>
#include <list>
#include <vector>
using namespace std;
int main() {
    int n, m;
    cin >> n >> m;
    vector<int> as;
    for (int i = 1; i <= n; i++)
        as.push_back(i);
    for (int i = 0; i < m; i++) {
        int a, x;
        cin >> a;
        x = as[a-1];
        as.erase(as.begin() + a-1);
        as.insert(as.begin(),x);
    }
    cout << as[0] << endl;
    return 0;
}
            
            
            
        