cschill's blog

By cschill, history, 2 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://codeforces.com/contest/546/submission/145049261

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

»
2 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);

  • »
    »
    2 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)

    • »
      »
      »
      2 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

    • »
      »
      »
      2 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