Competition Cheatsheet
Content
Cheatsheet for coding competitions.
Complexity Limit
TLE
10^8 int operations/10^7 floating point operations in a for loop run in around 1 sec.
- n = 20: exponential ok
- n = 100:
O(n^3)ok - n = 1000:
O(n^2)ok - n = 10^4:
n*polylog(n)^n*sqrt(n)ok - n = 10^5:
nlognok - n = 10^6:
O(n)ok - n = 10^9:
O(logn)ok
STL
vectorin<vector>priority_queuein<queue>sortin<algorithm>binary_searchin<algorithm>next_permutationin<algorithm>lower_bound,upper_boundin<algorithm>set,multisetin<set>map,multimapin<map>