ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1795. Husband in a Shop

Can't figure out the "swap" part
Posted by NumbMoon 2 Jan 2017 18:20
Could anyone, please, explain it to me? I can't understand how to program it. I'm filling the "amount of name" for the storage in the shop and for the queue, then, for each human from the queue, I check, firstly, whether the shop has the product the customer needs to buy, and then, if the shop has it, I compare the amounts. But I have a problem in understanding the part where the shop doesn't have enough of the product and the customers switch places. Could anyone explain it to me?