結果
問題 | No.2622 Dam |
ユーザー |
|
提出日時 | 2024-02-09 21:32:46 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 6 ms / 2,000 ms |
コード長 | 879 bytes |
コンパイル時間 | 4,593 ms |
コンパイル使用メモリ | 307,936 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-09-28 14:43:53 |
合計ジャッジ時間 | 5,023 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 5 |
ソースコード
#include<bits/stdc++.h>using namespace std;#include<atcoder/all>using namespace atcoder;#define rep(i,n) for (int i = 0; i < (n); ++i)using ld = long double;using ll = long long;template<class T> bool chmax(T &a, T b){if(a<b){a = b;return true;}return false;}template<class T> bool chmin(T &a, T b){if(a>b){a = b;return true;}return false;}using P = pair<int,int>;int main(){int T;cin >> T;while(T--){ll V, X, out, in, Q, R;cin >> V >> X >> out >> in >> Q >> R;ll a = X + (in-out)*R;if(a>V){cout << "Overflow" << endl;continue;}else if(a<=0){cout << "Zero" << endl;continue;}ll b = a - out*(Q-R);if(b==X){cout << "Safe" << endl;continue;}if(b>X){cout << "Overflow" << endl;continue;}if(b<X){cout << "Zero" << endl;continue;}}}