What are some of the useful c++ commands or hacks helpful in competitive programming?
# | User | Rating |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3823 |
3 | Benq | 3738 |
4 | Radewoosh | 3633 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | ksun48 | 3390 |
10 | gamegame | 3386 |
# | User | Contrib. |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
3 | atcoder_official | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 157 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
9 | nor | 153 |
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.net/blog/entry/15643