結果
問題 | No.360 増加門松列 |
ユーザー |
![]() |
提出日時 | 2019-08-23 19:42:34 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 893 bytes |
コンパイル時間 | 1,738 ms |
コンパイル使用メモリ | 170,204 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-13 14:47:25 |
合計ジャッジ時間 | 2,749 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 22 |
ソースコード
#include "bits/stdc++.h" #define ALL(obj) (obj).begin(),(obj).end() #define RALL(obj) (obj).rbegin(),(obj).rend() #define REP(i, n) for(int i = 0; i < (int)(n); i++) #define REPR(i, n) for(int i = (int)(n); i >= 0; i--) #define FOR(i,n,m) for(int i = (int)(n); i < int(m); i++) using namespace std; typedef long long ll; const int MOD = 1e9 + 7; const int INF = 1e9 + 6; const ll LLINF = 4e18; bool OK(const vector<int> &d) { REP(i, 5) { if (!(d[i] < d[i + 2] && ((d[i] < d[i + 1] && d[i + 1] > d[i + 2]) || (d[i] > d[i + 1] && d[i + 1] < d[i + 2])))) return false; } return true; } int main() { vector<int> d(7); REP(i, 7) cin >> d[i]; sort(ALL(d)); do { if (OK(d)) { puts("YES"); return 0; } } while (next_permutation(ALL(d))); puts("NO"); getchar(); getchar(); }