結果

問題 No.429 CupShuffle
ユーザー yuruhiyayuruhiya
提出日時 2020-04-09 13:12:17
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,439 bytes
コンパイル時間 674 ms
コンパイル使用メモリ 51,628 KB
実行使用メモリ 4,464 KB
最終ジャッジ日時 2023-10-11 05:14:41
合計ジャッジ時間 1,807 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#pragma GCC optimize ("Ofast")
#include <cstdio>
#include <cctype>
#include <algorithm>
#include <numeric>
#include <utility>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; --i)
#define rfor(i, m, n) for (int i = (m); i >= (n); --i)

#if __has_include("dump.hpp")
#define gc _getchar_nolock
#define pc _putchar_nolock
#include "dump.hpp"
#else
#define gc getchar_unlocked
#define pc putchar_unlocked
#define dump(...) ((void)0)
#endif

inline void ini(int& v)noexcept {
	char c = gc();
	for (; '0' <= c && c <= '9'; c = gc()) {
		v *= 10;
		v += c - '0';
	}
}
inline void ini2(int& v)noexcept {
	char c = gc();
	if (c == '?') { gc(); return; }
	for (; '0' <= c && c <= '9'; c = gc()) {
		v *= 10;
		v += c - '0';
	}
}
inline void ins(char* c, int n)noexcept {
	while (n--) {
		*c = gc();
		++c;
	}
}

int n, k, x;
int a[100001], b[100001], c[100001];
int p[100001];

int main() {
	ini(n); ini(k); ini(x);
	rep(i, k) { ini2(a[i]); ini2(b[i]); }
	rep(i, n) { ini(c[i]); }

	iota(p, p + n, 1);
	rep(i, n) {
		if (!a[i])break;
		swap(p[a[i] - 1], p[b[i] - 1]);
	}
	rrep(i, k) {
		if (!a[i])break;
		swap(c[a[i] - 1], c[b[i] - 1]);
	}

	bool flag = false;
	rep(i, n) {
		if (p[i] != c[i]) {
			printf("%d", i + 1);
			pc(flag ? '\n' : ' ');
			flag = true;
		}
	}
}
0