結果
問題 | No.1042 愚直大学 |
ユーザー |
👑 ![]() |
提出日時 | 2020-12-09 18:13:21 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 934 bytes |
コンパイル時間 | 318 ms |
コンパイル使用メモリ | 82,184 KB |
実行使用メモリ | 66,408 KB |
最終ジャッジ日時 | 2024-09-19 01:20:44 |
合計ジャッジ時間 | 4,274 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 2 TLE * 1 -- * 20 |
ソースコード
def General_Binary_Decrease_Search(L,R,cond,Integer=True,ep=1/(1<<20)):"""条件式が単調減少であるとき,一般的な二部探索を行う.L:解の下限R:解の上限cond:条件(1変数関数,広義単調減少 or 広義単調減少を満たす)Integer:解を整数に制限するか?ep:Integer=Falseのとき,解の許容する誤差"""if not(cond(L)):return Noneif cond(R):return Rif Integer:L-=1while R-L>1:C=L+(R-L)//2if cond(C):L=Celse:R=Creturn Lelse:while (R-L)>=ep:C=L+(R-L)/2if cond(C):L=Celse:R=Creturn Lfrom math import logP,Q=map(int,input().split())print(General_Binary_Decrease_Search(1,10**100,lambda x:x*x<P+Q*x*log(x,2),False,10**(-7)))