結果
問題 | No.123 カードシャッフル |
ユーザー |
|
提出日時 | 2018-05-30 00:50:22 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 32 ms / 5,000 ms |
コード長 | 495 bytes |
コンパイル時間 | 519 ms |
コンパイル使用メモリ | 62,512 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-30 08:08:47 |
合計ジャッジ時間 | 1,547 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 10 |
ソースコード
#include <iostream>#include <list>#include <iterator>#include <algorithm>#include <numeric>using namespace std;int main(){int n, m;list<int> cards;cin >> n >> m;cards.resize(n);iota(cards.begin(), cards.end(), 1);for(int i=0; i<m; i++){int a;cin >> a;auto it = std::next(cards.begin(), a-1);int card = *it;cards.erase(it);cards.push_front(card);}cout << cards.front() << endl;}