which works faster in c++?
std::ios::sync+with_stdio(false)
std::cin
or
scanf
??
which works faster in c++?
std::ios::sync+with_stdio(false)
std::cin
or
scanf
??
std::ios::sync+with_stdio(false)
This does not increase speed of cout… Point to be noted…
Using cout.tie(0) speeds cout a bit though.
The difference after using fast I/O (like ios_base… , cin.tie(0), cout.tie(0), using newline char instead of endl etc.) is negligible to me. If you are still getting TLE despite having correct complexity, I think your code is “crude” and needs some hardware level optimizations. Problem setters ought not to set such strict time limits, but if they feel like testing this, or demand a refined solution instead of a “crude” one, then its good to know how to optimize your code further on such level. (I often see it on hackerrank questions - correct complexity + refined solution gets easy AC, rest get stuck on 1-2 cases)
thanks for the link!!
quite informative as codeforces is always…
Thank you