結果

問題 No.846 メダル
ユーザー pionepione
提出日時 2019-07-05 22:47:21
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 82 ms / 2,000 ms
コード長 2,376 bytes
コンパイル時間 1,415 ms
コンパイル使用メモリ 161,648 KB
実行使用メモリ 128,836 KB
最終ジャッジ日時 2024-04-16 07:55:06
合計ジャッジ時間 4,232 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 55 ms
128,672 KB
testcase_01 AC 55 ms
128,636 KB
testcase_02 AC 55 ms
128,732 KB
testcase_03 AC 55 ms
128,676 KB
testcase_04 AC 82 ms
128,836 KB
testcase_05 AC 54 ms
128,712 KB
testcase_06 AC 54 ms
128,616 KB
testcase_07 AC 54 ms
128,720 KB
testcase_08 AC 55 ms
128,636 KB
testcase_09 AC 55 ms
128,644 KB
testcase_10 AC 54 ms
128,756 KB
testcase_11 AC 54 ms
128,676 KB
testcase_12 AC 55 ms
128,616 KB
testcase_13 AC 54 ms
128,700 KB
testcase_14 AC 55 ms
128,712 KB
testcase_15 AC 54 ms
128,608 KB
testcase_16 AC 55 ms
128,660 KB
testcase_17 AC 56 ms
128,676 KB
testcase_18 AC 55 ms
128,656 KB
testcase_19 AC 55 ms
128,832 KB
testcase_20 AC 56 ms
128,704 KB
testcase_21 AC 56 ms
128,636 KB
testcase_22 AC 55 ms
128,636 KB
testcase_23 AC 54 ms
128,608 KB
testcase_24 AC 55 ms
128,636 KB
testcase_25 AC 54 ms
128,716 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#define REP(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define REPS(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define RREP(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define RREPS(i, n) for (int i = ((int)(n)); i > 0; i--)
#define IREP(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define IREPS(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RVISORT(v) sort(v.begin(), v.end(), greater<int>());
#define ALL(v) v.begin(), v.end()

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using ll = long long;
using ul = unsigned long;

typedef long long ll;

template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }

const int mod=1e9+7;

struct mint {
  ll x;
  mint(ll x=0):x(x%mod){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
};

mint c[4005][4005];
void init() {
  c[0][0] = 1;
  for (int i = 0; i <= 4000; i++) {
    for (int j = 0; j <= i; j++) {
      c[i+1][j] += c[i][j];
      c[i+1][j+1] += c[i][j];
    }
  }
}
mint comb(int n, int k) {
  return c[n][k];
}

bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }

    return true;
}

int main()
{
  cin.tie( 0 );
  ios::sync_with_stdio( false );
	
  //init();

	ll p,q,r,a,b,c;
	cin>>p>>q>>r>>a>>b>>c;
	
  ll left = max(max(p*(a-1),q*(a+b-1)),r*(a+b+c-1)) + 1;
  ll right = min(min(p*a,q*(a+b)),r*(a+b+c));

	if(left>right){
    cout << -1 << endl;
  }else{
    cout << left << " " << right << endl;
  }

  return 0;
}
0