Wine Trading in Gergovia
Time Limit: 1000MS | Memory Limit: 65536K | |
Total Submissions: 2770 | Accepted: 1248 |
Description
As you may know from the comic “Asterix and the Chieftain’s Shield”, Gergovia consists of one street, and every inhabitant of the city is a wine salesman. You wonder how this economy works? Simple enough: everyone buys wine from other inhabitants of the city. Every day each inhabitant decides how much wine he wants to buy or sell. Interestingly, demand and supply is always the same, so that each inhabitant gets what he wants.