結果

問題 No.123 カードシャッフル
ユーザー cielciel
提出日時 2015-01-11 23:27:21
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 13 ms / 5,000 ms
コード長 289 bytes
コンパイル時間 506 ms
コンパイル使用メモリ 42,916 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-03 23:38:21
合計ジャッジ時間 1,228 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <deque>
#include <numeric>
#include <cstdio>
using namespace std;
int main(){
	int N,M;
	scanf("%d%d",&N,&M);
	deque<int>v(N);
	iota(v.begin(),v.end(),1);
	for(;M--;){
		int a,x;
		scanf("%d",&a);a--;
		x=v[a];
		v.erase(v.begin()+a);
		v.push_front(x);
	}
	printf("%d\n",v[0]);
}
0