結果
問題 | No.123 カードシャッフル |
ユーザー |
![]() |
提出日時 | 2020-05-24 20:11:51 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 114 ms / 5,000 ms |
コード長 | 473 bytes |
コンパイル時間 | 2,744 ms |
コンパイル使用メモリ | 196,976 KB |
最終ジャッジ日時 | 2025-01-10 15:33:14 |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 10 |
ソースコード
#include <bits/stdc++.h>using namespace std;int main() {ios::sync_with_stdio(false);cin.tie(0);int N, M;cin >> N >> M;vector<int> A(N);iota(A.begin(), A.end(), 0);vector<int> idx(N);iota(idx.begin(), idx.end(), 0);int cur = -1;for (int i = 0; i < M; i++) {int x;cin >> x;x--;A[idx[x]] = cur--;sort(idx.begin(), idx.end(), [&](int a, int b) { return A[a] < A[b]; });}cout << idx[0] + 1 << '\n';return 0;}