結果
| 問題 |
No.550 夏休みの思い出(1)
|
| コンテスト | |
| ユーザー |
👑 Kazun
|
| 提出日時 | 2020-09-05 03:46:16 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,145 bytes |
| コンパイル時間 | 200 ms |
| コンパイル使用メモリ | 81,920 KB |
| 実行使用メモリ | 123,392 KB |
| 最終ジャッジ日時 | 2024-11-27 05:35:06 |
| 合計ジャッジ時間 | 51,757 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 38 RE * 1 TLE * 16 |
ソースコード
def General_Binary_Increase_Search(L,R,cond,Integer=True,ep=1/(1<<20)):
"""条件式が単調増加であるとき,一般的な二部探索を行う.
L:解の下限
R:解の上限
cond:条件(1変数関数,広義単調減少 or 広義単調減少を満たす)
Integer:解を整数に制限するか?
ep:Integer=Falseのとき,解の許容する誤差
"""
if not(cond(R)):
return False
if Integer:
R+=1
while R-L>1:
C=L+(R-L)//2
if cond(C):
R=C
else:
L=C
return R
else:
while (R-L)>=ep:
C=L+(R-L)/2
if cond(C):
R=C
else:
L=C
return R
#================================================
from math import sqrt,floor
A,B,C=map(int,input().split())
phi=-(A+sqrt(A*A-3*B))/3
alpha=General_Binary_Increase_Search(-10**9,phi,lambda x:C+x*(B+x*(A+x))>=0,False,1/(1<<30))
alpha=floor(alpha+1/2)
P=alpha+A
Q=alpha**2+A*alpha+B
D=P*P-4*Q
sqrt_D=floor(sqrt(D)+1/2)
beta=(-P-sqrt_D)//2
gamma=(-P+sqrt_D)//2
print(alpha,beta,gamma)
Kazun