結果

問題 No.360 増加門松列
ユーザー xuzijian629xuzijian629
提出日時 2018-10-31 16:26:48
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 689 bytes
コンパイル時間 2,122 ms
コンパイル使用メモリ 206,516 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-30 01:37:47
合計ジャッジ時間 3,115 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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