結果

問題 No.429 CupShuffle
ユーザー tossytossy
提出日時 2016-10-02 22:44:02
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,078 bytes
コンパイル時間 783 ms
コンパイル使用メモリ 92,652 KB
実行使用メモリ 13,760 KB
最終ジャッジ日時 2024-05-01 09:53:22
合計ジャッジ時間 4,825 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <bitset>
using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define fi first
#define se second

#define INF 2147483600

int main(){
  int n,k,x;
  scanf("%d %d %d\n", &n, &k, &x);
  vector<int> f(n),g(n);
  vector<int> a(k),b(k);

  rep(i,k){
    if(i==x-1) scanf("%c %c\n", &a[i], &b[i]);
    else scanf("%d %d\n", &a[i], &b[i]);
  }
  rep(i,n) scanf("%d", &g[i]);

  rep(i,n) f[i]=i+1;
  rep(i,x-1){
    swap(f[a[i]-1], f[b[i]-1]);
    rep(i,n) cout<<f[i]<<",";
  }

  for(int i=k-1; i>=x; i--){
    swap(g[a[i]-1], g[b[i]-1]);
  }

  bool flg=false;
  rep(i,n) if(f[i]!=g[i]){
    cout<<i+1;
    if(flg) cout<<endl;
    else cout<<" ", flg=true;
  }


  return 0;
}
0