What are some of the useful c++ commands or hacks helpful in competitive programming?
# | User | Rating |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3831 |
3 | Radewoosh | 3646 |
4 | jqdai0815 | 3620 |
4 | Benq | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | gamegame | 3386 |
10 | ksun48 | 3373 |
# | User | Contrib. |
---|---|---|
1 | cry | 164 |
1 | maomao90 | 164 |
3 | Um_nik | 163 |
4 | atcoder_official | 160 |
5 | -is-this-fft- | 158 |
6 | awoo | 157 |
7 | adamant | 156 |
8 | TheScrasse | 154 |
8 | nor | 154 |
10 | Dominater069 | 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