I just want to know whether using scanf/printf instead of cout/cin can cause significant difference in the run time?
I was solving a question CHMOD, and was getting TLE when I used cout/cin. But when I shifted my I/O operations to scanf/printf, I got an AC.
[The part below is totally unrelated to question and reflects my current state of mind].
When I was using cout/cin, my approach to the problem wasn’t wrong, but then also I had to deal with TLE. And when I or any one gets a TLE, it directly signifies that there is something wrong with the run time complexity of the code. Thus the person tries to optimize his code. And after a lot effort if he gets nothing, he either goes to the editorial or read someone elses code or in extreme cases gets depressed/demoralized/frustated and leaves the problem.
I went through the third case, as after going through few accepted codes, I wasn’t able to figure out what was going wrong with my solution.
If I code in JAVA, I always know that I should never use Scanner class for I/O, as it is mentioned everywhere. But in C++, it is no where mentioned that “it is highly recommended to use scanf/printf for I/O instead of cout/cin”.
P.S - I just want to say that such small things should be taken care of by the judging machine or it should be mentioned in the question statement or somewhere else to use scanf/printf instead of cout/cin
I might be wrong about many things I have written here, so please forgive me if I went wrong somewhere.