CommonLounge is a community of learners who learn together. Get started with the featured resources above, ask questions and discuss related stuff with everyone.
[LEADGAME] Lead Game
Problem statement clarification:
Now I get it, I was misinterpreting question all this time. Actually after finish of each round, lead is not the difference between points of that round. But the lead is difference between the points achieved through all rounds including current round - Lakpa Tashi Bhutia
This is more optimum than the easy solution. In this solution, I don't have to calculate the cumulative sum for both players. I am just calculating the cumulative difference that is lead. If diff is positive p1 wins else p2 wins. Max lead will be the max |diff|.
The problems from https://opc.iarcs.org.in/ have been moved to https://www.codechef.com/IARCSJUD. The problems which were supposed to accept multiple solutions now have new checkers, and some wrong data has been fixed. So everything should hopefully be fine now. If you notice any issues please comment in the respective problem page.
Notes: This problem needs input-output optimization to run in time. If you are using C++ and you use cin to get your input, add these two lines to the beginning of the main function. You don't need to do anything if you use scanf.