結果
| 問題 | No.123 カードシャッフル |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-08 11:43:35 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 6 ms / 5,000 ms |
| コード長 | 503 bytes |
| 記録 | |
| コンパイル時間 | 519 ms |
| コンパイル使用メモリ | 92,032 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-06-09 09:41:39 |
| 合計ジャッジ時間 | 1,699 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 10 |
ソースコード
#include <iostream>
#include <numeric>
#include <vector>
void solve() {
int n, q;
std::cin >> n >> q;
std::vector<int> xs(n);
std::iota(xs.begin(), xs.end(), 1);
while (q--) {
int x;
std::cin >> x;
--x;
int t = xs[x];
xs.erase(xs.begin() + x);
xs.insert(xs.begin(), t);
}
std::cout << xs.front() << std::endl;
}
int main() {
std::cin.tie(nullptr);
std::ios::sync_with_stdio(false);
solve();
return 0;
}