Poor implementation skills

Revision en1, by nichke, 2022-08-14 22:57:53

This may sound like a simple question to answer by saying simply solve more problems, but I'm looking for a more productive way, as I've already solved tons of problems.

So long story short, I've been trying to solve IOI 2022 D1P1 in a virtual contest for the last 4 hours on DMOJ and gave up 40 minutes before the ending of my session, as I was pissed by my poor implementation skills.

The plan went smooth — read problem, think about it for a while and implement what you get. I immediately went for finding solution to the N<300 subtask and it took me roughly ~40 minutes to get to it. And that's when hell begins, I've spent ~2.5 hours coding, testing and debugging my 50 line code that keeps producing wrong answer/does not compile. Once I've submitted, I thought cool, now I can try to optimize it down to N<3000.

In about 15-20 minutes of thinking I have a solution I believe should work (keep 3 dp arrays, with appropriate differences assigned to each of them, compress coordinates and use the same DP just instead of doing $$$O(N^3)$$$ keep the states down to roughly $$$O(N+M)$$$. Cool, I go to coding and finally rage quit after my code (in spoiler below) turns into a chaotic garbage that produces no correct answer. BTW I've tried to recreate the code by going line-by-line through my trivial DP and just changing up a bit and it went extremely bad.

Short code, which doesn't work
Naive DP

Now I'm wondering, how can I improve my implementation skill on large OI problems (this is not even close to being 'large', yet I've failed). Usually I don't have much problem doing a 30-40 lines problem, but this one really got me.

Is doing easy problems a better route perhaps than doing hard ones or should I focus on implementation heavy tasks exclusively? Thanks.

Tags implementation, practice

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English nichke 2022-08-14 22:57:53 5650 Initial revision (published)