結果

問題 No.360 増加門松列
ユーザー mamekin
提出日時 2016-04-17 23:14:28
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 1,059 bytes
コンパイル時間 1,426 ms
コンパイル使用メモリ 106,328 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-24 04:31:41
合計ジャッジ時間 2,037 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #
プレゼンテーションモードにする

#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;
bool checkKadomatsu(const vector<int>& a)
{
if(a[0] >= a[2])
return false;
return (a[0] < a[1] && a[2] < a[1]) || (a[0] > a[1] && a[2] > a[1]);
}
int main()
{
vector<int> a(7);
for(int i=0; i<7; ++i)
cin >> a[i];
sort(a.begin(), a.end());
do{
bool ok = true;
for(int i=0; i<7-2; ++i){
if(!checkKadomatsu(vector<int>(a.begin()+i, a.begin()+i+3)))
ok = false;
}
if(ok){
cout << "YES" << endl;
return 0;
}
}while(next_permutation(a.begin(), a.end()));
cout << "NO" << endl;
return 0;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0