結果

問題 No.846 メダル
ユーザー oooooba
提出日時 2021-04-28 22:07:05
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 48 ms / 2,000 ms
コード長 747 bytes
コンパイル時間 4,699 ms
コンパイル使用メモリ 111,804 KB
最終ジャッジ日時 2025-01-21 01:57:15
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <array>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <optional>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

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