結果

問題 No.123 カードシャッフル
ユーザー umaumax
提出日時 2017-05-03 19:22:33
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 26 ms / 5,000 ms
コード長 363 bytes
コンパイル時間 433 ms
コンパイル使用メモリ 58,340 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-14 07:08:49
合計ジャッジ時間 1,169 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>

using namespace std;

int main(int argc, const char* argv[])
{
	int N, M;
	cin >> N >> M;
	string s;
	for (int i = 0; i < N; i++) {
		s += (char)(i + 1);
	}
	int A[M];
	int a;
	for (auto&& a : A) {
		cin >> a;
		char tmp = s[a - 1];
		s.erase(s.begin() + (a - 1));
		s = tmp + s;
	}
	cout << (int)s[0] << endl;
	return 0;
}
0