What is the fastest way to take I/O in c++?

Revision en1, by prabalsingh24, 2019-09-28 10:16:11

I used to think printf scanf are faster than cin cout. However in this https://codeforces.com/contest/914/submission/61405523 i used printf and scanf and got TLE. When i changed it to cin cout and \n I got AC( i used ios::sync_with_stdio(0); cin.tie(0); cout.tie(0) though) https://codeforces.com/contest/914/submission/61406026. In some cases i found printf scanf to be faster than cin cout( I did not use ios::sync_with_stdio(0); cin.tie(0); cout.tie(0) those times ). Can someone tell me the most efficient way to take I/O

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English prabalsingh24 2019-09-28 10:16:11 570 Initial revision (published)