結果

問題 No.846 メダル
ユーザー yyyy52yyyy52
提出日時 2019-07-05 22:33:29
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 892 bytes
コンパイル時間 1,359 ms
コンパイル使用メモリ 159,732 KB
実行使用メモリ 13,888 KB
最終ジャッジ日時 2024-04-16 07:50:25
合計ジャッジ時間 4,962 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 1 ms
6,940 KB
testcase_05 AC 1 ms
6,944 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 2 ms
6,944 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;
const long double PI = acos(-1);
typedef long long ll;
typedef pair<int64_t,int64_t> pll;
int dx[]={1,-1,0,0,1,-1,1,-1};
int dy[]={0,0,1,-1,1,-1,-1,1};
#define rep(i,a,b) for (int64_t i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
#define ALL(a) begin(a),end(a)
#define sz(s) (s).size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second

int main()
{
    ll p,q,r,a,b,c;
    cin>>p>>q>>r;
    cin>>a>>b>>c;
    double max1=p*a, min1=p*(a-1);
    for(max1;max1>min1;max1--)
    {
        ll au=ceil(max1/p),ag=ceil(max1/q-au),cu=ceil(max1/r-ag-au);
        if(au==a&&ag==b&&cu==c)break;
    }
    for(min1;min1<=max1;min1++)
    {
        ll au=ceil(min1/p),ag=ceil(min1/q-au),cu=ceil(min1/r-ag-au);
        if(au==a&&ag==b&&cu==c)break;
    }
    if(max1<min1)cout<<-1<<endl;
    else cout<<min1<<" "<<max1<<endl;
}
0