結果
| 問題 |
No.123 カードシャッフル
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-07-01 14:26:56 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 525 bytes |
| コンパイル時間 | 724 ms |
| コンパイル使用メモリ | 64,712 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-13 23:46:25 |
| 合計ジャッジ時間 | 1,567 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 6 WA * 4 |
ソースコード
#include <iostream>
#include<string>
using namespace std;
using ll = long long int;
int main(void){
int n, m, atmp;
cin >> n >> m;
int a[m];
for (int i = 0; i < m; i ++){
cin >> atmp;
a[i] = atmp - 1;
}
int now = 0;
for (int i = m - 1; i >= 0; i--){
if (now == 0){
now = a[i];
}
else if (now == a[i]){
now = 0;
}
else if (now < a[i]){
now --;
}
}
cout << now + 1 << endl;
return 0;
}