結果

問題 No.846 メダル
ユーザー pekempey
提出日時 2019-07-05 21:35:07
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 563 bytes
コンパイル時間 1,571 ms
コンパイル使用メモリ 166,036 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-06 21:05:05
合計ジャッジ時間 2,497 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 21 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)

using namespace std;
using ll = long long;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ll P, Q, R, A, B, C;
  cin >> P >> Q >> R >> A >> B >> C;
  // A-1 < N/P <= A
  // A+B-1 < N/Q <= A+B
  // A+B+C-1 < N/R <= A+B+C
  ll mn = max({(A-1)*P, (A+B-1)*Q, (A+B+C-1)*R});
  ll mx = min({A*P, (A+B)*Q, (A+B+C)*R});
  if (mn + 1 >= mx) {
    cout << -1 << endl;
  } else {
    cout << mn+1 << ' ' << mx << endl;
  }
}
0