#C4580. Carry All Items
Carry All Items
Carry All Items
You are given a maximum weight limit \(W\) and \(N\) items that a player intends to carry. Each item has a predefined weight:
- Healing Potion: \(1\)
- Magic Scroll: \(2\)
- Sword: \(3\)
- Shield: \(4\)
Your task is to determine if the player can carry all the items without exceeding the weight limit. Print Yes
if possible, otherwise print No
.
inputFormat
The input is given from standard input and consists of multiple lines:
- The first line contains two integers \(W\) and \(N\) separated by a space, where \(W\) is the maximum weight limit and \(N\) is the number of items.
- The next \(N\) lines each contain the name of an item. The item name is one of the following: "Healing Potion", "Magic Scroll", "Sword", or "Shield".
outputFormat
Output a single line to standard output: Yes
if the total weight of the items does not exceed \(W\), otherwise No
.
10 5
Healing Potion
Magic Scroll
Sword
Healing Potion
Shield
No