結果

問題 No.360 増加門松列
ユーザー a
提出日時 2016-07-09 03:11:00
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 511 bytes
コンパイル時間 459 ms
コンパイル使用メモリ 45,124 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-24 04:34:54
合計ジャッジ時間 1,072 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <algorithm>

using namespace std;

int d[7];

int main(void) {
  for (int i = 0; i < 7; i++) {
    scanf("%d", d+i);
  }
  sort(d, d+7);
  bool ok = false;
  do {
    bool o = true;
    for (int i = 1; i < 6; i++) {
      if (!(((d[i-1] < d[i] && d[i] > d[i+1]) ||
           (d[i-1] > d[i] && d[i] < d[i+1])) &&
            d[i-1] < d[i+1])) {
        o = false;
      }
    }
    if (o) ok = true;
  } while(next_permutation(d, d+7));
  puts(ok?"YES":"NO");
  return 0;
}










0