結果

問題 No.2622 Dam
ユーザー tobbie
提出日時 2024-05-07 10:15:21
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 702 bytes
コンパイル時間 1,648 ms
コンパイル使用メモリ 166,196 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-30 02:01:04
合計ジャッジ時間 1,982 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long int;
#define TMAX 10000000000

int main() {
  int T;
  cin >> T;
  rep(i, T) {
    ll V, X;
    int Fo, Fi, Q, R;
    cin >> V >> X >> Fo >> Fi >> Q >> R;
    ll vo = Fo * (Q - R);
    ll vi = Fi * R - Fo * R;
    ll ve = (vi - vo) * (TMAX / Q);
    if (X - vo <= 0) {
      cout << "Zero" << endl;
      continue;
    }
    if (ve + X > V) {
      cout << "Overflow" << endl;
      continue;
    }
    if (ve + X <= 0) {
      cout << "Zero" << endl;
      continue;
    }
    if (ve + X > 0 && ve + X <= V) {
      cout << "Safe" << endl;
      continue;
    }
  }
  return 0;
}
0