A curated repository of 500+ competitive programming problem solutions from Codeforces contests, gym, and problem sets.
Optimized for efficiency, clean templating, and rapid algorithm lookup.
This repository archives comprehensive solutions to Codeforces problems solved by Momin Rifat. Each solution is structured with high code quality, optimal time & space complexity, and documented approaches designed for competitive programming training and contest preparation.
flowchart LR
A["Beginner (Rating 800 - 1000)<br/>β’ Implementation<br/>β’ Math & Modulo<br/>β’ Strings & Brute Force"] --> B["Intermediate (Rating 1100 - 1300)<br/>β’ Two Pointers<br/>β’ Sorting & Greedy<br/>β’ Number Theory & Primes"]
B --> C["Advanced (Rating 1400 - 1600+)<br/>β’ Dynamic Programming (1D/2D)<br/>β’ Binary Search on Answer<br/>β’ Graph Traversal (BFS/DFS/Dijkstra)<br/>β’ Disjoint Set Union (DSU)"]
| Category | Typical Techniques / Algorithms | Difficulty Range |
|---|---|---|
| Math & Number Theory | Sieve of Eratosthenes, GCD/LCM, Modular Arithmetic, Combinatorics | 800 β 1400 |
| Greedy Algorithms | Interval Scheduling, Sorting criteria, Exchange arguments | 900 β 1500 |
| Dynamic Programming | Knapsack, LIS, Grid DP, Bitmask DP, Prefix Sums | 1100 β 1600+ |
| Data Structures | std::map, std::set, Monotonic Stacks, Segment Trees, Fenwick Trees |
1200 β 1600+ |
| Graph Theory | Connected Components, Topological Sort, Shortest Paths, Trees | 1200 β 1600+ |
| Constructive Algorithms | Parity analysis, Invariant state maintenance, Edge case handling | 1000 β 1500 |
Most C++ solutions employ this baseline template for sub-millisecond I/O speed:
#include <bits/stdc++.h>
using namespace std;
#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ll long long
#define nl "\n"
#define all(v) (v).begin(), (v).end()
void solve() {
// Problem logic here
}
int main() {
fast_io;
int tc = 1;
cin >> tc;
while (tc--) {
solve();
}
return 0;
}Momin Rifat
- Codeforces Profile: Momin_Rifat
- GitHub: @MominRifat
- Focus: Problem Solving, Data Structures & Algorithms