結果
問題 | No.3024 等式 |
ユーザー | ciel |
提出日時 | 2017-04-22 22:37:32 |
言語 | Python2 (2.7.18) |
結果 |
TLE
|
実行時間 | - |
コード長 | 516 bytes |
コンパイル時間 | 550 ms |
コンパイル使用メモリ | 6,648 KB |
実行使用メモリ | 8,752 KB |
最終ジャッジ日時 | 2023-09-28 21:34:05 |
合計ジャッジ時間 | 14,657 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 24 ms
7,656 KB |
testcase_01 | AC | 23 ms
7,732 KB |
testcase_02 | AC | 56 ms
7,648 KB |
testcase_03 | AC | 56 ms
7,616 KB |
testcase_04 | AC | 25 ms
7,752 KB |
testcase_05 | AC | 24 ms
7,628 KB |
testcase_06 | AC | 2,152 ms
7,772 KB |
testcase_07 | AC | 2,191 ms
7,652 KB |
testcase_08 | AC | 2,221 ms
7,660 KB |
testcase_09 | AC | 26 ms
7,816 KB |
testcase_10 | AC | 33 ms
7,704 KB |
testcase_11 | AC | 223 ms
7,772 KB |
testcase_12 | TLE | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
ソースコード
#!/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')