CF 比赛守则
NEVER FORGET TO:
- Look at the problem's constraints before coding.
How to approach Codeforces (cf):
- Find a lower bound or upper bound for the problem and have faith that it is the answer.
- If it isn't the answer, have more faith or switch to another bound by seeking a better one.
- Trust guesses; in Division 2, AC (Accepted) solutions require no formal proof.
- Drawing cases is essential. Instead of overthinking, draw cases to reach illogical conclusions.
- Sometimes, drawing cases takes too much time. A faster alternative is to forgo thinking and code a bruteforce solution.
- Embrace the "law of small numbers." If a solution works for small numbers, assume it works for large numbers.
- Reference the concept of "Hasty generalization" – in competitive programming, mistakes are lightly punished.
- In Codeforces, the focus is on intuition rather than proving solutions right or wrong.
- Be as simple as possible in implementation; trying to be clever often leads to Wrong Answers (WAs).
- Consider 2x2 cases for matrix problems and hope they generalize to the broader case.
- Find a necessary condition and trust it to be sufficient, as they are essentially the same thing.
- Heuristics may speed up code; prioritize ACing over proving the solution's goodness.
- For grid path problems starting at (1, i) or similar points, assume paths never cross and apply Divide and Conquer.
- Consider solving problems in reverse order of queries/updates.
- For combinatorics problems, factor in symmetry.
General Strategy (MUST DO):
- Attempt to solve the problem with more restricted constraints.
About Testing:
- Test scenarios like n=1, a[i]=1, a[i]=n, etc. Focus on low values; if pretests are strong, extensive testing may not be necessary. However, if encountering WA, thorough testing is advisable.
Note: This advice is serious. While it may be considered suboptimal practice, it can be effective for achieving AC in competitive programming.