結果

問題 No.846 メダル
ユーザー toshiro_yanagi
提出日時 2025-04-11 15:49:33
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 39 ms / 2,000 ms
コード長 367 bytes
コンパイル時間 313 ms
コンパイル使用メモリ 12,160 KB
実行使用メモリ 10,496 KB
最終ジャッジ日時 2025-04-11 15:49:36
合計ジャッジ時間 2,307 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

from sys import maxsize as inf


def f(p, a):
    return p * (a - 1) + 1, p * a


[p, q, r], [a, b, c] = [map(int, input().split()) for _ in range(2)]

n_min, n_max = -inf, inf

for k, v in {p: a, q: a + b, r: a + b + c}.items():
    n1, n2 = f(k, v)
    n_min = max(n_min, n1)
    n_max = min(n_max, n2)
if n_min > n_max:
    print(-1)
else:
    print(n_min, n_max)
0