結果

問題 No.429 CupShuffle
ユーザー aaaaaaiuaaaaaaiu
提出日時 2019-08-16 23:43:53
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 506 bytes
コンパイル時間 2,045 ms
コンパイル使用メモリ 202,156 KB
実行使用メモリ 4,916 KB
最終ジャッジ日時 2023-10-24 07:01:35
合計ジャッジ時間 4,808 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 WA -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
    int n,k,x;
    cin>>n>>k>>x;
    x--;
    int a[n],b[n];
    for (int i=0;i<n;i++) a[i]=i+1;
    int c[k],d[k];
    for (int i=0;i<k;i++) {
        cin>>c[i]>>d[i];
        c[i]--,d[i]--;
    }
    for (int i=0;i<n;i++) cin>>b[i];
    for (int i=0;i<x;i++) swap(a[c[i]],a[d[i]]);
    for (int i=k-1;i>x;i--) swap(b[c[i]],b[d[i]]);
    for (int i=0;i<n;i++) if (a[i]!=b[i]) cout<<i+1<<' ';
    cout<<endl;
    return 0;
}
0