結果

問題 No.846 メダル
ユーザー toto6114
提出日時 2019-09-27 20:42:37
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 394 bytes
コンパイル時間 658 ms
コンパイル使用メモリ 84,592 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-24 20:21:03
合計ジャッジ時間 1,501 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<vector>
#include<map>
using namespace std;
typedef long long ll;
int main() {
  ll p,q,r,a,b,c,m,M;
  cin >> p >> q >> r >> a >> b >> c;
  m=max({(a-1)*p+1,(a+b-1)*q+1,(a+b+c-1)*r+1});
  M=min({a*p,(a+b)*q,(a+b+c)*r});
  if(m>M) {
      cout << -1 << endl;
  }
  else {
      cout << m << " " << M << endl;
  }
}
0