結果
問題 | No.429 CupShuffle |
ユーザー |
![]() |
提出日時 | 2016-10-02 22:41:47 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 88 ms / 2,000 ms |
コード長 | 912 bytes |
コンパイル時間 | 1,303 ms |
コンパイル使用メモリ | 162,620 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-21 13:20:44 |
合計ジャッジ時間 | 2,354 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 16 |
ソースコード
#include <bits/stdc++.h>#define rep(i, a, n) for(int i = a; i < n; i++)#define repb(i, a, b) for(int i = a; i >= b; i--)#define all(a) a.begin(), a.end()#define int long longusing namespace std;signed main(){int n, k, x;cin >> n >> k >> x;vector<int> d(n), pa(x - 1), pb(x - 1), aa(k - x), ab(k - x), c(n);rep(i, 0, n) d[i] = i;rep(i, 0, x - 1){cin >> pa[i] >> pb[i];pa[i]--; pb[i]--;}char s;cin >> s >> s;rep(i, 0, k - x){cin >> aa[i] >> ab[i];aa[i]--; ab[i]--;}rep(i, 0, n){cin >> c[i];c[i]--;}rep(i, 0, x - 1){swap(d[pa[i]], d[pb[i]]);}repb(i, k - x - 1, 0){swap(c[aa[i]], c[ab[i]]);}vector<int> ans;rep(i, 0, n){if(d[i] != c[i]){ans.push_back(i);}}cout << ans[0] + 1 << ' ' << ans[1] + 1 << endl;}