結果

問題 No.123 カードシャッフル
ユーザー cww
提出日時 2016-09-30 22:49:52
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 451 bytes
コンパイル時間 1,863 ms
コンパイル使用メモリ 173,044 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-21 11:17:56
合計ジャッジ時間 2,548 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 7 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define REP(i,n) for(int i=0; i<(n); i++)
using namespace std;
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	int N, M;
	cin >> N >> M;

	vector<int> vc(M);
	for( auto&& x : vc )
	{
		cin >> x;
	}
	vector<int> num;
	REP( i, N )
	{
		num.push_back( i + 1 );
	}
	REP( i, M )
	{
		auto tmp = num[ vc[i] - 1 ];
		num.insert( num.begin(), tmp );
		num.erase( num.begin() + tmp );
	}
	cout << num[0] << endl;
	return 0;
}
0