結果
問題 |
No.429 CupShuffle
|
ユーザー |
![]() |
提出日時 | 2023-12-15 11:36:21 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 102 ms / 2,000 ms |
コード長 | 1,068 bytes |
コンパイル時間 | 2,274 ms |
コンパイル使用メモリ | 198,028 KB |
最終ジャッジ日時 | 2025-02-18 11:20:09 |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 16 |
ソースコード
#include <bits/stdc++.h> #include<iostream> #include<iomanip> #include<string> #include<algorithm> #include<vector> #include<set> #include<list> #include<queue> #include<math.h> #include<bitset> using ll = long long; using namespace std; int main() { int n, k, x; char c; cin >> n >> k >> x; vector<int> a(n), ans(n); vector<vector<int>> ab(k, vector<int>(2)); for (int i = 0; i < n; i++) a[i] = i+1; for (int i = 0; i < k; i++) { if (i == x-1) { cin >> c >> c; continue; }; cin >> ab[i][0]; cin >> ab[i][1]; } for (int i = 0; i < n; i++) cin >> ans[i]; for (int i = 0; i < x-1; i++){ int p, q; p = ab[i][0]; q = ab[i][1]; p--; q--; swap(a[p], a[q]); } for (int i = k-1; i >= x; i--){ int p, q; p = ab[i][0]; q = ab[i][1]; p--; q--; swap(ans[p], ans[q]); } for (int i = 0; i < n; i++){ if (a[i] != ans[i]) cout << i+1 << " "; } cout << endl; }