結果

問題 No.846 メダル
ユーザー ninja
提出日時 2019-07-05 21:40:46
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 691 bytes
コンパイル時間 1,413 ms
コンパイル使用メモリ 165,580 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-06 21:15:19
合計ジャッジ時間 2,134 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ll p, q, r, a, b, c;
  cin >> p >> q >> r >> a >> b >> c;
  b += a;
  c += b;
  ll npmax = p * a;
  ll npmin = p * a - (p - 1);
  ll nqmax = q * b;
  ll nqmin = q * b - (q - 1);
  ll nrmax = r * c;
  ll nrmin = r * c - (r - 1);
  ll ansmin = max(npmin, max(nqmin, nrmin));
  ll ansmax = min(npmax, min(nqmax, nrmax));
  if (ansmin > ansmax) {
    cout << -1 << endl;
  } else {
    cout << ansmin << " " << ansmax << endl;
  }
  return 0;
}
0