結果

問題 No.3024 等式
ユーザー cielciel
提出日時 2017-04-22 22:37:45
言語 PyPy2
(7.3.13)
結果
TLE  
実行時間 -
コード長 516 bytes
コンパイル時間 1,771 ms
コンパイル使用メモリ 77,260 KB
実行使用メモリ 96,192 KB
最終ジャッジ日時 2023-09-28 21:34:23
合計ジャッジ時間 12,513 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 147 ms
82,532 KB
testcase_01 AC 145 ms
82,408 KB
testcase_02 AC 245 ms
85,728 KB
testcase_03 AC 243 ms
86,176 KB
testcase_04 AC 149 ms
82,768 KB
testcase_05 AC 144 ms
82,268 KB
testcase_06 AC 580 ms
89,008 KB
testcase_07 AC 556 ms
89,368 KB
testcase_08 AC 576 ms
88,212 KB
testcase_09 AC 148 ms
82,764 KB
testcase_10 AC 170 ms
83,104 KB
testcase_11 AC 318 ms
85,824 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]):
			for r in dfs(a[i+1:]):
				yield l+r
				yield l-r
				yield l*r
				if r!=0: yield Fraction(l,r)

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