9inai's blog

By 9inai, history, 5 months ago, In English

There this task 1670B - Dorms War, which has an O(n) solution. Isn't my 238883260 optimal as well? It keeps getting TLE's on 35th test :/ No idea how to optimize it really

  • Vote: I like it
  • -6
  • Vote: I do not like it

»
5 months ago, # |
Rev. 4   Vote: I like it +3 Vote: I do not like it

Use fast input Paste this into your code ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); this is a quick input to c++

Here is the package with quick input code

  • »
    »
    5 months ago, # ^ |
      Vote: I like it +1 Vote: I do not like it

    thanks, worked! Are there any downsides of these lines though?

    • »
      »
      »
      5 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      I think there are no disadvantages,you can read what these lines do:blog

    • »
      »
      »
      5 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      If you remove endl from the code, your program will speed up.