I strongly rely on my "intuition". If my intuition is correct I can solve the problem very fast. Otherwise, I will fall into some solutions that seem right (but actually wrong). The worst thing is debugging takes too much time and upset me (affects other problems). It seems that I am the kind of guy that has strong "thinking inertia". Do you face a similar issue? How to improve? Would you please help me?
Take https://codeforces.me/contest/1779/submission/187786889 as an example. Is it just because I am stupid?
Auto comment: topic has been updated by div4only (previous revision, new revision, compare).
debugging isnt that important. focus on solving the problem
Yeah , I face a similar issue many times
i also did a same blunder mistake in C problem
That is not correct idea, you're taking every number that makes your subarray "not okay" i.e. $$$p < 0$$$, but imagine situation like this: you took one big number, let me say $$$10^9$$$, and you have a lot of subarrays that are less than zero and are close to zero. You see my point? You could've gotten rid out of all those prefixes with just making $$$10^9$$$ into $$$-10^9$$$, yet still you're taking every number on the way. You should pick them more greedily.
Btw, debugging is sometimes quite challenging. Whenever I strongly believe in correctness my solution and it still doesn't get accepted I write naive solutions, like for this you could've written O(2^n) solution and ran it on random tests with your main solution. Surely it would've found you a test case where it mismatches
Same problem in the last 2 contest problem A. "Falling into some solutions that seem right". I wrote a brute force code to find the wrong test case if after 15 mins I still couldn't solve it staring at my code and manually coming up with some cases. And that's when you know the contest is going to be disastrous when you start off problem A in this manner
Agree. On Codeforces If I am stuck on one problem the whole contest may become disastrous. And the absolute value of delta is too large, maybe -150 for a disastrous game.
It seems like you already know what the problem is — you rely too much on your intuition. So i know that this will be very hard to hear but you have to accept it.
Don't use your intuition when solving problems.
Ok let me just explain a bit more. I am not saying that you should completely give up your intuition during contests because that would be stupid. Intuition is a key factor in allowing your mind to do the right steps to solve the problem. However, that is the end of the intuition's usefulness. After you come up with certain observations and come up with a solution with your intuition, you now have to be objective and work out whether or not your solution will work. And at this point i think you become lazy and don't want to check the validity or correctness of your solution, as evidenced by the submission you linked.
So, in conclusion, allow your intuition to guide you to the solution. But after that, be rigorous in checking your solution — as rigorous as you can be. If your solution seems to be correct, then implement it, otherwise, discard it.
Good luck!
Thank you! Another problem is that I am not good at finding counterexamples to pseudo-solutions. Would you please help? Or I have to implement a random generator as Fanarill suggests?
No i would not suggest implementing random number generators, mainly because they take too long to implement.
But for finding counterexamples to pseudo-solutions, I can't really give you much guidance but I can give you one thing.
For my economics paper, I have 12 mark questions that ask a question like, "evaluate the statement: a higher minimum wage always benefit the economy". For this question, I have to write 2 paragraphs agreeing with the statement and 2 paragraphs disagreeing with the statement.
However, on top of this, i have to write a conclusion stating what the answer depends on. Most of my classmates struggle with this (but i don't ;))) which is why my economics teacher gave us the advice, "look at all of the paragraphs you wrote. Is what you wrote always true? If not, then you found something that it depends on!". For example, assume that one of my paragraphs said, "minimum wage will cause job losses". Now I have to think, Is this always true? Well no, if a company is willing to make lower profit margins, then job losses will not come with a minimum wage.
You must make the same observations with your code. Every piece of code you write will entail a piece of logic, a reason why you wrote that code. Now, all you have to think is, "is that piece of logic always true?". If it isn't true, then you found a counterexample, otherwise keep doing the same with all other lines of code.
I hope you understood the analogy. GL!