結果

問題 No.846 メダル
ユーザー chocorusk
提出日時 2019-03-25 12:04:13
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 699 bytes
コンパイル時間 814 ms
コンパイル使用メモリ 99,548 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-06 20:51:16
合計ジャッジ時間 1,884 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
    ll p, q, r, a, b, c;
    cin>>p>>q>>r;
    cin>>a>>b>>c;
    b+=a; c+=b;
    ll mn=max({(a-1)*p+1, (b-1)*q+1, (c-1)*r+1});
    ll mx=min({a*p, b*q, c*r});
    if(mn>mx) cout<<-1<<endl;
    else cout<<mn<<" "<<mx<<endl;
    return 0;
}
0