結果

問題 No.1366 交換門松列・梅
コンテスト
ユーザー firiexp
提出日時 2021-04-27 15:09:10
言語 C++17
(gcc 15.2.0 + boost 1.90.0)
コンパイル:
g++-15 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 1 ms / 1,000 ms
+ 172µs
コード長 969 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 493 ms
コンパイル使用メモリ 117,696 KB
実行使用メモリ 9,372 KB
最終ジャッジ日時 2026-07-12 12:57:43
合計ジャッジ時間 1,543 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#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