結果

問題 No.2622 Dam
ユーザー inkyamaninkyaman
提出日時 2024-03-24 11:06:36
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 6 ms / 2,000 ms
コード長 856 bytes
コンパイル時間 1,428 ms
コンパイル使用メモリ 121,516 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-03-24 11:06:38
合計ジャッジ時間 2,118 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <math.h>
#include <cmath>
#include <stack>
#include <map>
#include <set>
#include <numeric>
#include <iomanip>
#include <climits>
#include <functional>
#include <cassert>
#include <tuple>
using namespace std;
using ll = long long;

int T;

int main() {

    cin >> T;
    vector<string> ans;
    while(T--) {
        ll V, X, Fo, Fi, Q, R;
        cin >> V >> X >> Fo >> Fi >> Q >> R;
        if((Fi-Fo)*R+X > V) ans.push_back("Overflow");
        else if(Fi*R-Fo*Q+X <= 0) ans.push_back("Zero");
        else {
            if(Fi*R-Fo*Q > 0) ans.push_back("Overflow");
            else if(Fi*R-Fo*Q < 0) ans.push_back("Zero");
            else ans.push_back("Safe");
        }
    }

    for(auto s : ans) cout << s << endl;

}
0