On many problems, I think of the solution very quickly but often spend a long time fixing and debugging the code to do what I want. For https://mirror.codeforces.com/problemset/problem/1973/B, I thought of a sliding window technique to find all windows that satisfy the or condition which is O(n). Yet, it took me like an hour and multiple failed submissions to get an AC. Right now, it feels like I have the "brains"(ingenuity) but not the "brawn"(implementation skills) right now. Furthermore, when I'm spending more time debugging than constructing it feels like I'm somewhat wasting my time(also its not very fun lol). What should I do?
P.S: I know someone is going to comment on how long I have been doing cp. Yes, I have only being doing cp for 1.5 months, and yes I know my implementation will naturally get better over time. Still, I'm looking for any advice BESIDES that. Thank you.
Try to solve random problem rather then specific topic. To enhance your implementation skill you should solve constructive, implementation and math category problem.
One thing that helped me improve implementation was look at other people's codes if i face a problem that i struggled to implement. And the other thing is to solve easy problems just to train implementation. So problems that are your rating or 100/200 rating lower
Thanks! Also you hit expert in 1.5 months I feel dumb. Need to be more consistent I think.
Auto comment: topic has been updated by Negationist (previous revision, new revision, compare).
Pray to God.
pipe down lil bro
You cannot suppress the Truth for long.
I’m Christian my guy
Try the problems based on implemention and if you find it difficult see others code who had implemented it beautifully.you should make the difference upon your code and others code,and learn from it.
Use o1-mini. It's good enough to have brilliant ideas. AI will make boring implementations for you.
how does that improve his implementation skills?
Nowadays, it is essential for every competitive programmer to learn how to use AI effectively (for purposes of skills training). One can quickly verify their own algorithmic ideas without spending time on coding, or observe an AI implementation to learn coding techniques, similar to reading an editorial.
are you even allowed to use ai to implement your code? also i feel like if a problem was short, you could just implement it yourself and if it was long you probably shouldn't trust ai anyway
why shouldn't it be allowed, who can prohibit it? AI is specially trained to solve problems, including CP problems. You are free to use it in any way to improve your CP skills. Those who ignore AI will lose out in the long run.
it does not improve implementation but kills it .a lot of times u might struggle implementing but that builds the skill.if someone simply gives it to ai then he will not develop ability to simplify his complicated idea to simple code.plus it is also not fun .
Finding right prompts for AI is fun. One can get some theoretical inputs from AI, some formels necessary for the problem. After discussing possible solutions with AI, one can still decide if he struggles to write his own ugly code, which may be useful in CP context (but only in this context, because nobody will care about ability to code in few months, this skill will be no more asked like nobody needs "fast typists" now), or to observe a beautiful code written by AI, and learn from it.
I had your problem too. One thing that helped me was to slow down and carefully plan the solution by writing pseudocode for example, just have each step well-defined . And then transforming the pseudocode to actual code. It costs some time but also cuts the time of debugging and the wrong submissions. Moreover, when you actually make a mistake, it's instructive — not just some typo — and easier to spot.
After a while, you get to form solid patterns and you need less level of details in the pseudocode, or nothing at all.
As mentioned, looking at other people's code or in books like competitive programming handbook, let me accumulate tricks over time to do things in a better way.
There's a good Russian saying "measure 7 times and cut once". As a person who had the same problem I would highly recommend you to start thinking about solution in details. Figuring out how to solve a problem is not about "oh I guess dp will work here. will try to somehow implement it :/" and "sliding window should work here, its O(n)" but about understanding the algorithm (step by step instructions) and all parts of it (each step!).
Use your pen and notebook, try drawing (it will help you to connect your thoughts) and coding only after you're finished with previous steps.
However, I must admit that codeforces forces you to turn off your head and code just to get higher place in standings (because you should solve div2 AB really fast) so a lot of people chose to guess the solution what will not improve your skills in competitive programming.
The last advice: solve problems at atcoder, they are much better there. Good luck!
Can solve div 2 a/b in about 20 mins, but they dont have much substance so my typing speed doesnt matter