結果

問題 No.123 カードシャッフル
ユーザー daradara_sanma
提出日時 2017-07-04 21:11:32
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 337 bytes
コンパイル時間 512 ms
コンパイル使用メモリ 60,148 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-05 16:04:11
合計ジャッジ時間 1,284 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 6 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<cstdio>
#include<vector>
using namespace std;

int main() {
	int n, m;
	cin >> n >> m;
	vector<int> A(m);
	for (int i = 0; i < m; i++)
	{
		cin >> A[i];
	}

	int pos = 1;
	for (int i = m-1; i >= 0; i--)
	{
		if (pos == 1) pos = A[i];
		if (pos < A[i])
		{
			pos--;
		}
	}
	cout << pos << endl;
	
	return 0;
}
0