結果

問題 No.360 増加門松列
ユーザー tkzw_21
提出日時 2016-06-29 15:30:18
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 568 bytes
コンパイル時間 1,769 ms
コンパイル使用メモリ 172,436 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-11 23:02:56
合計ジャッジ時間 2,596 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13 WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

bool is_kadomatu(int a1,int a2,int a3){
	if( a1 == a2 || a2 == a3 || a1 == a3 )return false;
	if( a2 > a1 && a2 > a3 || a2 < a1 && a2 < a3)return true;
	return false;
}

int main(void){
	vector<int> D(7);
	for(int i=0;i<7;i++){
		cin >> D[i];
	}

	sort(D.begin(),D.end());
	do{
		bool ok = true;
		for(int i=0;i<7-2;i++){
			if( !is_kadomatu(D[i],D[i+1],D[i+2]) )
				ok = false;
		}
		if(ok){
			cout << "YES" << endl;
			return 0;
		}
	}while(next_permutation(D.begin(),D.end()));

	cout << "NO" << endl;

	return 0;
}
0