結果
問題 |
No.2622 Dam
|
ユーザー |
![]() |
提出日時 | 2024-02-16 22:19:35 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 664 bytes |
コンパイル時間 | 459 ms |
コンパイル使用メモリ | 40,772 KB |
実行使用メモリ | 6,816 KB |
最終ジャッジ日時 | 2024-09-28 20:54:23 |
合計ジャッジ時間 | 695 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 5 |
ソースコード
/* -*- coding: utf-8 -*- * * 2622.cc: No.2622 Dam - yukicoder */ #include<cstdio> #include<algorithm> using namespace std; /* constant */ /* typedef */ typedef long long ll; /* global variables */ /* subroutines */ /* main */ int main() { int tn; scanf("%d", &tn); while (tn--) { ll v, x; int fo, fi, q, r; scanf("%lld%lld%d%d%d%d", &v, &x, &fo, &fi, &q, &r); ll s = x; s += (ll)(fi - fo) * r; if (s > v) { puts("Overflow"); continue; } s -= (ll)fo * (q - r); if (s <= 0) { puts("Zero"); continue; } if (s > x) puts("Overflow"); else if (s < x) puts("Zero"); else puts("Safe"); } return 0; }