ps | |
---|---|
링크 | acmicpc.net/… |
출처 | BOJ |
문제 번호 | 13305 |
문제명 | 주유소 |
레벨 | 실버 4 |
분류 |
그리디 |
시간복잡도 | O(n) |
인풋사이즈 | n<=100,000 |
사용한 언어 | Python |
제출기록 | 46788KB / 104ms |
최고기록 | 92ms |
해결날짜 | 2022/02/08 |
"""Solution code for "BOJ 13305. 주유소".
- Problem link: https://www.acmicpc.net/problem/13305
- Solution link: http://www.teferi.net/ps/problems/boj/13305
Tags: [Greedy]
"""
INF = float('inf')
def main():
N = int(input()) # pylint: disable=unused-variable
distances = [int(x) for x in input().split()]
prices = [int(x) for x in input().split()]
min_price = INF
answer = 0
for price, distance in zip(prices, distances):
if price < min_price:
min_price = price
answer += min_price * distance
print(answer)
if __name__ == '__main__':
main()