結果
| 問題 | No.123 カードシャッフル | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2020-06-10 23:17:45 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 39 ms / 5,000 ms | 
| コード長 | 432 bytes | 
| コンパイル時間 | 900 ms | 
| コンパイル使用メモリ | 98,352 KB | 
| 最終ジャッジ日時 | 2025-01-11 00:57:30 | 
| ジャッジサーバーID (参考情報) | judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 10 | 
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <math.h>
using namespace std;
typedef long long int ll;
int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int n,m; cin >> n >> m;
	vector<int> a(n);
	for(int i=0;i<n;i++){
		a[i]=n-i;
	}
	while(m--){
		int p; cin >> p;
		int id=n-p;
		int q=a[id];
		a.erase(a.begin()+id);
		a.push_back(q);
	}
	printf("%d\n",a.back());
}
            
            
            
        