結果

問題 No.2622 Dam
ユーザー inkyaman
提出日時 2024-03-24 11:06:36
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 7 ms / 2,000 ms
コード長 856 bytes
コンパイル時間 1,229 ms
コンパイル使用メモリ 117,792 KB
最終ジャッジ日時 2025-02-20 13:36:01
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 5
権限があれば一括ダウンロードができます

ソースコード

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