結果

問題 No.846 メダル
ユーザー forest3forest3
提出日時 2020-03-30 14:23:44
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 592 bytes
コンパイル時間 2,203 ms
コンパイル使用メモリ 165,416 KB
実行使用メモリ 8,736 KB
最終ジャッジ日時 2023-09-02 20:15:37
合計ジャッジ時間 6,309 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main()
{
	long long P, Q, R, A, B, C;
	cin >> P >> Q >> R >> A >> B >> C;

	long long npmax = A * P;
	long long nqmax = (B + A) * Q;
	long long nrmax = (C + B + A) * R;
	long long ma = min( npmax, min( nqmax, nrmax ) );
	long long mi = INT64_MAX;
	long long n = ma;
	while( true ) {
		long long a =  (n + P - 1) / P;
		long long b = (n + Q - 1) / Q - a;
		long long c = (n + R - 1) / R - a - b;
		if( a != A || b != B || c != C ) break;
		mi = n;
		n--;
	}
	if( mi == INT64_MAX ) cout << -1 << endl;
	else cout << mi << " " << ma << endl;
}
0