結果

問題 No.846 メダル
ユーザー claw88claw88
提出日時 2019-07-05 22:06:24
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,279 bytes
コンパイル時間 1,630 ms
コンパイル使用メモリ 162,552 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-16 07:24:49
合計ジャッジ時間 2,369 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;
#define mod 1000000007
#define dom 998244353
#define all(c) begin(c),end(c)
#define rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
template <typename T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template <typename T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }
#define long long long
#define List vector
#define var auto
#define Count size()
#define Length size()
int dd[] = { 0, 1, 0, -1, 0 }; //→↓←↑

void solve()
{
	long P, Q, R, A, B, C;
	cin >> P >> Q >> R >> A >> B >> C;
	bool flag = true;

	long MAX = P * A;
	long MIN = P * (A - 1) + 1;

	//cout << MIN << " " << MAX << endl;


	long tmp = Q * (A + B);
	MAX = max(MAX, tmp);


	tmp = Q * (A + B - 1) + 1;
	MIN = min(MIN, tmp);

	//cout << MIN << " " << MAX << endl;


	tmp = R * (A + B + C);
	MAX = max(MAX, tmp);

	tmp = R * (A + B + C - 1) + 1;
	MIN = min(MIN, tmp);

	//cout << MIN << " " << MAX << endl;


	if (MIN > MAX)
	{
		flag = false;
	}

	if (flag)
	{
		cout << MIN << " " << MAX << endl;
	}
	else
	{
		cout << "-1" << endl;
	}
}

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	solve();
	return 0;
}
0