There are three categories of optimizations.
-
I think I have the asymptotically correct solution, but something fails.
-
I think I can get a pass with my near-correct solution.
-
I want to flex.
This document will try to cover all these cases.
custom compiler directives
what is the int_fast32_t?
cin vs scanf
a /= 2 vs. a >>= 1
linear sorting
segmented vs. Fenwick Tree
what is the restrict keyword?
emplace_back vs. push_back
custom allocators
c++ standard
Congratulations! You wasted all your time on the first assignment.
If you're planning on highscorring on CESE or elsewhere, consider including a comment with a link to this repo in your solution; this will help to bring people wanting to push performance ever further.
Optimized CSES solutions