結果
問題 |
No.123 カードシャッフル
|
ユーザー |
![]() |
提出日時 | 2018-03-09 00:51:38 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 18 ms / 5,000 ms |
コード長 | 458 bytes |
コンパイル時間 | 518 ms |
コンパイル使用メモリ | 75,972 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-05 08:20:01 |
合計ジャッジ時間 | 1,059 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 10 |
ソースコード
#include<iostream> #include<string> #include<algorithm> #include<cmath> #include<iomanip> #include<cstring> #include<map> #include<vector> using namespace std; typedef long long int ll; 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; 0<=i; i--){ if(pos==1){ pos=a[i]; } else if(a[i]>=pos){ pos--; } } cout << pos << endl; return 0; }