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

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

I found this question somewhere online, which went as follows: For each integer x in a given range [L, R], find the count of integers in the given range that are co-prime with x. Constraints: 1 <= L <= R <= 1e5

Example: For L = 2, R = 4, the co-prime pairs would be:

2 -> (2,3) so count = 1 3 -> (3,2), (3,4) so count = 2 4 -> (4,3) so count = 1

Does anyone have an optimal solution for this?

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

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

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

Problem: https://mirror.codeforces.com/contest/1355/problem/B

My solution: https://mirror.codeforces.com/contest/1355/submission/80313155

This uses the same logic as used in the editorial. Can someone explain why I got the TLE verdict?

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

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