結果
問題 |
No.360 増加門松列
|
ユーザー |
|
提出日時 | 2016-04-17 23:21:44 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 948 bytes |
コンパイル時間 | 694 ms |
コンパイル使用メモリ | 65,668 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-04 10:54:43 |
合計ジャッジ時間 | 1,299 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 13 WA * 9 |
ソースコード
#include <iostream> #include <algorithm> #include <vector> int max3(int a, int b, int c){ return std::max(a, std::max(b, c)); } int min3(int a, int b, int c){ return std::min(a, std::min(b, c)); } bool diff3(int a, int b, int c){ return (a!=b && b!=c && c!=a); } bool isKadomatsu(int a, int b, int c){ return (diff3(a, b, c) && (b==max3(a, b, c) || b==min3(a, b, c))); } int main(){ std::ios::sync_with_stdio(false); std::cin.tie(0); std::vector<int> d(7); for(auto& i : d){ std::cin >> i; } std::sort(d.begin(), d.end()); do{ bool flag=true; for(int i=0; i<5; ++i){ if(!isKadomatsu(d[i], d[i+1], d[i+2])){ flag=false; break; } } if(flag){ std::cout << "YES\n"; return 0; } }while(std::next_permutation(d.begin(), d.end())); std::cout << "NO\n"; return 0; }