結果

問題 No.550 夏休みの思い出(1)
ユーザー 👑 nu50218nu50218
提出日時 2019-09-11 20:21:22
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 1,936 bytes
コンパイル時間 661 ms
コンパイル使用メモリ 11,108 KB
実行使用メモリ 8,536 KB
最終ジャッジ日時 2023-09-15 13:54:03
合計ジャッジ時間 4,616 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 16 ms
8,416 KB
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 AC 17 ms
8,480 KB
testcase_09 RE -
testcase_10 RE -
testcase_11 AC 16 ms
8,320 KB
testcase_12 AC 16 ms
8,320 KB
testcase_13 AC 16 ms
8,320 KB
testcase_14 RE -
testcase_15 AC 16 ms
8,152 KB
testcase_16 AC 16 ms
8,332 KB
testcase_17 AC 16 ms
8,320 KB
testcase_18 AC 17 ms
8,408 KB
testcase_19 AC 16 ms
8,476 KB
testcase_20 RE -
testcase_21 AC 16 ms
8,528 KB
testcase_22 RE -
testcase_23 AC 16 ms
8,456 KB
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 AC 17 ms
8,396 KB
testcase_29 RE -
testcase_30 RE -
testcase_31 AC 17 ms
8,300 KB
testcase_32 AC 17 ms
8,460 KB
testcase_33 RE -
testcase_34 AC 17 ms
8,276 KB
testcase_35 RE -
testcase_36 RE -
testcase_37 AC 17 ms
8,420 KB
testcase_38 RE -
testcase_39 AC 16 ms
8,320 KB
testcase_40 AC 16 ms
8,320 KB
testcase_41 AC 17 ms
8,476 KB
testcase_42 RE -
testcase_43 AC 17 ms
8,148 KB
testcase_44 RE -
testcase_45 RE -
testcase_46 AC 16 ms
8,300 KB
testcase_47 RE -
testcase_48 AC 17 ms
8,304 KB
testcase_49 AC 16 ms
8,428 KB
testcase_50 AC 16 ms
8,412 KB
testcase_51 AC 16 ms
8,244 KB
testcase_52 AC 16 ms
8,420 KB
testcase_53 RE -
testcase_54 AC 17 ms
8,308 KB
testcase_55 RE -
testcase_56 AC 16 ms
8,520 KB
testcase_57 AC 17 ms
8,416 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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])
0