結果
| 問題 |
No.429 CupShuffle
|
| コンテスト | |
| ユーザー |
sugim48
|
| 提出日時 | 2016-10-02 22:29:31 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 87 ms / 2,000 ms |
| コード長 | 1,343 bytes |
| コンパイル時間 | 970 ms |
| コンパイル使用メモリ | 105,740 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-21 13:14:36 |
| 合計ジャッジ時間 | 2,131 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 16 |
ソースコード
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
#include <random>
#include <list>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<int, ll> i_ll;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };
#define rep(i, N) for (int i = 0; i < (int)(N); i++)
#define pb push_back
int INF = INT_MAX / 10;
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;
int main() {
int N, M, j0; cin >> N >> M >> j0;
j0--;
vector<int> a(M), b(M);
rep(j, M) {
if (j == j0) {
string s, t; cin >> s >> t;
} else {
cin >> a[j] >> b[j];
a[j]--; b[j]--;
}
}
vector<int> p(N);
rep(i, N) p[i] = i + 1;
rep(j, j0) swap(p[a[j]], p[b[j]]);
vector<int> q(N);
rep(i, N) cin >> q[i];
for (int j = M - 1; j > j0; j--)
swap(q[a[j]], q[b[j]]);
vector<int> ans;
rep(i, N) if (p[i] != q[i]) ans.pb(i);
cout << ans[0] + 1 << ' ' << ans[1] + 1 << endl;
}
sugim48