結果
| 問題 |
No.846 メダル
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-07-05 21:38:56 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 524 bytes |
| コンパイル時間 | 1,723 ms |
| コンパイル使用メモリ | 192,444 KB |
| 最終ジャッジ日時 | 2025-01-07 05:54:41 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 22 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
signed main() {
ios::sync_with_stdio(false);
int P, Q, R;
cin >> P >> Q >> R;
int A, B, C;
cin >> A >> B >> C;
long long lb = 0;
long long ub = 1e18;
lb = max(lb, 1LL * A * P - P + 1);
ub = min(ub, 1LL * A * P);
B += A;
lb = max(lb, 1LL * B * Q - Q + 1);
ub = min(ub, 1LL * B * Q);
C += B;
lb = max(lb, 1LL * C * R - R + 1);
ub = min(ub, 1LL * C * R);
if (ub < lb) cout << -1 << endl;
else cout << lb << " " << ub << endl;
return 0;
}