Skip to main content

Contest Strategy

The Winning Mindset

Raw skill is not enough. The best competitive programmers combine technical knowledge with strategic thinking. This chapter covers the meta-skills that separate winners from participants.
The Three Pillars of Contest Success:
  1. Speed: Solve easy problems fast
  2. Accuracy: Minimize wrong submissions
  3. Strategy: Choose problems wisely

Understanding Contest Formats

Codeforces Format

DivisionRating RangeProblem Difficulty
Div 3< 1600A: 800, B: 1000-1200, C: 1200-1400, D: 1400-1600
Div 2< 2100A: 800-1000, B: 1200-1400, C: 1500-1700, D: 1800+
Div 11900+A: 1700+, problems get very hard
Scoring: Points decrease over time. Penalty for wrong submissions. Strategy by Rating:
  • 800-1200: Focus on solving A and B quickly
  • 1200-1400: Solve A, B, C; attempt D
  • 1400-1600: Solve A-D consistently; attempt E
  • 1600+: Speed on A-C, deep thinking on D+

ICPC Format

  • Team of 3, 1 computer
  • 5 hours, 10-13 problems
  • Scoring: Most problems solved, then fewest penalty minutes
  • No partial credit: Solution must pass all test cases
ICPC Strategy:
  • Assign problems by specialty (graphs, DP, math, etc.)
  • One person reads while another codes
  • Easy problems first to build momentum
  • Keep one person thinking about hard problems

The First 10 Minutes

These opening minutes can define your contest.

Codeforces Routine

0:00 - Read Problem A
0:02 - Code and submit A
0:05 - Read Problem B
0:08 - Start coding B
Don’t lose rating on A and B!
  • Read carefully. Miss a constraint, lose 10 minutes.
  • Check edge cases before submitting.
  • If stuck for 5 minutes on A/B, you misread something.

ICPC Routine

Member 1: Read A, B, C
Member 2: Read D, E, F
Member 3: Read G, H, I (or help with easier ones)

Immediately share: "A is easy [topic], B is [topic], etc."

Reading Problems Effectively

The 3-Read Method

  1. Skim (30 seconds): What type of problem is this?
  2. Detailed Read (2 minutes): Constraints, examples, edge cases
  3. Verification (30 seconds): Reread the output format

Constraint Analysis Cheat Sheet

ConstraintMaximum ComplexityTypical Algorithm
n ≤ 10O(n!)Brute force, backtracking
n ≤ 20O(2^n)Bitmask DP, meet in middle
n ≤ 100O(n³)Floyd-Warshall, 3 nested loops
n ≤ 500O(n³) with optimizationMatrix DP
n ≤ 3000O(n²)2D DP, all pairs
n ≤ 10^5O(n log n)Sorting, segment tree, binary search
n ≤ 10^6O(n)Linear algorithms
n ≤ 10^9O(log n) or O(1)Math, binary search on answer

When You’re Stuck

The 5-Minute Rule

If you’ve been stuck for 5 minutes:
  1. Reread the problem - Did you miss something?
  2. Check examples manually - Trace through by hand
  3. Try small cases - n = 1, 2, 3
  4. Consider related patterns - What technique does this remind you of?

Escape Strategies

Stuck on implementation → Write pseudocode first
Stuck on approach → List all techniques that might apply
Stuck on edge cases → Think: 0, 1, -1, empty, maximum
Stuck on TLE → What's the bottleneck? Can you precompute?

When to Skip

Skip a problem if:
  • You’ve spent 20+ minutes with no progress
  • The problem type is unfamiliar
  • Easier problems remain unsolved

Debugging Under Pressure

Prevention is Better

// Always use these before contest
#define int long long  // Prevent overflow bugs
const int INF = 1e18;  // Large enough for all cases

// Bounds check
assert(0 <= x && x < n);

Stress Testing

// Generate random test
void generateTest() {
    int n = rand() % 100 + 1;
    // Generate random input
}

// Compare brute force with optimized
while (true) {
    auto input = generateTest();
    auto ans1 = bruteForce(input);
    auto ans2 = optimized(input);
    if (ans1 != ans2) {
        // Print failing test
        break;
    }
}

Common Bug Checklist

  • Integer overflow (use long long)
  • Array index out of bounds
  • Uninitialized variables
  • Off-by-one errors
  • Wrong variable name (copy-paste errors)
  • Forgetting to reset globals between test cases
  • 0-indexing vs 1-indexing mismatch

Time Management

Codeforces Time Budget (2 hours)

