結果

問題 No.2622 Dam
ユーザー loop0919loop0919
提出日時 2024-01-01 23:45:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 77 ms / 2,000 ms
コード長 559 bytes
コンパイル時間 292 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 67,980 KB
最終ジャッジ日時 2024-01-01 23:45:22
合計ジャッジ時間 1,530 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
53,460 KB
testcase_01 AC 71 ms
65,884 KB
testcase_02 AC 72 ms
65,884 KB
testcase_03 AC 71 ms
67,980 KB
testcase_04 AC 77 ms
67,980 KB
testcase_05 AC 76 ms
67,980 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    V, X, F_out, F_in, Q, R = map(int, input().split())
    
    assert 1 <= X <= V <= 10**18
    assert 1 <= F_out <= 10**9
    assert 1 <= F_in <= 10**9
    assert 1 <= R < Q <= 10**9
    
    F_sunny, F_rainy = - F_out, F_in - F_out
    
    if X + R * F_rainy > V:
        print("Overflow")
        return
    
    diff = R * F_rainy + (Q - R) * F_sunny
    if diff < 0:
        print("Zero")
    elif diff > 0:
        print("Overflow")
    else:
        print("Safe")

T = int(input())
assert 1 <= T <= 1000
for _ in range(T):
    solve()
0