結果
| 問題 |
No.846 メダル
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-09-27 04:21:57 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 35 ms / 2,000 ms |
| コード長 | 495 bytes |
| コンパイル時間 | 1,639 ms |
| コンパイル使用メモリ | 197,364 KB |
| 最終ジャッジ日時 | 2025-02-07 17:00:22 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 22 |
ソースコード
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
int main(){
cin.tie(0);
ios::sync_with_stdio(0);
ll P,Q,R,A,B,C; cin >> P >> Q >> R >> A >> B >> C;
tie(A, B, C) = make_tuple(A, A + B, A + B + C);
ll l = max({(A - 1) * P + 1, (B - 1) * Q + 1, (C - 1) * R + 1});
ll r = min({A * P, B * Q, C * R});
if(l > r) {
cout << -1 << endl;
} else {
cout << l << " " << r << endl;
}
}