結果

問題 No.1366 交換門松列・梅
ユーザー Y_S
提出日時 2021-01-29 21:29:23
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 1,186 bytes
コンパイル時間 936 ms
コンパイル使用メモリ 96,564 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-06-20 10:56:33
合計ジャッジ時間 1,399 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES

#include <iostream>	//cin, cout
#include <vector>	//vector
#include <algorithm> //sort,min,max,count
#include <string>	//string,getline, to_string
#include <ios>		//fixed
#include <iomanip>	//setprecision
#include <utility> //swap, pair
#include <cstdlib>	//abs(int)
#include <cmath>	//sqrt,ceil,M_PI, pow, sin
#include <sstream>	//stringstream, getline
#include <numeric>	//gcd, accumlate
#include <deque>	//deque
#include <random>	//randam_device
#include <limits>	//numeric_limits

using namespace std;
constexpr long long int D_MOD = 1000000007;

inline bool Kadomatsu(int a, int b, int c) {

	if (a == b || b == c || c == a) {
		return false;
	}
	if (b == max({ a, b, c }) || b == min({ a, b, c })) {
		return true;
	}
	else {
		return false;
	}

}

int main() {

	vector<int> A(3), B(3), C(3), D(3);
	cin >> A[0] >> A[1] >> A[2] >> B[0] >> B[1] >> B[2];

	C = A;
	D = B;


	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < 3; j++) {
			swap(C[i], D[j]);
			if (Kadomatsu(C[0], C[1], C[2]) && Kadomatsu(D[0], D[1], D[2])) {
				cout << "Yes" << endl;
				return 0;
			}
			else {
				C = A;
				D = B;
			}
		}
	}

	cout << "No" << endl;

	return 0;
}
0