結果

問題 No.2622 Dam
ユーザー hiikunZ
提出日時 2024-07-14 07:55:12
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 6 ms / 2,000 ms
コード長 945 bytes
コンパイル時間 1,983 ms
コンパイル使用メモリ 194,516 KB
最終ジャッジ日時 2025-02-22 06:35:35
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
//#include<atcoder/all>
//using namespace atcoder;
using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
constexpr ll MAX = 2000000000000000000;
constexpr ld PI = 3.14159265358979;
constexpr ll MOD = 0;//2024948111;
ld dotorad(ld K){ return PI * K / 180.0; }
ld radtodo(ld K){ return K * 180.0 / PI; }
mt19937 mt;
void randinit(){ srand((unsigned)time(NULL));mt = mt19937(rand()); }
void solve(){
    ll V,X,Fout,Fin,Q,R;
    cin >> V >> X >> Fout >> Fin >> Q >> R;
    ll x = X;
    X -= R * Fout;
    X += R * Fin;
    if(X > V){
        cout << "Overflow" << endl;
        return;
    }
    X -= (Q - R) * Fout;
    if(X <= 0 || x > X){
        cout << "Zero" << endl;
    }
    else if(x < X){
        cout << "Overflow" << endl;
    }
    else{
        cout << "Safe" << endl;
    }
}
int main(){
    ll T;
    cin >> T;
    for(ll i = 0; i < T; i++) solve();
}
0