結果
問題 | No.360 増加門松列 |
ユーザー |
![]() |
提出日時 | 2016-04-26 00:55:26 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 552 bytes |
コンパイル時間 | 549 ms |
コンパイル使用メモリ | 60,428 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-24 04:33:36 |
合計ジャッジ時間 | 1,313 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 22 |
ソースコード
#include <iostream> #include <sstream> #include <algorithm> #include <cstdio> using namespace std; int main(int argc, char *argv[]) { int a[7]; for (int i = 0; i < 7; ++i) { cin >> a[i]; } sort(a, a + 7); bool ans = false; do { int i; for (i = 2; i < 7; ++i) { int p = a[i - 2], q = a[i - 1], r = a[i]; if (p < r && ((q < p && q < r) || (q > p && q > r))) { ; } else { break; } } if (i >= 7) { ans = true; break; } } while (next_permutation(a, a + 7)); cout << (ans ? "YES" : "NO") << endl; return 0; }