結果

問題 No.1366 交換門松列・梅
ユーザー Y_SY_S
提出日時 2021-01-29 21:29:23
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 3 ms / 1,000 ms
コード長 1,186 bytes
コンパイル時間 1,001 ms
コンパイル使用メモリ 99,124 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-17 10:25:50
合計ジャッジ時間 2,059 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 3 ms
5,376 KB
testcase_08 AC 3 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

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