munmud's blog

By munmud, history, 5 years ago, In English

I was solving Div.1 264A . But I am getting TLE for that which I think I shouldn't get. After changing lang from GNU C++17 to GNU C++11, I got accecpted for that problem using same code. Is there any specific reason for that ?

Accecpted : GNU C++11 submission TLE : GNU C++17 submission

Thank you.

  • Vote: I like it
  • +2
  • Vote: I do not like it

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

1)Running time can be different on different run.The AC-submission ran in 1981ms , which is very close to the 2000ms time limit.

2)Possibly doing flush operation in C++17 is slower than in C++11

flush operation is somewhat slow.endl will automatically do flush operation as well as creating a new line every time.

You can use \n instead of endl, the first one won't do flush operation for each time.