結果

問題 No.360 増加門松列
ユーザー 37kt_37kt_
提出日時 2016-04-20 10:46:23
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,743 bytes
コンパイル時間 1,196 ms
コンパイル使用メモリ 146,476 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-25 18:37:47
合計ジャッジ時間 1,963 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

/* template.cpp {{{ */
#include <bits/stdc++.h>
using namespace std;
#define GET_MACRO(a, b, c, d, NAME, ...) NAME
#define REP(...) GET_MACRO(__VA_ARGS__, REP_4, REP_3, REP_2, REP_1)(__VA_ARGS__)
#define REP_1(n) REP_2(i_, n)
#define REP_2(i, n) REP_3(i, 0, n)
#define REP_3(i, a, b) REP_4(i, a, b, 1)
#define REP_4(i, a, b, s) for (LL i = (a); i < (LL)(b); i += (LL)(s))
#define RREP(...) GET_MACRO(__VA_ARGS__, RREP_4, RREP_3, RREP_2, RREP_1)(__VA_ARGS__)
#define RREP_1(n) RREP_2(i_, n)
#define RREP_2(i, n) RREP_3(i, 0, n)
#define RREP_3(i, a, b) RREP_4(i, a, b, 1)
#define RREP_4(i, a, b, s) for (LL i = (LL)(b) - 1; i >= (LL)(a); i -= (LL)(s))
#define ALL(c) std::begin(c), std::end(c)
#define RALL(c) (c).rbegin(), (c).rend()
#define EB emplace_back
#define PB push_back
#define EF emplace_front
#define PF pop_front
#define MP std::make_pair
#define MT std::make_tuple
#define FS first
#define SC second
using LL = long long;
using UI = unsigned int;
using UL = unsigned long long;
using LD = long double;
template<typename T> using MinPQ = std::priority_queue<T, std::vector<T>, std::greater<T>>;
template<typename T> using MaxPQ = std::priority_queue<T, std::vector<T>, std::less<T>>;
template<typename T, typename U> void chmin(T &x, U y){ x = min<T>(x, y); }
template<typename T, typename U> void chmax(T &x, U y){ x = max<T>(x, y); }
/* }}} */

int a[7];

int main(){
  REP(i, 7) cin >> a[i];
  sort(ALL(a));
  bool r = false;
  do {
    bool f = true;
    REP(i, 5){
      f &= a[i] < a[i + 2];
      f &= a[i] > a[i + 1] || a[i + 1] > a[i + 2];
      f &= a[i] != a[i + 1];
      f &= a[i + 1] != a[i + 2];
      f &= a[i + 2] != a[i];
    }
    r |= f;
  } while (next_permutation(ALL(a)));
  cout << (r ? "YES\n" : "NO\n");
}
0