nichke's blog

By nichke, history, 2 years ago, In English

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.

Full text and comments »

  • Vote: I like it
  • +40
  • Vote: I do not like it

By nichke, history, 3 years ago, In English

Hi CodeForces, yesterday I encountered problem 896C related to Chtholly Tree. My understanding of integrals is limited so the comment in the editorial wasn't of great help and I couldn't find any articles online discussing the complexity. I'd appreciate if someone would clearly derive the complexity of the algorithm provided the queries are uniformly distributed (preferably using elementary maths only). Thanks! Regards!

Full text and comments »

  • Vote: I like it
  • +49
  • Vote: I do not like it