結果

問題 No.360 増加門松列
ユーザー tookunn_1213tookunn_1213
提出日時 2016-06-30 01:06:30
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 535 bytes
コンパイル時間 266 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-04-20 04:12:32
合計ジャッジ時間 1,489 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

D = [int(i) for i in input().split()]
L = len(D)
used = [False for i in range(L)]
S = [-1 for i in range(L)]
def dfs(n):
	if n == L:
		for i in range(L - 2):
			if (max(S[i:i + 2]) == S[i + 1] or min(S[i:i + 2]) == S[i + 1]) and S[i] < S[i + 2] and S[i] != S[i + 1] and S[i + 1] != S[i + 2]:
				return True
		return False
	for i in range(L):
		if used[i]:
			continue
		used[i] = True
		tmp = S[n]
		S[n] = D[i]
		if(dfs(n + 1)):
			return True
		used[i] = False
		S[n] = tmp
	return False
if dfs(0):
	print('YES')
else:
	print('NO')
0