提出 #18570252
ソースコード 拡げる
import sys
def IN_I(): return int(sys.stdin.readline().rstrip())
def IN_LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def IN_S(): return sys.stdin.readline().rstrip()
def IN_LS(): return list(sys.stdin.readline().rstrip().split())
INF = float('inf')
MOD = 10**9 + 7
a, b, x, y = IN_LI()
if a == b or a - b == 1:
print(x)
elif a < b:
print(min((b-a)*y+x, (b-a)*2*x + x))
else:
print(min((a-b-1)*y+x, (a-b-1)*2*x + x))
提出情報
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 300 / 300 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | sample.txt, sample_2.txt, sample_3.txt |
| All | 18_18_40_79.txt, 18_18_40_81.txt, 1_100_100_100.txt, 1_100_33_65.txt, 1_100_33_67.txt, 1_100_50_100.txt, 1_100_99_99.txt, 77_7_25_49.txt, 77_7_25_51.txt, sample.txt, sample_2.txt, sample_3.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| 18_18_40_79.txt | AC | 70 ms | 61880 KiB |
| 18_18_40_81.txt | AC | 53 ms | 61968 KiB |
| 1_100_100_100.txt | AC | 49 ms | 61956 KiB |
| 1_100_33_65.txt | AC | 49 ms | 61972 KiB |
| 1_100_33_67.txt | AC | 52 ms | 61968 KiB |
| 1_100_50_100.txt | AC | 52 ms | 61900 KiB |
| 1_100_99_99.txt | AC | 51 ms | 61872 KiB |
| 77_7_25_49.txt | AC | 52 ms | 61960 KiB |
| 77_7_25_51.txt | AC | 49 ms | 61760 KiB |
| sample.txt | AC | 50 ms | 61976 KiB |
| sample_2.txt | AC | 51 ms | 61916 KiB |
| sample_3.txt | AC | 50 ms | 61748 KiB |