結果

問題 No.2622 Dam
ユーザー Fu_LFu_L
提出日時 2024-02-18 15:04:34
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 960 bytes
コンパイル時間 2,126 ms
コンパイル使用メモリ 201,644 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-02-18 15:04:37
合計ジャッジ時間 2,460 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define rep(i, a, b) for(ll i = a; i < b; ++i)
#define rrep(i, a, b) for(ll i = a; i >= b; --i)
constexpr ll inf = 4e18;
struct SetupIO {
    SetupIO() {
        ios::sync_with_stdio(0);
        cin.tie(0);
        cout << fixed << setprecision(30);
    }
} setup_io;
int main(void) {
    int T;
    cin >> T;
    while(T--) {
        ll v, x, fo, fi, q, r;
        cin >> v >> x >> fo >> fi >> q >> r;
        ll cur = x;
        cur += r * (fi - fo);
        if(cur <= 0) {
            cout << "Zero" << '\n';
        } else if(cur > v) {
            cout << "Overflow" << '\n';
        } else {
            cur -= (q - r) * fo;
            if(cur == x) {
                cout << "Safe" << '\n';
            } else if(cur > x) {
                cout << "Overflow" << '\n';
            } else {
                cout << "Zero" << '\n';
            }
        }
    }
}
0