結果
| 問題 |
No.360 増加門松列
|
| コンテスト | |
| ユーザー |
mogurocker
|
| 提出日時 | 2017-10-29 18:49:03 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 828 bytes |
| コンパイル時間 | 1,214 ms |
| コンパイル使用メモリ | 162,264 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-24 04:39:10 |
| 合計ジャッジ時間 | 1,931 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 22 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define FORR(x, arr) for(auto& x:arr)
#define ITR(x, c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;
typedef pair<int, int> P;
int main(int argc, char const *argv[]) {
ios_base::sync_with_stdio(false);
vector<int> v(7);
FOR(i, 7) cin >> v[i];
sort(ALL(v));
bool flag = false;
do {
bool ok = true;
FOR(i, 5) {
if (v[i] < v[i+2] && v[i+1]>v[i] && v[i+1]>v[i+2]) continue;
if (v[i] < v[i+2] && v[i+1]<v[i] && v[i+1]<v[i+2]) continue;
ok = false;
}
if (ok) flag = true;
} while (next_permutation(ALL(v)));
cout << (flag ? "YES" : "NO") << endl;
return 0;
}
mogurocker