結果

問題 No.429 CupShuffle
ユーザー moyashi_senpaimoyashi_senpai
提出日時 2016-10-02 23:32:56
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 27 ms / 2,000 ms
コード長 1,269 bytes
コンパイル時間 1,935 ms
コンパイル使用メモリ 91,892 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-13 18:09:35
合計ジャッジ時間 3,028 ms
ジャッジサーバーID
(参考情報)
judge10 / judge13
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <bitset>
#include <stack>
#include <cstdlib>
#include <complex>
#include <unordered_map>
#define REP(i,n) for(int i = 0; n > i; i++)
#define MODU 33
#define Range(x,a,b) ((a) <= (x) && (x) <= (b))
#define POWT(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define C_D(c) ((c) - '0')
#define D_C(d) ((d) + '0')
using namespace std;
typedef vector<int> Ivec;
typedef pair<int, int> pii;
typedef long long int ll;

int main() {
	int n, k, x;
	scanf("%d %d %d", &n, &k, &x);
	vector<int> num(n),ans(n),tot(n);
	REP(i, n) {
		num[i] = i + 1;
	}
	REP(i, k) {
		int a, b;
		if (i == (x - 1)) {
			scanf("%*s %*s");
			tot = num;
			continue;
		}
		scanf("%d %d", &a, &b);
		a--; b--;
		int t = num[a];
		num[a] = num[b];
		num[b] = t;
	}
	REP(i, n) {
		scanf("%d", &ans[i]);
	}
	vector<int> ch;
	REP(i, n) {
		if (num[i] != ans[i]) {
			ch.push_back(num[i]);
		}
	}
	bool f = 0;
	REP(i, n) {
		if (tot[i] == ch[0] || tot[i] == ch[1]) {
			printf("%d",i+1);
			if (!f)printf(" ");
			f = 1;
		}
	}
	printf("\n");
	return 0;
}
0