結果

問題 No.3024 等式
ユーザー cielciel
提出日時 2017-04-22 22:49:56
言語 PyPy2
(7.3.15)
結果
TLE  
実行時間 -
コード長 538 bytes
コンパイル時間 166 ms
コンパイル使用メモリ 77,760 KB
実行使用メモリ 98,628 KB
最終ジャッジ日時 2023-09-28 21:36:55
合計ジャッジ時間 10,979 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 150 ms
82,584 KB
testcase_01 AC 150 ms
82,124 KB
testcase_02 AC 250 ms
84,632 KB
testcase_03 AC 259 ms
86,000 KB
testcase_04 AC 150 ms
82,180 KB
testcase_05 AC 150 ms
82,324 KB
testcase_06 AC 592 ms
87,408 KB
testcase_07 AC 624 ms
91,812 KB
testcase_08 AC 597 ms
87,984 KB
testcase_09 AC 211 ms
84,308 KB
testcase_10 AC 304 ms
85,876 KB
testcase_11 AC 287 ms
86,848 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