Изменения рейтингов за последние раунды временно удалены. Скоро они будут возвращены. ×

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

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

The 2018 Egyptian Collegiate Programming Contest was held yesterday this was a problem from it where he asks for

Where n<=10^5 and a[i]<=10^5 answer should be printed %10^9+7

I would appreciate any help in solving this problem and thanks in advance

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

»
6 лет назад, # |
Rev. 2   Проголосовать: нравится +33 Проголосовать: не нравится
hint
solution idea
code
»
6 лет назад, # |
  Проголосовать: нравится +25 Проголосовать: не нравится

Mhm... nice problem. Do you agree, mnbvmar?

  • »
    »
    6 лет назад, # ^ |
    Rev. 3   Проголосовать: нравится +27 Проголосовать: не нравится

    <3

    Story: We proposed this exact task (under a tiny bit different constraints, though) to our high school students back in 2015. I was quite surprised that apparently it has never appeared anywhere even though the statement feels really natural and obvious. So it seems it eventually did!

    I think tribute_to_Ukraine_2022 came up with another solution, involving...

    Spoiler

    I can't remember any details, though. Mind sharing (if you still remember it)?

    • »
      »
      »
      6 лет назад, # ^ |
      Rev. 2   Проголосовать: нравится +14 Проголосовать: не нравится
      Solution
»
3 года назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

Can anyone tell me why my solution gives TLE.

If I am analysing time complexity properly, my code should take $$$O(n + max(a_i)*log(max(a_i)))$$$ time per test case.

Submission : 111169206