Liuxizai's blog

By Liuxizai, history, 2 weeks ago, In English

The TopCoder Arena has been closed. But we can still obtain the testdata from Topcoder Archives. So I wonder if anyone has built a mirror site that I can submit the problems. Or are there any crawler or sth so that I can parse the data into a usable format.

Thanks in advance.

Full text and comments »

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

By Liuxizai, history, 14 months ago, In English

Check out this submission: 46652533.

The basic idea of this code is to find the diameter at first. Then, for each query, if the desire vertex can be on the diameter, we can find it in $$$O(1)$$$ time. Otherwise, we just jump up step by step, in this case the time complexity is $$$O(k)$$$.

Obviously, in the worst case the code runs in $$$O(n^2)$$$ time, but it got Accepted on Atcoder. It even became the fastest solution among all submissions. All submissions

I have generated 3 pairs of test data to hack this. I constructed three chains with equal length and connected them with a center vertex, and then repeatedly generated queries on an endpoint with different $$$k$$$. Those 3 pairs of test data are using different strategy to generate $$$k$$$, which is showed in filenames. The data in on Google Drive.

Hope someone can fix this.

Full text and comments »

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