結果

問題 No.2622 Dam
ユーザー ragna
提出日時 2024-02-09 21:37:39
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 6 ms / 2,000 ms
コード長 1,160 bytes
コンパイル時間 4,060 ms
コンパイル使用メモリ 250,012 KB
最終ジャッジ日時 2025-02-19 03:23:00
ジャッジサーバーID
(参考情報)
judge5 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 5
権限があれば一括ダウンロードができます

ソースコード

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