結果

問題 No.3024 等式
ユーザー cielciel
提出日時 2017-04-22 22:50:04
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 538 bytes
コンパイル時間 883 ms
コンパイル使用メモリ 10,812 KB
実行使用メモリ 14,188 KB
最終ジャッジ日時 2023-09-28 21:42:47
合計ジャッジ時間 9,885 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
9,612 KB
testcase_01 AC 31 ms
9,748 KB
testcase_02 AC 42 ms
9,816 KB
testcase_03 AC 42 ms
9,676 KB
testcase_04 AC 30 ms
9,716 KB
testcase_05 AC 31 ms
9,664 KB
testcase_06 AC 746 ms
9,712 KB
testcase_07 AC 768 ms
9,744 KB
testcase_08 AC 769 ms
9,720 KB
testcase_09 AC 38 ms
9,660 KB
testcase_10 AC 54 ms
9,712 KB
testcase_11 AC 49 ms
9,616 KB
testcase_12 TLE -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/python
from __future__ import print_function,division
from fractions import Fraction
import sys,itertools

def dfs(a):
	if len(a)<2: yield a[0]
	for i in range(len(a)-1):
		for l in dfs(a[:i+1]):
			if l==0: print('YES');exit(0)
			for r in dfs(a[i+1:]):
				if r==0: print('YES');exit(0)
				yield l+r
				yield l-r
				yield l*r
				yield Fraction(l,r)

n=int(sys.stdin.readline())
a=list(map(int,sys.stdin.readline().split()))
for b in itertools.permutations(a):
	for e in dfs(b):
		if e==0: print('YES');exit(0)
print('NO')
0