dzhi's blog

By dzhi, history, 16 months ago, In English

It appears that Codeforces' judgement system uses a rather huge stack size (maybe 256 MB or even more). A typical example is a DFS solution on a large tree with 200000 nodes, potentially a stick/chain of 200k nodes so the call stack has 200k frames!

Such a huge stack size, likely was introduced to allow DFS or other recursive solutions, which is considered as a bad practice and usually discouraged in production software system:

  • Software systems are usually multi-threaded (dozens or even hundreds of threads) to leverage all the CPU cores and be flexible to network/disk IO delays. Individual threads can not have a huge stack size due to memory limits.
  • With a huge stack size, most of the memory reserved for the stack is likely wasted most times.
  • More importantly, recursive code has the risk of hitting stack overflow at runtime at unpredictable and inconvenient times (like a mine in the field). It is usually discouraged or even forbidden to implement recursive code with unbounded or huge layers.

I wonder what other people's opinion about this, and/or a good reason Codeforces uses a huge stack size.

Full text and comments »

  • Vote: I like it
  • -14
  • Vote: I do not like it

By dzhi, history, 19 months ago, In English

I recall there was a thread about Google Code Jam Farewell Rounds a few days ago. Now that I barely finished most of the problems, I wonder how to find the thread as it was no longer in the "Recent actions" list?

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By dzhi, history, 2 years ago, In English

Round 137 problem G (https://codeforces.net/contest/1743/problem/G) Java submission always fails with following error: Error occurred during initialization of VM Initial heap size set to a larger value than the maximum heap size

The problem has an usual memory limit per test of 4 megabytes. The error is likely due to value of -Xmx is smaller than -Xms in the test launch. -Xms: This specifies initial heap size for JVM -Xmx: This specifies maximum heap memory size for JVM

Full text and comments »

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

By dzhi, history, 2 years ago, In English

I registered round #822 yesterday but didn't notice that it starts 2.5 hours before the usual time. Wonder what will be the impact to ranking, and why the unusual start time.

Suggestion to codeforces is to highlight contest with unusual start time to make it more obvious and harder to miss.

Updated: If I have a wish for the CONTESTS page, is to highlight the start time of the upcoming periodical contest that does not start at the usual 07:35.

Full text and comments »

  • Vote: I like it
  • -27
  • Vote: I do not like it