Please read the new rule regarding the restriction on the use of AI tools. ×

cschill's blog

By cschill, history, 3 years ago, In English

Hello Guys, Please help me, I am getting TLE but the complexity of my program is around O(n*logn + n + n + n + T) where n and t both are 5e6. The time limit is 3 sec. I think it should work. Please help. https://mirror.codeforces.com/contest/546/submission/145049261

  • Vote: I like it
  • 0
  • Vote: I do not like it

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

In this case the input is taking a lot of time. You must add such code at the begin of the main function and all will be ok. ios_base::sync_with_stdio(false); cin.tie(0);

  • »
    »
    3 years ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it

    I think its there, #define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

    • »
      »
      »
      3 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      oh my bad I havn't added the fastio in the main

    • »
      »
      »
      3 years ago, # ^ |
      Rev. 2   Vote: I like it 0 Vote: I do not like it

      Yes, but there is no word fastio() in your code and compiler doesn't put ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) anywhere