Submission #48114154


Source Code Expand

import math
import sys

sys.setrecursionlimit(210000)


def eprint(*args, **kwargs):
    print(
        '[EPRINT]',
        *args, file=sys.stderr, **kwargs)


def main() -> None:
    N, S, M, L = map(int, input().split())
    prices = [1000000] * (N + 13)
    prices[0] = 0

    for i in range(1, len(prices)):
        if i - 6 < 0:
            base = 0
        else:
            base = prices[i - 6]
        prices[i] = base + S
    eprint(prices)

    for i in range(1, len(prices)):
        if i - 8 < 0:
            base = 0
        else:
            base = prices[i - 8]
        prices[i] = min(base + M, prices[i])
    eprint(prices)

    for i in range(1, len(prices)):
        if i - 12 < 0:
            base = 0
        else:
            base = prices[i - 12]
        prices[i] = min(base + L, prices[i])
    eprint(prices)

    print(min(prices[N:]))


if __name__ == '__main__':
    main()

Submission Info

Submission Time
Task B - Buy One Carton of Milk
User takedarts
Language Python (PyPy 3.10-v7.3.12)
Score 200
Code Size 911 Byte
Status AC
Exec Time 55 ms
Memory 76640 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 25
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
random_01.txt AC 54 ms 76388 KiB
random_02.txt AC 54 ms 76480 KiB
random_03.txt AC 54 ms 76332 KiB
random_04.txt AC 53 ms 76288 KiB
random_05.txt AC 54 ms 76500 KiB
random_06.txt AC 54 ms 76588 KiB
random_07.txt AC 54 ms 76216 KiB
random_08.txt AC 54 ms 76516 KiB
random_09.txt AC 54 ms 76192 KiB
random_10.txt AC 54 ms 76492 KiB
random_11.txt AC 55 ms 76596 KiB
random_12.txt AC 55 ms 76620 KiB
random_13.txt AC 55 ms 76608 KiB
random_14.txt AC 54 ms 76324 KiB
random_15.txt AC 54 ms 76600 KiB
random_16.txt AC 54 ms 76496 KiB
random_17.txt AC 54 ms 76388 KiB
random_18.txt AC 54 ms 76620 KiB
random_19.txt AC 54 ms 76200 KiB
random_20.txt AC 54 ms 76628 KiB
random_21.txt AC 54 ms 76576 KiB
random_22.txt AC 54 ms 76552 KiB
sample_01.txt AC 54 ms 76352 KiB
sample_02.txt AC 54 ms 76560 KiB
sample_03.txt AC 54 ms 76640 KiB