結果

問題 No.2622 Dam
ユーザー ayataka5ayataka5
提出日時 2024-02-09 21:58:07
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 646 bytes
コンパイル時間 1,930 ms
コンパイル使用メモリ 201,644 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-02-09 21:58:11
合計ジャッジ時間 2,630 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,676 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
    int T;
    cin >> T;
    while(T--) {
        long long V, X;
        int F0, F1, Q, R;
        cin >> V >> X >> F0 >> F1 >> Q >> R;
        long long A((long long)(F1 - F0) * (long long)R), B(-(long long)F0 * (long long)(Q - R));
        string ans;
        if(A + B == 0) { ans = "Safe"; }
        if(A + B < 0) {
            if(X + A <= V) { ans = "Zero"; }
            else { ans = "Overflow"; }
        }
        if(0 < A + B) {
            if(X + A + B <= 0) { ans = "Zero"; }
            else { ans = "Overflow"; }
        }
        cout << ans << endl;
    }
    return 0;
}
0