結果

問題 No.846 メダル
ユーザー noisy_noimin
提出日時 2019-07-05 21:35:35
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 909 bytes
コンパイル時間 684 ms
コンパイル使用メモリ 94,372 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-06 21:05:29
合計ジャッジ時間 1,441 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <bitset>

using namespace std;

using ll =  long long;
using Pll = pair<ll, ll>;
using Pii = pair<int, int>;

constexpr ll MOD = 1000000007;
constexpr long double EPS = 1e-10;
constexpr int dyx[4][2] = {
    { 0, 1}, {-1, 0}, {0,-1}, {1, 0}
};

int main() {
    std::ios::sync_with_stdio(0); cin.tie(0);
    ll p,q,r,a,b,c;
    cin >> p >> q >> r;
    cin >> a >> b >> c;
    b += a;
    c += b;

    ll maxans = min({a*p, b*q, c*r}), minans = max({(a-1)*p+1, (b-1)*q+1, (c-1)*r+1});

    if(maxans >= minans) {
        cout << minans << " " << maxans << endl;
    } else {
        cout << -1 << endl;
    }
}
0