結果

問題 No.360 増加門松列
ユーザー kongarishisyamokongarishisyamo
提出日時 2016-04-22 18:28:01
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 614 bytes
コンパイル時間 494 ms
コンパイル使用メモリ 58,416 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-15 04:13:38
合計ジャッジ時間 2,969 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<iostream>
#include<algorithm>

using namespace std;

bool jud(int a,int b,int c){
	return a<c&&a!=b&&b!=c&&a!=c&&(min(a,min(b,c))==b||max(a,max(b,c))==b);
}

int main(){

	int D[7];

	for(int i=0;i<7;i++) cin>>D[i];

	for(int i=1234567;i<10000000;i++){
		int a[7];
		int b=i;
		for(int j=0;j<7;j++) a[j]=b%10,b/=10;
		bool f=true;
		for(int j=0;j<7;j++){
			for(int k=0;k<7;k++){
				if(j!=k&&a[k]==a[j]) f=false;
			}
		}
		if(f){
			f=true;
			for(int j=0;j<7-2;j++){
				if(!jud(D[a[j]],D[a[j+1]],D[a[j+2]])) f=false;
			}
			if(f){
				cout<<"YES"<<endl;
				return 0;
			}
		}
	}
	cout<<"NO"<<endl;
}
0