結果

問題 No.123 カードシャッフル
ユーザー toto6114toto6114
提出日時 2019-07-30 18:30:10
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 338 bytes
コンパイル時間 599 ms
コンパイル使用メモリ 73,504 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-18 13:42:15
合計ジャッジ時間 1,417 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:12:17: 警告: ‘m’ may be used uninitialized [-Wmaybe-uninitialized]
   12 |   for(int i=0; i<m; i++) {
      |                ~^~
main.cpp:6:9: 備考: ‘m’ はここで定義されています
    6 |   int n,m,a;
      |         ^

ソースコード

diff #

#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main() {
  int n,m,a;
  cin >> n;
  vector<int> v(n);
  for(int i=0; i<n; i++) {
      cin >> v[i];
  }
  for(int i=0; i<m; i++) {
      cin >> a;
      int top=v[a-1];
      v.insert(v.begin(),top);
      v.erase(v.begin()+a);
  }
  cout << v[0] << endl;
}
0