結果
| 問題 | No.429 CupShuffle |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-10-20 12:28:16 |
| 言語 | C++23(gcc16) (gcc 16.2.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 57 ms / 2,000 ms |
| + 822µs | |
| コード長 | 771 bytes |
| 記録 | |
| コンパイル時間 | 3,293 ms |
| コンパイル使用メモリ | 180,324 KB |
| 実行使用メモリ | 9,828 KB |
| 最終ジャッジ日時 | 2026-10-20 12:28:31 |
| 合計ジャッジ時間 | 5,347 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 16 |
ソースコード
#include <algorithm>
#include <iostream>
#include <numeric>
#include <utility>
#include <vector>
int main() {
using namespace std;
int n, k, x;
cin >> n >> k >> x;
vector<int> a(n);
iota(a.begin(), a.end(), 1);
for (int _ = 0; _ < x - 1; _++) {
int i, j;
cin >> i >> j;
swap(a[i - 1], a[j - 1]);
}
char ax, ay;
cin >> ax >> ay;
vector<pair<int, int>> shuffle(k - x);
for (auto &[i, j] : shuffle) { cin >> i >> j; }
vector<int> c(n);
for (auto &e : c) { cin >> e; }
for (int t = k - x - 1; t >= 0 ; t--) {
auto [i, j] = shuffle[t];
swap(c[i - 1], c[j - 1]);
}
for (int i = 0; i < n; i++) {
if (a[i] != c[i]) { cout << i + 1 << " "; }
}
cout << endl;
}