結果
| 問題 | No.429 CupShuffle | 
| コンテスト | |
| ユーザー |  moyashi_senpai | 
| 提出日時 | 2016-10-02 23:32:56 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 33 ms / 2,000 ms | 
| コード長 | 1,269 bytes | 
| コンパイル時間 | 1,008 ms | 
| コンパイル使用メモリ | 92,632 KB | 
| 実行使用メモリ | 6,820 KB | 
| 最終ジャッジ日時 | 2024-11-21 14:45:39 | 
| 合計ジャッジ時間 | 2,191 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 16 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:33:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   33 |         scanf("%d %d %d", &n, &k, &x);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:41:30: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   41 |                         scanf("%*s %*s");
      |                         ~~~~~^~~~~~~~~~~
main.cpp:45:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   45 |                 scanf("%d %d", &a, &b);
      |                 ~~~~~^~~~~~~~~~~~~~~~~
main.cpp:52:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   52 |                 scanf("%d", &ans[i]);
      |                 ~~~~~^~~~~~~~~~~~~~~
            
            ソースコード
#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;
}
            
            
            
        