Monday, February 17, 2020

A frontier week

TopCoder SRM 778 took place last week (problems, results, top 5 on the left, my screencast, analysis). I and many others have come up with a O(k3) solution for the medium problem that was unexpected for the problemsetters, which however required some squeezing into the time limit with k=1000. I have used two main insights to do so:
  • A "backward" DP which computes a number based on previous numbers is faster than a "forward" DP that updates further numbers based on the already computed number, presumably because it does less memory writes and those writes are sequential.
  • C++ is faster than Java :)
The intended solution for the problem was actually much nicer than that. Here is the problem statement, after some unwrapping: you start in position 0 on a line, and can make jumps of integer size between 1 and k (k<=1000) to the right, increasing your position. You are given the costs of such jumps as c1c2, ..., ck. What is the minimum cost to reach position (m<=109)?


Open Cup 2019-20 Grand Prix of Gomel has then resumed the Open Cup season after the New Year break (results, top 5 on the left, analysis). Team Polish Mafia was just 100 penalty minutes ahead of Yuhao Du, who was seemingly competing alone. Congratulations to the Mafia but also very impressive from Yuhao!

Thanks for reading, and check back next week!

4 comments:

  1. If c++ is faster than java, why there are some people coding in java?

    ReplyDelete
  2. Lmao, you should ask him, he is a legendary using Java for many years. And I remember in WF2018 he used Java so that he avoided big integers which are troublesome in C++. Many other people were stuck at that time.

    ReplyDelete
  3. Heyy, Petr can you help me setup Kotlin for CHelper plugin? Many people are also looking for the same. Please reply @ rishabhdeepsingh98@gmail.com

    ReplyDelete
    Replies
    1. Petr can solve the problem with Java and switch it to Kotlin automatically.

      Delete