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

Автор akzytr, история, 8 дней назад, По-английски

Reffering to the 2 solutions: 259905045 and 259906344

The only difference between the codes is that one uses math.log(x) / math.log(2), and the other uses math.log2(x) for the purpose of calculating log with base 2.

The former one, using division to get the base, fails on test case. However, the output is somehow close?

Output: 4327966553 Jury: 4327967516

My first thought was that math.log(x) / math.log(2) would somehow give precision errors if the values are big enough, which seems to be the case here.

I ran a simulation though with random large numbers taken from the range 2^32 and 2^63, and calculated the log with base 2 with both. The code was supposed to break when these two differ, but this never happens.

Is it that the math.log(x) / math.log(2) gives precision errors, or not?

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

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

Автор akzytr, история, 2 недели назад, По-английски

This problem:1541B - Pleasant Pairs

Editorial has the following statements:

Number of pairs(a, b) such that a*b <= 2*n is equal to

2n / 1 + 2n/2 ... where the denominator goes till 2*n.

Time complexity is said to be o(n log n), it did mention harmonic numbers, however I am having a hard time making the connection? Is this somehow in context to https://codeforces.com/blog/entry/118001 where they explain upper bound?

Any help appreciated

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

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

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

If anyone is preparing for the British informatics olympiad 2025, or has participated in the 2024 version, can I ask for some advice on how to prepare, and how realistic it is for me to start preparing now?

I am 15 years old, in year 10, have some programming experience, yet new to competitive programming.

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

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

Автор akzytr, история, 5 недель назад, По-английски

I could not solve 1909B - Make Almost Equal With Mod on my own and thus looked at the tutorial, which among other things writes the following:

if a % m = k:

a % 2m is either k, or k+m

Is there any proof/concept of modular arithmetic that explains why this is so?

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

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