結果

問題 No.846 メダル
ユーザー _KingdomOfMoray_KingdomOfMoray
提出日時 2019-12-24 23:04:19
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 31 ms / 2,000 ms
コード長 977 bytes
コンパイル時間 126 ms
コンパイル使用メモリ 12,020 KB
実行使用メモリ 10,196 KB
最終ジャッジ日時 2023-10-23 21:27:40
合計ジャッジ時間 2,158 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,196 KB
testcase_01 AC 29 ms
10,196 KB
testcase_02 AC 29 ms
10,196 KB
testcase_03 AC 30 ms
10,196 KB
testcase_04 AC 30 ms
10,196 KB
testcase_05 AC 29 ms
10,196 KB
testcase_06 AC 29 ms
10,196 KB
testcase_07 AC 30 ms
10,196 KB
testcase_08 AC 31 ms
10,196 KB
testcase_09 AC 29 ms
10,196 KB
testcase_10 AC 30 ms
10,196 KB
testcase_11 AC 30 ms
10,196 KB
testcase_12 AC 30 ms
10,196 KB
testcase_13 AC 30 ms
10,196 KB
testcase_14 AC 29 ms
10,196 KB
testcase_15 AC 29 ms
10,196 KB
testcase_16 AC 29 ms
10,196 KB
testcase_17 AC 29 ms
10,196 KB
testcase_18 AC 29 ms
10,196 KB
testcase_19 AC 29 ms
10,196 KB
testcase_20 AC 30 ms
10,196 KB
testcase_21 AC 30 ms
10,196 KB
testcase_22 AC 29 ms
10,196 KB
testcase_23 AC 30 ms
10,196 KB
testcase_24 AC 29 ms
10,196 KB
testcase_25 AC 31 ms
10,196 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def max(a, b):
    return a if a >= b else b

def min(a, b):
    return a if a <= b else b

pqr_list = list(map(int,input().split()))
abc_list = list(map(int,input().split()))

p, q, r = pqr_list
a, b, c = abc_list

gold_range = [(a-1) * p, a * p]
silver_range = [(a+b-1) * q, (a+b) * q]
bronze_range = [(a+b+c-1) * r, (a+b+c) * r]
gs_range = [0] * 2
gsb_range = [0] * 2

res = []
if gold_range[0] < silver_range[1] and silver_range[0] < gold_range[1]:
    gs_range[0] = max(gold_range[0], silver_range[0])
    gs_range[1] = min(gold_range[1], silver_range[1])
    
    if gs_range[0] < bronze_range[1] and bronze_range[0] < gs_range[1]:
        gsb_range[0] = max(gs_range[0], bronze_range[0])
        gsb_range[1] = min(gs_range[1], bronze_range[1])
        
        res.append(gsb_range[0])
        res.append(gsb_range[1])
    else:
        res.append(-1)
else:
    res.append(-1)
    
if len(res) == 1:
    print(res[0])
else:
    print('{} {}'.format(res[0] + 1, res[1]))
0