Over Using of Fast Input-Output for C++ & submission being faster than others.

To all the Leetcoders,
Below I have coded a way to increase the speed of code (for C++ coders only)

class solution{
public:
void FastIO()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
//cout.tie(0);
}
functiontype functionname(data)
{
	//solution to the question
}
};

Adding this portion of code will help your code cutting down few ms while compiling it.
Reason :

ios_base::sync_with_stdio(0);

This disables the synchronization between the C and C++ standard streams. By default, all standard streams are synchronized, which in practice allows you to mix C- and C++-style I/O and get sensible and expected results.

In The end I have two basic questions -:

  1. How a submission is being decided faster than other solutions?
  2. How Some questions are accepted even after having some bounds over them.
Comments (2)