結果
| 問題 | No.123 カードシャッフル |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-01-11 23:27:21 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 15 ms / 5,000 ms |
| コード長 | 289 bytes |
| コンパイル時間 | 632 ms |
| コンパイル使用メモリ | 41,984 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-13 04:10:40 |
| 合計ジャッジ時間 | 1,105 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 10 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:7:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
7 | scanf("%d%d",&N,&M);
| ~~~~~^~~~~~~~~~~~~~
main.cpp:12:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
12 | scanf("%d",&a);a--;
| ~~~~~^~~~~~~~~
ソースコード
#include <deque>
#include <numeric>
#include <cstdio>
using namespace std;
int main(){
int N,M;
scanf("%d%d",&N,&M);
deque<int>v(N);
iota(v.begin(),v.end(),1);
for(;M--;){
int a,x;
scanf("%d",&a);a--;
x=v[a];
v.erase(v.begin()+a);
v.push_front(x);
}
printf("%d\n",v[0]);
}