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

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

Say you wanted to calculate the floored square root of a number in C++, and you do: (int)sqrtl(x).

Or you wanted to calculate the floored base b logarithm of some number, and you do: (int)(logl(x)/logl(b)).

Could either of the 2 produce incorrect results due to precision errors?

I would assume since long double has 64 significant bits, both of the cases above should work correctly for all possible 64-bit integer values of x, but I am a bit skeptical of the logarithm, since there is an extra division step.

And if they are unreliable, what are good alternatives?

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

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

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

The whole point of your CF rating is to reflect your past performance in contests, which gives you a rough idea of how skilled you are as a competitive programmer.

So when your rating goes up significantly, it's usually a sign that you have improved significantly.

I would assume that people cheat for a better rating, but what is the point of increasing your rating if you know your skill hasn't increased alongside it?

It makes your rating feel meaningless... Completely removes the sense of accomplishment, which is the whole point of wanting to achieve a higher rating in the first place.

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

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

Автор Phantom_Dreams, история, 3 месяца назад, По-английски
  • Проголосовать: нравится
  • +3
  • Проголосовать: не нравится

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

Given $$$N$$$ integer intervals $$$[a, b]$$$, find the maximum number of pairs of overlapping intervals where each interval can belong to at most one pair.

Two intervals overlap if they share a common point, including closed endpoints.

The answer to the example above is 2. Pair the 2 black intervals and the 2 red intervals together.

What is the best time complexity that can be achieved for this problem? Currently I'm not sure if it's even solvable in polynomial time.

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

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