結果
| 問題 |
No.2622 Dam
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-02-09 21:28:49 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,278 bytes |
| コンパイル時間 | 1,915 ms |
| コンパイル使用メモリ | 190,880 KB |
| 最終ジャッジ日時 | 2025-02-19 03:16:21 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | WA * 5 |
ソースコード
#include "bits/stdc++.h"
using namespace std;
#define all(x) begin(x),end(x)
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }
template<typename T_container, typename T = typename enable_if<!is_same<T_container, string>::value, typename T_container::value_type>::type> ostream& operator<<(ostream &os, const T_container &v) { string sep; for (const T &x : v) os << sep << x, sep = " "; return os; }
#define debug(a) cerr << "(" << #a << ": " << a << ")\n";
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pi;
const int mxN = 1e5+1, oo = 1e9;
void solve() {
ll x,v; cin >> v >> x;
ll fo,fi; cin >> fo >> fi;
ll r,q; cin >> q >> r;
// increasing, than decreasing.
if(fo>=fi) {
cout << "Overflow\n";
return;
}
ll percycle = fo*q - fi*r;
ll minpercycle = fo*r-fi*r;
if(minpercycle+x<=0) {
cout << "Zero\n";
return;
}
if(percycle>0) {
cout << "Overflow\n";
} else if(percycle==0) cout << "Safe\n";
else cout << "Zero\n";
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t; cin >> t;
while(t--) solve();
}