What are some of the useful c++ commands or hacks helpful in competitive programming?
# | User | Rating |
---|---|---|
1 | tourist | 3856 |
2 | jiangly | 3747 |
3 | orzdevinwang | 3706 |
4 | jqdai0815 | 3682 |
5 | ksun48 | 3591 |
6 | gamegame | 3477 |
7 | Benq | 3468 |
8 | Radewoosh | 3462 |
9 | ecnerwala | 3451 |
10 | heuristica | 3431 |
# | User | Contrib. |
---|---|---|
1 | cry | 167 |
2 | -is-this-fft- | 162 |
3 | Dominater069 | 160 |
4 | Um_nik | 158 |
5 | atcoder_official | 157 |
6 | Qingyu | 156 |
7 | djm03178 | 152 |
7 | adamant | 152 |
9 | luogu_official | 150 |
10 | awoo | 147 |
What are some of the useful c++ commands or hacks helpful in competitive programming?
Name |
---|
You may refer to this quora question here:
Competitive Programming: What are some cool C++ tricks to use in a programming contest?
This CF blog post is probably also worth a read: Effective Usage of C++ STL for quick and concise code writing in competitive programming
#include <bits/stdc++.h>
is a beauty(basically, it includes everything you will ever need in a contest). Another "hack" that I like a lot is casting an integer to a bitset and then couting that bitset, it helps a lot in debugging bitmaasks ant the like. Other than that, practice, practice and more practice!Can u provide an example to illustrate the second part of your answer(casting an integer,debugging bitmasks)?Since i'm a beginner,i'm not able to understand that.
Like this. Debugging is just a use of it, sometimes you do a lot of bit-fiddling in an algo and you want to track down an error, but it may also help to cout the binary representation of a number if a problem asks for it, etc...
Include it, and add at least 1 second to your compiler time :(
http://codeforces.me/blog/entry/15643