TimeActivity
0:00-0:15Solve A and B
0:15-0:45Solve C
0:45-1:15Solve D
1:15-1:45Attempt E or revisit earlier problems
1:45-2:00Clean up, submit what you have

Know When to Code vs Think

  • Code immediately: You see the pattern clearly
  • Think first: Novel problem, unclear approach
  • Switch problems: Stuck 15+ minutes, others unsolved

The CP-31 Checklist

Before submitting, verify:
  1. Input/Output - Correct format? Flushed output?
  2. Edge cases - n=0? n=1? Empty arrays?
  3. Overflow - Need long long? Multiplication overflow?
  4. Constraints - Does complexity fit time limit?
  5. Array bounds - Enough space allocated?

Post-Contest Analysis

After Every Contest

  1. Upsolve unsolved problems - This is where real learning happens
  2. Analyze time spent - Where did you lose time?
  3. Review wrong submissions - What caused them?
  4. Tag problems by pattern - Build your pattern database

Rating Goals and Practice

Current RatingWeekly GoalFocus Areas
< 12005-10 problemsImplementation, basic math, greedy
1200-140010-15 problemsBinary search, two pointers, basic DP
1400-160010-15 problemsGraphs, harder DP, segment tree basics
1600-190015-20 problemsAdvanced data structures, number theory

Virtual Contests

Practice contests in real conditions.
Codeforces → Contests → Pick a past contest → "Virtual Participation" (right sidebar)
Or
Set 2-hour timer → No peeking at solutions
Gym vs Virtual Contests: Gym is for unofficial contests (university rounds, ICPC training, etc.). Virtual participation is for practicing official past Codeforces rounds.
Virtual Contest Rules:
  • No external resources (except template)
  • No solution peeking
  • Submit even if unsure
  • Analyze performance afterward

Building Your Template

A good template saves time and prevents bugs.
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()

const int INF = 1e18;
const int MOD = 1e9 + 7;

void solve() {
    // Your solution here
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int t = 1;
    cin >> t;  // Comment if single test
    
    while (t--) {
        solve();
    }
    
    return 0;
}

Psychology of Competition

Staying Calm

  • Before contest: Light practice, don’t try new techniques
  • During contest: One problem at a time, deep breaths
  • After WA: Re-read problem, don’t panic-submit

Managing Tilt

When frustrated:
  1. Take 30 seconds away from screen
  2. Re-read problem from scratch
  3. Ask: “What am I assuming that might be wrong?”

The Growth Mindset

  • Every contest teaches something
  • Rating fluctuates—focus on learning
  • Celebrate progress, not just wins

ICPC-Specific Tips

Team Coordination

Team Roles:
- Primary Coder: Best at typing/implementation
- Problem Picker: Reads all problems, decides order
- Specialist: Deep knowledge in specific areas

Communication:
- "I think A is [greedy/DP/graph]"
- "I need the computer in 5 minutes"
- "I'm stuck, can you look at this?"

Coding Efficiency

  • Print code for debugging
  • One person codes, one reviews
  • Use simple variable names for speed

Codeforces-Specific Tips

Rating Optimization

  • Don’t oversubmit: Penalty adds up
  • Lock early if confident: Extra points for others’ failures
  • Check hacks during freeze: Learn from others’ approaches

Handling Pretests vs System Tests

  • Pretests are NOT comprehensive
  • Always consider edge cases
  • Stress test if time permits

Your 30-Day Improvement Plan

WeekFocusDaily Practice
1Speed on A-B5 Div 2A + 5 Div 2B
2C-level patterns5 Div 2C problems
3D-level problems3 Div 2D problems
4Full contests2 virtual contests + upsolving

Key Takeaways

Speed Matters

Solve easy problems fast. Every minute counts.

Read Carefully

Most mistakes come from misreading the problem.

Know When to Skip

20 minutes stuck? Move on, come back later.

Upsolve Always

Real learning happens after the contest.

Final Words

Competitive programming is a marathon, not a sprint. Every problem solved, every contest participated in, adds to your skill set. The patterns you learn here—algorithmic thinking, debugging under pressure, time management—are invaluable beyond CP. Your journey to Specialist, Expert, Master, and beyond starts now.

Back to Course Overview

Review the full course curriculum and continue your CP journey.

Resources

Essential Practice Sites

Learning Resources

Community

  • Codeforces blogs and editorials
  • Competitive Programming Discord servers
  • ICPC practice with team

Good luck. See you on the leaderboard.