結果

問題 No.360 増加門松列
ユーザー tkzw_21tkzw_21
提出日時 2016-06-29 15:30:18
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 568 bytes
コンパイル時間 1,933 ms
コンパイル使用メモリ 168,064 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-20 04:07:24
合計ジャッジ時間 2,187 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 WA -
testcase_05 AC 2 ms
5,376 KB
testcase_06 WA -
testcase_07 AC 1 ms
5,376 KB
testcase_08 WA -
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 WA -
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 1 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 1 ms
5,376 KB
testcase_21 WA -
権限があれば一括ダウンロードができます

ソースコード

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