結果
| 問題 | No.360 増加門松列 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-04-17 22:40:15 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 626 bytes |
| 記録 | |
| コンパイル時間 | 1,043 ms |
| コンパイル使用メモリ | 182,700 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-05-30 00:13:02 |
| 合計ジャッジ時間 | 2,053 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 22 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
bool isKadomatsu(long long x, long long y, long long z) {
if (x == y || y == z || x == z) return false;
if (x > y && y < z && x < z) return true;
if (x < y && y > z && x < z) return true;
return false;
}
bool solve() {
vector<int> a(7);
for (int i = 0; i < 7; i++) {
cin >> a[i];
}
sort(a.begin(), a.end());
do {
bool all = true;
for (int i = 0; i < 5; i++) {
all &= isKadomatsu(a[i], a[i + 1], a[i + 2]);
}
if (all) return true;
} while (next_permutation(a.begin(), a.end()));
return false;
}
int main() {
cout << (solve() ? "YES" : "NO") << endl;
}