結果

問題 No.123 カードシャッフル
ユーザー KKT89KKT89
提出日時 2020-06-10 23:17:45
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 9 ms / 5,000 ms
コード長 432 bytes
コンパイル時間 907 ms
コンパイル使用メモリ 100,100 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-06 00:23:25
合計ジャッジ時間 1,814 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#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());
}
0