結果

問題 No.123 カードシャッフル
ユーザー magmag
提出日時 2020-08-07 01:47:52
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 11 ms / 5,000 ms
コード長 581 bytes
コンパイル時間 1,671 ms
コンパイル使用メモリ 171,180 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-22 05:15:23
合計ジャッジ時間 2,389 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 7 ms
4,348 KB
testcase_11 AC 9 ms
4,348 KB
testcase_12 AC 10 ms
4,348 KB
testcase_13 AC 11 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>

using namespace std;
using ll=long long;
#define rep2(i, a, n) for(int i = (a); i < (n); i++)
#define rep(i, n) rep2(i,0,n)
template<typename T,typename U> void Printarray2(T &f,U n){
  for(U i=0;i<n;i++)i!=n-1 ?cout<<f[i]<<" ":cout<<f[i]<<endl;
}

int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  int n,m;cin>>n>>m;
  vector<int> hoge;
  rep(i,n)hoge.push_back(i+1);
  int a;
  rep(i,m){
    cin>>a;
    a--;
    hoge.insert(hoge.begin(),hoge[a]);
    hoge.erase(hoge.begin()+a+1);
    //Printarray2(hoge,n);
  }
  cout<<hoge[0]<<endl;
}
0