結果

問題 No.550 夏休みの思い出(1)
ユーザー realDivineJKrealDivineJK
提出日時 2020-05-26 16:00:13
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 1,276 bytes
コンパイル時間 172 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 11,136 KB
最終ジャッジ日時 2024-04-21 04:20:57
合計ジャッジ時間 3,446 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
11,008 KB
testcase_01 AC 28 ms
11,008 KB
testcase_02 WA -
testcase_03 AC 27 ms
10,880 KB
testcase_04 AC 27 ms
11,008 KB
testcase_05 WA -
testcase_06 AC 27 ms
11,008 KB
testcase_07 AC 28 ms
10,880 KB
testcase_08 AC 26 ms
11,008 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 29 ms
10,880 KB
testcase_12 AC 28 ms
11,008 KB
testcase_13 AC 28 ms
10,880 KB
testcase_14 AC 27 ms
10,880 KB
testcase_15 AC 27 ms
11,008 KB
testcase_16 AC 28 ms
10,880 KB
testcase_17 AC 27 ms
11,008 KB
testcase_18 AC 27 ms
10,880 KB
testcase_19 AC 26 ms
11,008 KB
testcase_20 AC 27 ms
11,008 KB
testcase_21 AC 27 ms
11,008 KB
testcase_22 AC 28 ms
11,008 KB
testcase_23 AC 27 ms
11,008 KB
testcase_24 AC 28 ms
11,008 KB
testcase_25 AC 27 ms
11,008 KB
testcase_26 AC 27 ms
10,880 KB
testcase_27 AC 27 ms
11,008 KB
testcase_28 AC 27 ms
11,008 KB
testcase_29 AC 27 ms
11,008 KB
testcase_30 AC 27 ms
10,880 KB
testcase_31 AC 27 ms
10,880 KB
testcase_32 AC 28 ms
10,880 KB
testcase_33 AC 27 ms
11,008 KB
testcase_34 AC 28 ms
10,880 KB
testcase_35 AC 29 ms
11,008 KB
testcase_36 AC 27 ms
11,008 KB
testcase_37 AC 26 ms
10,880 KB
testcase_38 AC 27 ms
10,880 KB
testcase_39 AC 28 ms
11,008 KB
testcase_40 AC 28 ms
10,880 KB
testcase_41 AC 27 ms
11,008 KB
testcase_42 AC 27 ms
11,008 KB
testcase_43 AC 27 ms
10,880 KB
testcase_44 AC 26 ms
11,008 KB
testcase_45 AC 26 ms
10,880 KB
testcase_46 AC 26 ms
11,008 KB
testcase_47 AC 28 ms
11,008 KB
testcase_48 AC 28 ms
11,008 KB
testcase_49 AC 27 ms
11,008 KB
testcase_50 AC 28 ms
11,008 KB
testcase_51 AC 27 ms
11,008 KB
testcase_52 AC 27 ms
10,880 KB
testcase_53 AC 27 ms
11,008 KB
testcase_54 AC 27 ms
11,008 KB
testcase_55 AC 28 ms
11,008 KB
testcase_56 AC 28 ms
11,008 KB
testcase_57 AC 28 ms
11,008 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

a, b, c = map(int, input().split())
xmin, xmax = -int(1e9), int(1e9)
def f(x):
    return x**3 + a*x**2 + b*x + c
def dfdx(x):
    return 3*x**2 + 2*a*x + b
    
x0, x1 = 0, 0
if a % 3 == 0:
    x0 = -(a // 3)
    x1 = -(a // 3)
else:
    x0 = -(a // 3)
    x1 = -(a // 3) + 1
l, r = xmin, x0
d = (l + r) // 2
L, R = x1, xmax
D = (L + R) // 2
for i in range(100):
    if dfdx(d) >= 0:
        l = d
        d = (l + r) // 2
    else:
        r = d
        d = (l + r) // 2
    if dfdx(D) <= 0:
        L = D
        D = (L + R) // 2
    else:
        R = D
        D = (L + R) // 2
l1, r1 = xmin, d
d1 = (l1 + r1) // 2
l2, r2 = d+(dfdx(d)!=0), D
d2 = (l2 + r2) // 2
l3, r3 = D+(dfdx(D)!=0), xmax
d3 = (l3 + r3) // 2
for i in range(100):
    if f(d1) < 0:
        l1 = d1 + 1
        d1 = (l1 + r1) // 2
    else:
        if f(d1) == 0:
            break
        r1 = d1
        d1 = (l1 + r1) // 2
for i in range(100):
    if f(d2) >= 0:
        if f(d2) == 0:
            break
        l2 = d2
        d2 = (l2 + r2) // 2
    else:
        r2 = d2
        d2 = (l2 + r2) // 2
for i in range(100):
    if f(d3) < 0:
        l3 = d3 + 1
        d3 = (l3 + r3) // 2
    else:
        if f(d3) == 0:
            break
        r3 = d3
        d3 = (l3 + r3) // 2
print(d1, d2, d3)
0