結果
問題 | No.281 門松と魔法(1) |
ユーザー | tktk_snsn |
提出日時 | 2020-06-06 13:10:36 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 707 bytes |
コンパイル時間 | 162 ms |
コンパイル使用メモリ | 10,924 KB |
実行使用メモリ | 8,336 KB |
最終ジャッジ日時 | 2023-08-25 00:36:00 |
合計ジャッジ時間 | 3,514 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 17 ms
7,868 KB |
testcase_01 | AC | 15 ms
7,908 KB |
testcase_02 | WA | - |
testcase_03 | AC | 16 ms
7,796 KB |
testcase_04 | AC | 16 ms
7,896 KB |
testcase_05 | AC | 15 ms
7,872 KB |
testcase_06 | AC | 16 ms
7,948 KB |
testcase_07 | AC | 15 ms
7,820 KB |
testcase_08 | AC | 15 ms
7,804 KB |
testcase_09 | AC | 16 ms
7,812 KB |
testcase_10 | AC | 15 ms
7,796 KB |
testcase_11 | AC | 16 ms
7,880 KB |
testcase_12 | AC | 16 ms
7,776 KB |
testcase_13 | AC | 16 ms
7,856 KB |
testcase_14 | AC | 15 ms
7,852 KB |
testcase_15 | AC | 15 ms
7,880 KB |
testcase_16 | AC | 15 ms
7,808 KB |
testcase_17 | AC | 15 ms
7,940 KB |
testcase_18 | AC | 16 ms
7,856 KB |
testcase_19 | AC | 15 ms
7,768 KB |
testcase_20 | AC | 15 ms
7,904 KB |
testcase_21 | AC | 16 ms
7,868 KB |
testcase_22 | AC | 16 ms
7,944 KB |
testcase_23 | AC | 16 ms
7,844 KB |
testcase_24 | AC | 15 ms
7,916 KB |
testcase_25 | WA | - |
testcase_26 | AC | 15 ms
7,904 KB |
testcase_27 | AC | 15 ms
7,800 KB |
testcase_28 | AC | 15 ms
7,952 KB |
testcase_29 | AC | 16 ms
7,912 KB |
testcase_30 | WA | - |
testcase_31 | RE | - |
testcase_32 | RE | - |
testcase_33 | WA | - |
testcase_34 | AC | 15 ms
7,816 KB |
testcase_35 | WA | - |
testcase_36 | AC | 15 ms
7,804 KB |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | WA | - |
testcase_41 | WA | - |
testcase_42 | WA | - |
testcase_43 | RE | - |
testcase_44 | AC | 16 ms
8,336 KB |
testcase_45 | AC | 16 ms
7,852 KB |
testcase_46 | AC | 16 ms
8,176 KB |
testcase_47 | AC | 15 ms
7,808 KB |
testcase_48 | AC | 16 ms
8,264 KB |
testcase_49 | AC | 16 ms
8,160 KB |
testcase_50 | RE | - |
testcase_51 | WA | - |
testcase_52 | AC | 15 ms
8,232 KB |
testcase_53 | AC | 16 ms
8,144 KB |
testcase_54 | WA | - |
testcase_55 | AC | 15 ms
7,872 KB |
testcase_56 | WA | - |
ソースコード
d = int(input()) H = [int(input()) for _ in range(3)] if H[0] == H[1] == 0: print(-1) exit() if H[1] == H[2] == 0: print(-1) exit() ans = [] # 真ん中を高く if H[1] > 0: cnt = 0 h1, h2, h3 = H if h1 >= h2: dif = h1 - h2 + 1 cnt += (dif + d - 1) // d if h3 >= h2: dif = h3 - h2 + 1 cnt += (dif + d - 1) // d ans.append(cnt) # 真ん中を低く if H[0] != 0 and H[2] != 0: cnt = 0 h1, h2, h3 = H if h2 >= h1: dif = h2 - h1 + 1 cnt += (dif + d - 1) // d h2 -= cnt * d h2 = max(0, h2) if h2 >= h3: dif = h2 - h3 + 1 cnt += (dif + d - 1) // d ans.append(cnt) print(min(ans))