結果

問題 No.429 CupShuffle
ユーザー aaaaaaiuaaaaaaiu
提出日時 2019-08-16 23:50:12
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 87 ms / 2,000 ms
コード長 591 bytes
コンパイル時間 2,100 ms
コンパイル使用メモリ 202,340 KB
実行使用メモリ 5,272 KB
最終ジャッジ日時 2023-10-24 09:44:30
合計ジャッジ時間 4,077 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 9 ms
4,348 KB
testcase_11 AC 86 ms
5,272 KB
testcase_12 AC 81 ms
5,272 KB
testcase_13 AC 87 ms
5,272 KB
testcase_14 AC 86 ms
5,272 KB
testcase_15 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

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++) {
        if (i==x) {
            char ch;cin>>ch>>ch;
            continue;
        }
        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