結果
| 問題 |
No.429 CupShuffle
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-12-25 23:26:13 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 87 ms / 2,000 ms |
| コード長 | 1,100 bytes |
| コンパイル時間 | 749 ms |
| コンパイル使用メモリ | 87,548 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-12-14 19:08:38 |
| 合計ジャッジ時間 | 2,559 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 16 |
ソースコード
#define _USE_MATH_DEFINES
#include<stdio.h>
#include<string>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include<iomanip>
//#include<bits/stdc++.h>
using namespace std;
int main() {
int n, k, x;
cin >> n >> k >> x;
vector<int>a, b, c;
x--;
for (int i = 0; i < n; i++) {
int I = i + 1;
a.push_back(I);
b.push_back(I);
//cout << a.size()<< b[i];
}
for (int i = 0; i < k; i++) {
int w, h;
char rr, rrr;
if (i != x) { cin >> w >> h; w--, h--; }
else cin >> rr >> rrr;
if (i == x) { b = a;}
if (i < x) {
swap(a[w], a[h]);
}
else if (i > x) {
swap(b[w], b[h]);
}
}
for (int i = 0; i < n; i++) {
int r; cin >> r;
c.push_back(r);
//cout << c[i];
}
vector<int>t;
for (int i = 0; i < n; i++) {
//cout << b[i] << c[i] << endl;;
if (b[i] != c[i]) {
for (int j = 0; j < n; j++) {
if(a[j]==b[i]||a[j]==c[i])t.push_back(j);
}
}
if (t.size())break;
}
cout << t[0]+1 << " " << t[1]+1 << endl;
return 0;
}