結果

問題 No.360 増加門松列
ユーザー aa
提出日時 2016-07-09 03:08:28
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 465 bytes
コンパイル時間 395 ms
コンパイル使用メモリ 46,432 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-21 09:10:30
合計ジャッジ時間 1,493 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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 {
    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]) {
        ok = true;
      }
    }
  } while(next_permutation(d, d+7));
  puts(ok?"YES":"NO");
  return 0;
}










0