結果
問題 | No.360 増加門松列 |
ユーザー |
![]() |
提出日時 | 2016-08-20 20:21:45 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 719 bytes |
コンパイル時間 | 701 ms |
コンパイル使用メモリ | 82,988 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-24 04:35:15 |
合計ジャッジ時間 | 1,445 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 22 |
ソースコード
#include <iostream> #include <fstream> #include <vector> #include <cstring> #include <string> #include <algorithm> #include <iomanip> using namespace std; bool kadomatsu(int a, int b, int c) { if(a == b || b == c || c == a) return false; return (a < b && c < b || a > b && c > b) && a < c; } int main() { cin.tie(0); ios::sync_with_stdio(false); vector<int> D(7); for(int i = 0; i < 7; i++) { cin >> D[i]; } sort(D.begin(), D.end()); do { bool flag = true; for(int i = 0; i <= 4; i++) { if(!kadomatsu(D[i], D[i + 1], D[i + 2])) { flag = false; break; } } if(flag) { cout << "YES" << endl; return 0; } } while(next_permutation(D.begin(), D.end())); cout << "NO" << endl; }