GERGOVIA - Wine trading in Gergovia

TLE


PLS USE STL IN YOUR CODE.
and bhut ganda code likha h bhai. (Hard to debug)
I suggest you to use two pointer approach in your code. where ith point will denote the selling point and jth point will denote purchasing point.
O(n) time complexity.
.
.
.
.
I think corner case ki vajah se infinite loop main jaa raha hoga.
If u can simplify your code then I could again try to debug your code.

Your code is also working on O(n) .
@tusharsk bhai dekhio agar code debug kar sake

Very Strict timing constraint, re frame your logic, and try to write it in simple form, this will help you to debug it.

1 Like

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. Take my trading potential quiz and get a custom report based on your unique strengths. What type of trader are you: colibri trader