結果

問題 No.2622 Dam
ユーザー ragnaragna
提出日時 2024-02-09 21:37:39
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 6 ms / 2,000 ms
コード長 1,160 bytes
コンパイル時間 4,423 ms
コンパイル使用メモリ 262,632 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-02-09 21:37:45
合計ジャッジ時間 4,060 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 6 ms
6,676 KB
testcase_05 AC 6 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#include<atcoder/all>
using namespace atcoder;
using mint=modint998244353;
using namespace std;
using ll=long long;
using ull=unsigned long long;
#define rep(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rrep(i,a,b) for(ll i=(ll)(a-1);i>=(ll)(b);i--)
#define MOD 998244353
//#define MOD 1000000007
#define INF 1e18
#define Pair pair<ll,ll>
//#define PI numbers::pi
//#define E numbers::e
template <typename T> bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template <typename T> bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};

int main(){
    ll t; cin >> t;
    while(t--){
        ll v,x,fo,fi,q,r; cin >> v >> x >> fo >> fi >> q >> r;
        if(fi<=fo){
            cout << "Zero" << endl;
            continue;
        }
        ll d=r*fi-q*fo;
        if(d>0){
            cout << "Overflow" << endl;
        }
        else if(d==0){
            if(v<x+r*(fi-fo)) cout << "Overflow" << endl;
            else cout << "Safe" << endl;
        }
        else{
            if(v<x+r*(fi-fo)) cout << "Overflow" << endl;
            else cout << "Zero" << endl;
        }
    }
}
0