結果
問題 | No.2622 Dam |
ユーザー |
![]() |
提出日時 | 2024-02-09 21:37:39 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 6 ms / 2,000 ms |
コード長 | 1,160 bytes |
コンパイル時間 | 3,526 ms |
コンパイル使用メモリ | 263,256 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-09-28 14:50:06 |
合計ジャッジ時間 | 3,918 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 5 |
ソースコード
#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::etemplate <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;}}}