結果
問題 | No.2622 Dam |
ユーザー |
![]() |
提出日時 | 2024-02-09 21:31:17 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 541 bytes |
コンパイル時間 | 3,083 ms |
コンパイル使用メモリ | 243,056 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-28 13:57:27 |
合計ジャッジ時間 | 3,101 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 5 |
ソースコード
#include <bits/stdc++.h>using namespace std;using ll = long long;ll V, X, Fo, Fi, Q, R;void solve(){cin >> V >> X >> Fo >> Fi >> Q >> R;ll a = (Fi - Fo) * R;ll b = (- Fo) * (Q - R);if(a + b > 0){cout << "Overflow\n";}else if(a + b == 0){cout << (X + a > V ? "Overflow\n" : "Safe\n");}else{cout << (X + a > V ? "Overflow\n" : "Zero\n");}}int main(void){ios::sync_with_stdio(false);cin.tie(nullptr);int t; cin >> t;while(t--)solve();return 0;}