Facility Locations
Time limit1sMemory limit256 MB
Decide whether k candidate locations can be chosen so every client is served at zero cost.
- Level
Medium6 of 10
- Topics
- Union-find, Math
- Solved
- No attempts yet
Problem
A company has clients and must serve all of them by opening facilities. An open facility serves any number of clients, and every client is assigned to one open facility. There are candidate locations for the facilities. Serving client from candidate location costs a non-negative integer , and the costs satisfy a locality condition: for any clients and and any candidate locations and , holds.
The company eventually wants the cheapest way to open facilities. Right now it needs the answer to an earlier question. Decide whether it can open facilities and assign every client at a total cost of zero.
Input
The first line contains the integers , , , separated by spaces. (, , )
Line of the next lines contains non-negative integers, the -th of which is . ()
Output
Print yes if the company can open facilities and assign every client at a total cost of zero. Otherwise print no.