結果

問題 No.846 メダル
ユーザー neterukunneterukun
提出日時 2020-03-08 19:09:03
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 865 bytes
コンパイル時間 1,194 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 52,736 KB
最終ジャッジ日時 2024-04-25 02:23:43
合計ジャッジ時間 2,144 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
51,968 KB
testcase_01 AC 35 ms
51,840 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 35 ms
51,968 KB
testcase_05 AC 35 ms
52,096 KB
testcase_06 AC 35 ms
52,096 KB
testcase_07 AC 35 ms
51,968 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 35 ms
52,352 KB
testcase_12 AC 37 ms
52,224 KB
testcase_13 AC 34 ms
52,096 KB
testcase_14 AC 36 ms
51,968 KB
testcase_15 AC 37 ms
51,968 KB
testcase_16 AC 35 ms
52,224 KB
testcase_17 WA -
testcase_18 AC 37 ms
51,968 KB
testcase_19 AC 34 ms
51,840 KB
testcase_20 AC 34 ms
52,224 KB
testcase_21 WA -
testcase_22 AC 35 ms
52,608 KB
testcase_23 AC 38 ms
52,352 KB
testcase_24 AC 40 ms
51,840 KB
testcase_25 AC 36 ms
51,840 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

p, q, r = map(int, input().split())
a, b, c = map(int, input().split())

def solve(mid):
    tmpa = -((-mid) // p)
    tmpb = -((-mid) // q) - tmpa
    tmpc = -((-mid) // r) - tmpa - tmpb
    if tmpa >= a and tmpb >= b and tmpc >= c:
        return True
    else:
        return False

def solve2(mid):
    tmpa = -((-mid) // p)
    tmpb = -((-mid) // q) - tmpa
    tmpc = -((-mid) // r) - tmpa - tmpb
    if tmpa <= a and tmpb <= b and tmpc <= c:
        return True
    else:
        return False
      
      
ok = 10 ** 18
ng = 0
while abs(ok - ng) > 1:
    mid = (ok + ng) // 2
    if solve(mid):
        ok = mid
    else:
        ng = mid
okmin = ok

ok = 0
ng = 10 ** 18
while abs(ok - ng) > 1:
    mid = (ok + ng) // 2
    if solve2(mid):
        ok = mid
    else:
        ng = mid
okmax = ok
if okmax >= okmin:
    print(okmin, okmax)
else:
    print(-1)
0