結果

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

ソースコード

diff #

#include <iostream>
#define llint long long

using namespace std;

llint p, q, r;
llint a, b, c;

int main(void)
{
	cin >> p >> q >> r >> a >> b >> c;
	
	llint L = max(max(p*(a-1)+1, q*(a+b-1)+1), r*(a+b+c-1)+1);
	llint R = min(min(p*a, q*(a+b)), r*(a+b+c));
	
	if(L > R) cout << -1 << endl;
	else cout << L << " " << R << endl;
	
	return 0;
}
0