TLE with segtree (What am I doing wrong ?)

govufpb preguntado 1 month ago

Someone could help-me ? =-)

-- Code Removed

Este tema fue resuelto y no puede recibir nuevas respuestas.

  • govufpb respondido 1 month ago

    Ok. Solved using a tremendous efficient segtree implementation. Passed with 0.894s

  • govufpb respondido 1 month ago

    Sorry. I have made the changes suggested by Alexis, but still TLE. Is there some infinity loop?

  • Aléxis Toigo respondido 1 month ago

    You are using a lot of memory, 3e5 + 10 for the array is enough to solve this problem.

    #define MAX int(1e5+10)
    int t[3 * MAX][2];

    The time it takes the compiler to allocate all this memory is very high, leaving little time for resolving the issue itself.