結果

問題 No.123 カードシャッフル
ユーザー cwwcww
提出日時 2016-09-30 22:49:52
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 451 bytes
コンパイル時間 2,127 ms
コンパイル使用メモリ 171,200 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-05-01 08:16:19
合計ジャッジ時間 2,438 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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