結果

問題 No.1366 交換門松列・梅
ユーザー firiexpfiriexp
提出日時 2021-04-27 15:09:10
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 3 ms / 1,000 ms
コード長 969 bytes
コンパイル時間 1,023 ms
コンパイル使用メモリ 102,800 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-17 10:35:41
合計ジャッジ時間 1,721 ms
ジャッジサーバーID
(参考情報)
judge1 / 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 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 3 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

bool IsKadomatsu(int a, int b, int c){
    if(a == b || b == c || c == a) return false;
    return max({a, b, c}) == b || min({a, b, c}) == b;
}
int main() {
    vector<int> a(3), b(3);
    for (auto &&i : a) scanf("%d", &i);
    for (auto &&i : b) scanf("%d", &i);
    for (int i = 0; i < 3; ++i) {
        for (int j = 0; j < 3; ++j) {
            swap(a[i], b[j]);

            if(IsKadomatsu(a[0], a[1], a[2]) && IsKadomatsu(b[0], b[1], b[2])){
                puts("Yes");
                return 0;
            }
            swap(a[i], b[j]);
        }
    }
    puts("No");
    return 0;
}
0