結果

問題 No.429 CupShuffle
ユーザー kotamanegikotamanegi
提出日時 2016-10-02 22:59:24
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 80 ms / 2,000 ms
コード長 1,239 bytes
コンパイル時間 934 ms
コンパイル使用メモリ 89,100 KB
実行使用メモリ 4,824 KB
最終ジャッジ日時 2023-08-13 17:17:49
合計ジャッジ時間 2,214 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include<map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
using namespace std;
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
#define LONGINF 1000000000000000000
int first_one[200000] = {};
int second_one[200000] = {};
int main(){
	int n, k, x;
	cin >> n >> k >> x;
	vector<pair<int, int>> hoge;
	REP(i, k) {
		if (i != x - 1) {
			int a, b;
			cin >> a >> b;
			hoge.push_back(make_pair(a, b));
		}
		else {
			string fa, fi;
			cin >> fa >> fi;
		}
	}
	REP(i, n) {
		first_one[i + 1] = i + 1;
		cin >> second_one[i+1];
	}
	for (int i = 0;i < x - 1;++i) {
		swap(first_one[hoge[i].first], first_one[hoge[i].second]);
	}
	for (int i = hoge.size()-1;i >= x-1;--i) {
		swap(second_one[hoge[i].first], second_one[hoge[i].second]);
	}
	for (int i = 1;i <= n;++i) {
		if (first_one[i] != second_one[i]) {
			cout << i << " ";
		}
	}
	cout << endl;
	return 0;
}
0