Tuesday 17 September 2013

My Latest Template for Programming Contests


I have learnt few good things about c++.


  • you can directly use this header file, it will precompile all the header files required.

#include <bits/stdc++.h>
using namespace std;


  • struct _ { ios_base::Init i; _() { cin.sync_with_stdio(0); cin.tie(0); } } _;

this is meant for reducing slowness of slowness of iostream in syncing. more on
http://codeforces.com/blog/entry/8387
http://gcc.gnu.org/onlinedocs/libstdc++/manual/using_headers.html
http://codeforces.com/blog/entry/925

Precaution: You need to make sure that you do not use scanf and cin statements interchangibly means
one code should exclusively use cin and cout's only if you are using this. Reason is quite obvious.

I have tested the code on codechef. It works great :). Infact slightly faster :)

Here is the link of my latest template:



No comments:

Post a Comment