Qualified's blog

By Qualified, history, 8 days ago, In English,

I see people using "ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);" I personally use "ios::sync_with_stdio(0); cin.tie(0);" without the "cout.tie(0);". What is the difference? Is the first option faster than the second?

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

»
8 days ago, # |
  Vote: I like it +10 Vote: I do not like it

cout is not tied to anything by default. So, cout.tie(false) is useless.

»
7 days ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

I personally have the same question in the mind but I have observed somethings, what it does actually is instead of output all the data multiple times, it prints in a one go. That reduces the time taken for execution.

For example: you have 10 test case and you print some answer, so If you use Fast I/O : then your output will be printed in One go after processing of all the test cases, If you not use : then your output will be printed one test case a time.

that's why it reduces some time of execution.

For More Depth