Problem F
A Feast For Cats

Your crazy aunt has asked you to watch her cats while she’s attending a seminar about making cat hats out of cat fur. Your aunt owns a great number of cats – all toms – and, due to the complex social structure of cats, every cat has a specific but different amount of hate reserved for every other cat.
Over the years, the cats have been spoiled to the point that
they demand (at the least)
The task is complicated by three things:
-
Your aunt has a limited amount of milk stored in the fridge.
-
For each pair of cats, there is a distance they have to be kept from each other to avoid infighting.
-
The excessive amount of meowing has driven you to drink large amounts of hard liquor, and now you can’t move liquids without constant spilling. You will spill
milliliter of the milk you carry for every meter you walk.
Given an amount of milk, and a set of cats – each pair of
cats being a given distance apart from each other – determine
if it’s possible to feed every cat at least
Input
The first line of the input consists of a single integer
Each of the following
This is followed by
-
-
-
-
-
Cats co-exist in dimensions far greater than our three, so you can assume that every pair of cats is correctly separated by exactly the given distance.
Output
Output yes if it’s possible to
serve every cat at least
Sample Input 1 | Sample Output 1 |
---|---|
1 20 5 0 1 4 0 2 3 0 3 10 0 4 15 1 2 7 1 3 3 1 4 5 2 3 4 2 4 3 3 4 8 |
yes |