結果

問題 No.846 メダル
ユーザー tanimani364tanimani364
提出日時 2019-12-07 02:25:01
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,496 bytes
コンパイル時間 1,115 ms
コンパイル使用メモリ 131,892 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-08-25 20:21:26
合計ジャッジ時間 2,214 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

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

ソースコード

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=INF;
    while(r-l>1){
      ll mid=(l+r)/2;
      if(C(mid))l=mid;
      else r=mid;
    }
    ll maxv=l;
    l=0;r=INF;
    while(r-l>1){
      ll mid=(l+r)/2;
      if(C2(mid))r=mid;
      else l=mid;
    }
    ll minv=r;
    if(minv>maxv||minv<1)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