結果
| 問題 |
No.550 夏休みの思い出(1)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-09-11 20:21:22 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,936 bytes |
| コンパイル時間 | 91 ms |
| コンパイル使用メモリ | 12,928 KB |
| 実行使用メモリ | 11,136 KB |
| 最終ジャッジ日時 | 2024-07-02 16:50:24 |
| 合計ジャッジ時間 | 3,832 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 RE * 28 |
ソースコード
def check(x, A, B, C):
return x * x * x + A * x * x + B * x + C >= 0
def strictCheck(x, A, B, C):
return x * x * x + A * x * x + B * x + C == 0
ans = []
A, B, C = map(int, input().split())
imax = int(1e18)
imin = -int(1e18)
while(imax - imin > 1):
imid = (imax+imin)//2
if(check(imid, A, B, C)):
imax = imid
else:
imin = imid
if(strictCheck(imax, A, B, C)):
ans.append(imax)
imin = imax
imax = int(1e18)
while(imax - imin > 1):
imid = (imax+imin)//2
if(check(imid, A, B, C)):
imax = imid
else:
imin = imid
if(strictCheck(imax, A, B, C)):
ans.append(imax)
imin = imax
imax = int(1e18)
while(imax - imin > 1):
imid = (imax+imin)//2
if(check(imid, A, B, C)):
imax = imid
else:
imin = imid
if(strictCheck(imax, A, B, C)):
ans.append(imax)
imax = int(1e18)
imin = -int(1e18)
while(imax - imin > 1):
imid = (imax+imin)//2
if(check(imid, A, B, C)):
imax = imid
else:
imin = imid
if(strictCheck(imax, A, B, C)):
ans.append(imax)
imax = imax - 1
imin = -int(1e18)
while(imax - imin > 1):
imid = (imax+imin)//2
if(check(imid, A, B, C)):
imax = imid
else:
imin = imid
if(strictCheck(imax, A, B, C)):
ans.append(imax)
imax = imax - 1
imin = -int(1e18)
while(imax - imin > 1):
imid = (imax+imin)//2
if(check(imid, A, B, C)):
imax = imid
else:
imin = imid
if(strictCheck(imax, A, B, C)):
ans.append(imax)
ans = sorted(list(set(ans)))
if(len(ans) == 2):
imax = ans[0]
imin = ans[1] - 1
while(imin - imax > 1):
imid = (imax+imin)//2
if(check(imid, A, B, C)):
imax = imid
else:
imin = imid
if(strictCheck(imax, A, B, C)):
ans.append(imax)
if(strictCheck(imin, A, B, C)):
ans.append(imin)
ans = sorted(list(set(ans)))
print(ans[0], ans[1], ans[2])