orz's blog

By orz, history, 3 years ago, In English

Since there were not that many Div. 1 rounds last several days, I decided to compete in a Div. 2 round. This time my participation was quite poor, but still I solved and explained some of the problems in front of a camera, so I hope that my video will be useful for my adorable viewers: https://youtu.be/ZF42Y5cQhf4

As with my previous video, any sort of feedback is welcome in the comments.

Full text and comments »

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

By orz, history, 3 years ago, In English

Recently I started screencasting my contests, there are already several videos on my channel. They all are in Russian because I ponder in Russian.

Today, as an experiment, I decided to screencast CodeTON Round 2 and comment my actions in English. Yes, my reasoning is often fragmentary there (because under the pressure of time I cannot spend much time explaining a lot of things rather than start coding). Still, since I finished 24th I expect it to be rather entertaining content, thus I invite you to watch the process: https://youtu.be/ZK8vVVhoQXI

Since I am very new to exploring this niche, any sort of advice of improving the quality of my videos is highly welcome here in the comments, on the Youtube, or in my PM.

Full text and comments »

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

By orz, history, 3 years ago, translation, In English

Several days ago I published a table with first people to reach certain ratings. It featured only ratings above 1500, and adamant advised to do the same, but on achieving ratings below 1500. I found it quite interesting, and, after several days of collecting data about participations of 447911 Codeforces users, I finally made this table.

Full text and comments »

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

By orz, history, 3 years ago, translation, In English

Several days ago I published a table with first people to reach certain ratings. It was a bit raw because, firstly, it was based on top 20000 Codeforces users by rating, and, secondly, because it only gave information about ratings divisible by 50. Now I have prepared a table that is of more complex design, but both issues are resolved. Good luck understanding what is going on in it.

Full text and comments »

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

By orz, history, 3 years ago, In English

Hi there!

Recently after Codeforces Global Round 21 Um_nik noticed that he might be the ninth or tenth person to reach 3600 rating points, but still he did it earlier than Petr. I wondered whether Um_nik really was that attentive to know for sure how many people reached 3600 before him. As this is an objective truth or an objective misconception, I decided to simply check it.

Full text and comments »

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

By orz, history, 3 years ago, translation, In English

Consider the following problem: given three integers $$$x$$$, $$$y$$$ и $$$m$$$, $$$0 \leqslant x,y < m < 2^{32}$$$, calculate $$$xy\bmod m$$$. The easy way is just to multiply these numbers and apply the modulo operation:

uint32_t prod(const uint32_t x, const uint32_t y, const uint32_t m)
{
	return x * y % m;
}

As you might have guessed, this solution is wrong. The thing is that an overflow is possible in such a procedure: the operation x * y is performed in the typeuint32_t, and in fact the intermediate result of this operation will not be $$$xy$$$, but $$$xy\bmod2^{32}$$$. If after that we take the result modulo $$$m$$$, it may differ from the correct one:

$$$ \left(xy\bmod2^{32}\right)\bmod m\ne xy\bmod m. $$$

The way out is simple — you need to multiply in a larger type:

uint64_t prod_uint64(const uint64_t x, const uint64_t y, const uint64_t m)
{
	return x * y % m;
}

If you do this, then, since $$$xy<2^{64}$$$, this product will definitely not overflow, and after taking the result modulo, you will get the correct answer.

The question is: what if $$$x$$$, $$$y$$$ and $$$m$$$ can be greater than $$$2^{32}$$$?

Full text and comments »

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

By orz, history, 4 years ago, In English

IMO 2021 closing ceremony is taking place now.

Top countries were:

  1. People's Republic of China, 208 points
  2. Russian Federation, 183 points
  3. Republic of Korea, 172 points
  4. United States of America, 165 points
  5. Canada, 151 points

English: https://youtube.com/watch?v=LHi_xjvLEbI

Russian: https://youtube.com/watch?v=23cTkofxbq4

Full text and comments »

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

By orz, history, 4 years ago, In English

IMO 2021

IMO 2021 opening ceremony takes place right now. Join the chat!

Russian: https://www.youtube.com/watch?v=c3APd3bCrFI

English: https://www.youtube.com/watch?v=DpZnQuUI27Y

Full text and comments »

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