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

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

I am getting MLE for this problem and I can't figure it out. Any help would be appreciated: https://mirror.codeforces.com/problemset/problem/1775/D

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

»
13 месяцев назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

I guess that your code is creating a graph with too many edges. I think in your code, the number of edges from node i is roughly equal to the number of divisors that b[i] has. In worst case scenario, b[i] has around 240 divisors, so we have 240 edges with each of 6*10^5 vertices * 4 bytes per int value = about 576MB, which is twice the memory limit