結果

問題 No.3024 等式
ユーザー cielciel
提出日時 2017-04-22 23:25:42
言語 PyPy2
(7.3.15)
結果
TLE  
実行時間 -
コード長 490 bytes
コンパイル時間 1,619 ms
コンパイル使用メモリ 77,264 KB
実行使用メモリ 103,376 KB
最終ジャッジ日時 2023-09-28 21:44:26
合計ジャッジ時間 17,052 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 142 ms
89,244 KB
testcase_01 AC 146 ms
82,284 KB
testcase_02 AC 162 ms
82,700 KB
testcase_03 AC 154 ms
82,564 KB
testcase_04 AC 142 ms
82,164 KB
testcase_05 AC 145 ms
82,208 KB
testcase_06 AC 376 ms
88,280 KB
testcase_07 AC 410 ms
89,856 KB
testcase_08 AC 417 ms
89,348 KB
testcase_09 AC 151 ms
82,100 KB
testcase_10 AC 157 ms
82,824 KB
testcase_11 AC 203 ms
84,096 KB
testcase_12 AC 1,357 ms
92,100 KB
testcase_13 AC 1,367 ms
90,644 KB
testcase_14 AC 1,433 ms
95,080 KB
testcase_15 AC 379 ms
90,184 KB
testcase_16 AC 146 ms
82,244 KB
testcase_17 AC 430 ms
89,924 KB
testcase_18 AC 149 ms
82,100 KB
testcase_19 AC 224 ms
85,236 KB
testcase_20 AC 281 ms
85,756 KB
testcase_21 AC 162 ms
83,180 KB
testcase_22 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/python
from __future__ import print_function
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:]):
				if l==r: print('YES');exit(0)
				if l<r: continue
				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): pass
print('NO')
0