Probably well known but as a new Leetcoder it is kinda annoying.
Every time I check out sample solutions other people submitted for C++ I am always seeing these lines:
ios_base::sync_with_stdio(false);
cin.tie(NULL);From what I understand this happens to speed up execution of some programs as a side effect explained here:
https://stackoverflow.com/questions/31162367/significance-of-ios-basesync-with-stdiofalse-cin-tienull
And clearly do not belong in the solution itself since it has nothing to do with an algorithm. I also know times and space measurements are fuzzy numbers.
I don't know about contests themselves since I am only doing leetcode problems for now, but these two lines produce strong dominating benchmarks (guessing also because of small sample inputs) for sub optimal algorithms of quadratic worst case as compared to much more efficient linear time algorithms. I am aware there are constant factors that need to be overcomed and may has to do something with small input size or even specific features of the machine state, etc.
Is this an issue in contests as well? How is this usually treated and handled in contests? I am guessing nothing is stopping from people from hard coding inputs to outputs as well which would amount to cheating in my opinion.