Блог пользователя sparsetable

Автор sparsetable, история, 38 часов назад, По-английски

Hello! I was thinking on the nature of practice and working hard today, and I noticed how most hardworking competitive programmers really like solving problems (probably common knowledge for everyone by now). This makes sense, as this would lead to solving a lot of problems, which usually leads to progress. However, the particular case of China came to my mind. I am sure that there are a lot of students there that do CP because they find it enjoyable, but the sheer number of high schoolers who are practicing ultra-hard for CP just felt mind-blowing to me. Are there really that many Chinese people who like CP very much? Or are there other factors at play? I am particularly interested as I currently don't care much about enjoying the process and just want to grind as much as possible :p

Полный текст и комментарии »

  • Проголосовать: нравится
  • +44
  • Проголосовать: не нравится

Автор sparsetable, 3 месяца назад, По-английски

it's creepy, is there at least an option to turn it off?

Полный текст и комментарии »

  • Проголосовать: нравится
  • +12
  • Проголосовать: не нравится

Автор sparsetable, история, 3 месяца назад, По-английски

TL;DR: I shuffled the array, got 100 points, and have no idea why.
(every instance of BOI here refers to the Baltic Olympiad in Informatics.)

I was working on BOI23 d1p2 yesterday, and came up with the following solution for 50 pts:

spoiler

Here, there were 2 obvious optimizations:

  1. Since I only need the value of $$$\min(b, c)$$$ if $$$\min(a, c) = \min(a, b)$$$, we can throw out some unnecessary queries

  2. Might as well randomize the array since it might reduce such occurrences, idk ¯\_(ツ)_/¯

code

And to my surprise...it got 100 points!

Looking at the official code, this seems to be the intended solution. However, even after thinking on it, I'm not really sure why it works. Why is shuffling the array so effective? (only applying optimization 1 without 2 gets you 58 points.)

Полный текст и комментарии »

  • Проголосовать: нравится
  • +9
  • Проголосовать: не нравится

Автор sparsetable, история, 4 месяца назад, По-английски

I was wondering if there was anything similar to this, but for the practice session that took place today.

Полный текст и комментарии »

  • Проголосовать: нравится
  • +17
  • Проголосовать: не нравится