結果
問題 | No.1151 チャレンジゲーム |
ユーザー |
|
提出日時 | 2020-08-09 03:55:01 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 724 bytes |
コンパイル時間 | 92 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 17,704 KB |
最終ジャッジ日時 | 2024-10-03 04:54:09 |
合計ジャッジ時間 | 20,589 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 TLE * 1 -- * 24 |
ソースコード
N=int(input()) A=[int(x) for x in input().split()] s=[0]*(1<<N) for i in range(1<<N): for j in range(N): if (i&(1<<j))>0: s[i]+=A[j] dp={} def f(a,b,t): if (a|b)==(1<<N)-1: return 1 if 2*s[a]+t>2*s[b] else 0 c=int((a|(b<<N))*t) if c in dp: return dp[c] ret=0 for i in range(N): na=a|(1<<i) if (na|b)==(a|b): continue e=1 for j in range(N): nb=b|(1<<j) if (a|nb)==(a|b): continue p,q=A[i],A[j] v=1/p-f(b,na,t*(-1))/p+f(a,nb,t)/q*(1-1/p) v/=(p+q-1)/(p*q) e=min(e,v) ret=max(ret,e) dp[c]=ret return ret print(f(0,0,-1))