結果

問題 No.360 増加門松列
ユーザー xuzijian629
提出日時 2018-10-31 16:26:48
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 689 bytes
コンパイル時間 1,716 ms
コンパイル使用メモリ 199,628 KB
最終ジャッジ日時 2025-01-06 15:13:51
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 9 WA * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using vi = vector<i64>;
using vvi = vector<vi>;

bool is_kadomatsu(vi as) {
    if (as[0] == as[1] || as[1] == as[2] || as[0] == as[2]) return false;
    return as[1] > max(as[0], as[2]) || as[1] < min(as[0], as[2]);
}

int main() {
    vi as(7);
    for (int i = 0; i < 7; i++) {
        cin >> as[i];
    }
    sort(as.begin(), as.end());
    do {
        for (int i = 0; i < 5; i++) {
            if (is_kadomatsu({as[i], as[i + 1], as[i + 2]})) {
                cout << "YES" << endl;
                return 0;
            }
        }
    } while (next_permutation(as.begin(), as.end()));

    cout << "NO" << endl;
}
0