結果

問題 No.281 門松と魔法(1)
ユーザー ayaoniayaoni
提出日時 2020-12-17 21:06:50
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 944 bytes
コンパイル時間 278 ms
コンパイル使用メモリ 81,776 KB
実行使用メモリ 65,940 KB
最終ジャッジ日時 2023-10-21 07:08:06
合計ジャッジ時間 4,567 ms
ジャッジサーバーID
(参考情報)
judge10 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,532 KB
testcase_01 AC 39 ms
53,532 KB
testcase_02 WA -
testcase_03 AC 40 ms
53,532 KB
testcase_04 AC 41 ms
53,532 KB
testcase_05 AC 37 ms
53,532 KB
testcase_06 AC 38 ms
53,532 KB
testcase_07 AC 39 ms
53,532 KB
testcase_08 AC 38 ms
53,532 KB
testcase_09 AC 39 ms
53,532 KB
testcase_10 AC 40 ms
53,532 KB
testcase_11 AC 38 ms
53,532 KB
testcase_12 AC 39 ms
53,532 KB
testcase_13 AC 39 ms
53,532 KB
testcase_14 AC 39 ms
53,532 KB
testcase_15 AC 39 ms
53,532 KB
testcase_16 AC 39 ms
53,532 KB
testcase_17 AC 39 ms
53,532 KB
testcase_18 AC 39 ms
53,532 KB
testcase_19 AC 39 ms
53,532 KB
testcase_20 AC 39 ms
53,532 KB
testcase_21 AC 39 ms
53,532 KB
testcase_22 AC 39 ms
53,532 KB
testcase_23 AC 39 ms
53,532 KB
testcase_24 AC 38 ms
53,532 KB
testcase_25 WA -
testcase_26 AC 39 ms
53,532 KB
testcase_27 AC 38 ms
53,532 KB
testcase_28 AC 39 ms
53,532 KB
testcase_29 AC 39 ms
53,532 KB
testcase_30 WA -
testcase_31 RE -
testcase_32 RE -
testcase_33 WA -
testcase_34 AC 39 ms
53,532 KB
testcase_35 WA -
testcase_36 AC 39 ms
53,532 KB
testcase_37 WA -
testcase_38 AC 39 ms
53,532 KB
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 RE -
testcase_44 AC 39 ms
53,532 KB
testcase_45 AC 39 ms
53,532 KB
testcase_46 AC 39 ms
53,532 KB
testcase_47 AC 39 ms
53,532 KB
testcase_48 AC 39 ms
53,532 KB
testcase_49 AC 39 ms
53,532 KB
testcase_50 RE -
testcase_51 WA -
testcase_52 AC 40 ms
53,532 KB
testcase_53 AC 39 ms
53,532 KB
testcase_54 RE -
testcase_55 AC 39 ms
53,532 KB
testcase_56 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def LS2(): return list(sys.stdin.readline().rstrip())


d = I()
H1,H2,H3 = I(),I(),I()

inf = 10**18
ans = inf

m = min(H1,H3)
a = 0
if H1 == H3:
    m -= d
    a += 1
if H2 < m:
    ans = min(ans,a)
elif m > 0:
    a += (H2-m)//d+1
    ans = min(ans,a)

b = 0
if H2 > 0:
    b += max(0,(H1-H2)//d+1)
    b += max(0,(H3-H2)//d+1)
    H1 = max(0,H1-d*max(0,(H1-H2)//d+1))
    H3 = max(0,H3-d*max(0,(H3-H2)//d+1))
    if H1 == H2:
        if H1 > 0:
            ans = min(ans,b+1)
    else:
        ans = min(ans,b)

print(ans if ans != inf else -1)
0