結果

問題 No.846 メダル
ユーザー tanimani364tanimani364
提出日時 2019-12-07 02:32:37
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,515 bytes
コンパイル時間 1,262 ms
コンパイル使用メモリ 130,780 KB
実行使用メモリ 4,512 KB
最終ジャッジ日時 2023-08-25 20:22:38
合計ジャッジ時間 2,405 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#include<regex>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 50;
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
using namespace std;

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

bool C(ll mid){
  ll x=(mid+p-1)/p;
  ll y=(mid+q-1)/q;
  ll z=(mid+r-1)/r;
  return (x<=a&&y<=a+b&&z<=a+b+c);
}

bool C2(ll mid){
  ll x=(mid+p-1)/p;
  ll y=(mid+q-1)/q;
  ll z=(mid+r-1)/r;
  return (x>=a&&y>=a+b&&z>=a+b+c);
}

void solve(){
    cin>>p>>q>>r;
    cin>>a>>b>>c;
    ll l=1,r=1e18+10000;
    cout<<r<<"\n";
    while(r-l>1){
      ll mid=(l+r)/2;
      if(C(mid))l=mid;
      else r=mid;
    }
    ll maxv=l;
    l=0;r=1e18;
    while(r-l>1){
      ll mid=(l+r)/2;
      if(C2(mid))r=mid;
      else l=mid;
    }
    ll minv=r;
    if(minv>maxv)cout<<-1<<"\n";
    else cout<<minv<<" "<<maxv<<"\n";
}
 
int main(){
	ios::sync_with_stdio(false);
    cin.tie(0);
	cout<<fixed<<setprecision(15);
	solve();
	return 0;
}
0