結果

問題 No.2622 Dam
ユーザー srjywrdnprkt
提出日時 2024-02-29 11:27:33
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 702 bytes
コンパイル時間 2,126 ms
コンパイル使用メモリ 192,328 KB
最終ジャッジ日時 2025-02-19 21:58:43
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);

    ll t, x, v, f1, f2, q, r, d;
    cin >> t;
    while (t--){
        cin >> v >> x >> f1 >> f2 >> q >> r;
        d = 0;
        //1回目:
        d += (f2-f1) * r;
        if (x+d > v){
            cout << "Overflow" << endl;
            continue;
        }
        d -= f1 * (q-r);
        if (x+d <= 0){
            cout << "Zero" << endl;
            continue;
        }
        //2回目以降
        if (d == 0) cout << "Safe" << endl;
        else if (d > 0) cout << "Overflow" << endl;
        else cout << "Zero" << endl;
    }

    return 0;
}
0