結果
問題 | No.360 増加門松列 |
ユーザー |
|
提出日時 | 2016-06-20 15:57:50 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 639 bytes |
コンパイル時間 | 599 ms |
コンパイル使用メモリ | 65,872 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-24 04:34:37 |
合計ジャッジ時間 | 1,194 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 22 |
ソースコード
#include <iostream>#include <cstdio>#include <algorithm>#include <vector>using namespace std;bool is_kadomatsu(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> d(7);for (int i = 0; i < 7; i++) {cin >> d[i];}sort(d.begin(), d.end());int ok;do {ok = true;for (int i = 0; i < 5; i++) {if (d[i] < d[i+2] && is_kadomatsu(d[i], d[i+1], d[i+2])) {} else {ok = false;break;}}} while (!ok && next_permutation(d.begin(), d.end()));cout << (ok ? "YES" : "NO") << endl;return 0;}