結果

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

struct uns_t {} uns;
template <typename Element, typename Head, typename ...Args>
auto vec(Element init, Head arg, Args ...args) {
    if constexpr (sizeof...(Args) == 0) return std::vector(arg, init);
    else return std::vector(arg, vec(init, args...));
}
template <typename Element, typename Head, typename ...Args>
auto vec(uns_t, Head arg, Args ...args) {
    return vec(Element(), arg, args...);
}

int main() {
    int a[3], b[3];
    for (auto &e : a) cin >> e;
    for (auto &e : b) cin >> e;

    auto is_kadomatsu = [](int a, int b, int c) {
        return a != b && b != c && a != c && (min({ a, b, c }) == b || max({ a, b, c }) == b);
    };

    for (int i = 0; i < 3; ++i) {
        for (int j = 0; j < 3; ++j) {
            swap(a[i], b[j]);
            if (is_kadomatsu(a[0], a[1], a[2]) && is_kadomatsu(b[0], b[1], b[2])) {
                cout << "Yes" << endl;
                return 0;
            }
            swap(a[i], b[j]);
        }
    }

    cout << "No" << endl;
}

0