Codeforces problemset search & solutions
Exclude tags.

Review the problem statement from Codeforces (link will open a new tab). When you've matched your problem, go to the solutions.

Search on plain tags, ratings, names, and problem text. Example: brute force or binary search

< 1 2

Solved
Name
Tags
Solutions
Index
Contest
Type
Points
Tutorial
Rating Level
935 Timber combinatorics dp fft math Statement F Educational Codeforces Round 147 (Rated for Div. 2) {1821} PROGRAMMING 115296
7599 Gardening Friends brute force dfs and similar dp graphs trees Statement F Codeforces Round 867 (Div. 3) {1822} PROGRAMMING Codeforces Round #867 (Div. 3) Editorial
1283 Random Walk dp graphs math probabilities trees Statement F Codeforces Round 868 (Div. 2) {1823} PROGRAMMING 2500.0 115465
1679 LuoTianyi and XOR-Tree data structures dfs and similar dp dsu greedy trees Statement C Codeforces Round 872 (Div. 1) {1824} PROGRAMMING 1750.0 CodeForces Round 872(Div. 1&2) Editorial 2500
4522 Range Sorting (Easy Version) binary search dp dsu greedy trees two pointers Statement B1 Codeforces Round 873 (Div. 1) {1827} PROGRAMMING 750.0 Codeforces Round #873 (Div. 1 & 2) Editorial 2000
923 Mex Tree brute force dp trees Statement D Codeforces Round 875 (Div. 1) {1830} PROGRAMMING 2250.0 Codeforces Round #875 (Div.1 + Div. 2) Editorial
20182 Copil Copac Draws Trees dfs and similar dp graphs trees Statement A Codeforces Round 875 (Div. 1) {1830} PROGRAMMING 500.0 Codeforces Round #875 (Div.1 + Div. 2) Editorial
6364 Ksyusha and Chinchilla dfs and similar dp dsu greedy implementation trees Statement G Codeforces Round 874 (Div. 3) {1833} PROGRAMMING 116636
21586 Apple Tree combinatorics dfs and similar dp trees Statement D Codeforces Round 881 (Div. 3) {1843} PROGRAMMING Codeforces Round #881 (Div. 3) Editorial
2105 Omsk Metro (hard version) data structures dfs and similar divide and conquer dp implementation math trees Statement F2 Codeforces Round 881 (Div. 3) {1843} PROGRAMMING Codeforces Round #881 (Div. 3) Editorial
6329 Omsk Metro (simple version) data structures dfs and similar dp greedy math trees Statement F1 Codeforces Round 881 (Div. 3) {1843} PROGRAMMING Codeforces Round #881 (Div. 3) Editorial
1748 PermuTree (hard version) bitmasks dp implementation trees Statement E2 Codeforces Round 890 (Div. 2) supported by Constructor Institute {1856} PROGRAMMING 1500.0 Codeforces Round #890 (Div. 2) Editorial
6411 PermuTree (easy version) dfs and similar dp trees Statement E1 Codeforces Round 890 (Div. 2) supported by Constructor Institute {1856} PROGRAMMING 1500.0 Codeforces Round #890 (Div. 2) Editorial
3185 Trees and Segments binary search brute force constructive algorithms data structures dp greedy two pointers Statement D Codeforces Round 893 (Div. 2) {1858} PROGRAMMING 2000.0 Codeforces Round #893 (Div. 2) Editorial 2200
127 Redundant Routes constructive algorithms dp trees Statement I Pinely Round 2 (Div. 1 + Div. 2) {1863} PROGRAMMING 4000.0
112 Goldberg Machine 3 dp trees Statement H Pinely Round 2 (Div. 1 + Div. 2) {1863} PROGRAMMING 3500.0
558 Keen Tree Calculation binary search dp geometry trees Statement K COMPFEST 15 - Preliminary Online Mirror (Unrated, ICPC Rules, Teams Preferred) {1866} PROGRAMMING COMPFEST 15 Preliminary — Editorial
1369 Travel Plan combinatorics divide and conquer dp math trees Statement C Codeforces Round 896 (Div. 1) {1868} PROGRAMMING 1000.0 Codeforces Round 896 (Div. 1, Div. 2) Editorial
2712 Autosynthesis 2-sat constructive algorithms dfs and similar dp flows graphs trees Statement C Codeforces Round 902 (Div. 1, based on COMPFEST 15 - Final Round) {1876} PROGRAMMING 1250.0 Codeforces Round #902 (Div. 1, Div. 2, based on COMPFEST 15 — Final Round) Editorial
344 Ball-Stackable constructive algorithms data structures dp trees Statement E Codeforces Round 902 (Div. 1, based on COMPFEST 15 - Final Round) {1876} PROGRAMMING 2250.0 Codeforces Round #902 (Div. 1, Div. 2, based on COMPFEST 15 — Final Round) Editorial
9504 Minimum Maximum Distance dfs and similar dp graphs shortest paths trees Statement F Codeforces Round 903 (Div. 3) {1881} PROGRAMMING 121327
7063 Tree XOR bitmasks dfs and similar dp greedy trees Statement D Codeforces Round 899 (Div. 2) {1882} PROGRAMMING 2000.0 Codeforces Round 899 (Div. 2) Editorial
153 Doremy's Average Tree dp trees Statement F Codeforces Round 906 (Div. 1) {1889} PROGRAMMING 3500.0 Codeforces Round 906 Editorial
14968 Anji's Binary Tree dfs and similar dp shortest paths trees Statement C Codeforces Round 911 (Div. 2) {1900} PROGRAMMING 1250.0 Codeforces Round 911 (Div. 2) Editorial
1972 Compressed Tree dfs and similar dp graphs greedy trees Statement E Educational Codeforces Round 158 (Rated for Div. 2) {1901} PROGRAMMING Educational Codeforces Round 158 Editorial
1263 One-X combinatorics dp math Statement E Codeforces Round 915 (Div. 2) {1905} PROGRAMMING 2250.0 Codeforces Round 915 (Div. 2) Editorial
4117 Array Collapse data structures divide and conquer dp trees Statement D Educational Codeforces Round 160 (Rated for Div. 2) {1913} PROGRAMMING 123493
2632 Happy Life in University brute force data structures dfs and similar dp implementation trees Statement E Good Bye 2023 {1916} PROGRAMMING 2000.0
234 Optimizations From Chelsu divide and conquer dp number theory trees Statement G Good Bye 2023 {1916} PROGRAMMING 3750.0
1188 Construct Tree bitmasks constructive algorithms dp trees Statement F Codeforces Round 917 (Div. 2) {1917} PROGRAMMING 3000.0 Editorial of Codeforces Round 917 (Div. 2)
5114 Count Paths data structures dfs and similar divide and conquer dp dsu trees Statement E Educational Codeforces Round 162 (Rated for Div. 2) {1923} PROGRAMMING Educational Codeforces Round 162 Editorial
4506 Vlad and Trouble at MIT dfs and similar dp flows graphs greedy implementation trees Statement G Codeforces Round 928 (Div. 4) {1926} PROGRAMMING 126132
2065 Sasha and the Happy Tree Cutting bitmasks brute force dp fft graphs greedy trees Statement E Codeforces Round 926 (Div. 2) {1929} PROGRAMMING 2500.0 Codeforces Round #926 (Div. 2) Editorial.
5740 Sasha and a Walk in the City combinatorics dfs and similar dp math trees Statement D Codeforces Round 926 (Div. 2) {1929} PROGRAMMING 2000.0 Codeforces Round #926 (Div. 2) Editorial.
198 Farmer John's Favorite Intern data structures dp flows trees Statement H CodeTON Round 8 (Div. 1 + Div. 2, Rated, Prizes!) {1942} PROGRAMMING 4500.0 CodeTON Round 8 Editorial
13674 Tree Cutting binary search dp greedy implementation trees Statement C Codeforces Round 936 (Div. 2) {1946} PROGRAMMING 1500.0 Codeforces Round #936 (Div. 2) Editorial
203 Grove dp dp dp geometry Statement A European Championship 2024 - Online Mirror (Unrated, ICPC Rules, Teams Preferred) {1949} PROGRAMMING European Championship 2024 (EUC) Editorial
357 Thanos Snap dp games greedy trees Statement H Codeforces Global Round 25 {1951} PROGRAMMING 3500.0 Codeforces Global Round 25 Editorial
2227 Fenwick Tree bitmasks brute force combinatorics data structures dp math trees Statement C Codeforces Round 942 (Div. 1) {1967} PROGRAMMING 1250.0 Tutorial 2300
4314 Game on Tree (Medium) dfs and similar dp games trees Statement C2 Helvetic Coding Contest 2024 online mirror (teams allowed, unrated) {1970} PROGRAMMING Helvetic Coding Contest 2024 Editorial 1700
2412 Game on Tree (Hard) dfs and similar dp games trees Statement C3 Helvetic Coding Contest 2024 online mirror (teams allowed, unrated) {1970} PROGRAMMING Helvetic Coding Contest 2024 Editorial 1900
867 Min-Fund Prison (Medium) brute force dfs and similar dp graphs trees Statement G2 Helvetic Coding Contest 2024 online mirror (teams allowed, unrated) {1970} PROGRAMMING Helvetic Coding Contest 2024 Editorial 2200
538 Min-Fund Prison (Hard) bitmasks dfs and similar dp graphs trees Statement G3 Helvetic Coding Contest 2024 online mirror (teams allowed, unrated) {1970} PROGRAMMING Helvetic Coding Contest 2024 Editorial 2400
7474 Paint the Tree brute force dfs and similar dp greedy shortest paths trees Statement D Codeforces Round 947 (Div. 1 + Div. 2) {1975} PROGRAMMING 1500.0 editorial_zh.pdf 1700
827 Remove Bridges data structures dfs and similar dp greedy sortings trees Statement F Educational Codeforces Round 166 (Rated for Div. 2) {1976} PROGRAMMING Educational Codeforces Round 166 Editorial
347 Turtle and Paths on a Tree data structures dp trees Statement F Codeforces Round 949 (Div. 2) {1981} PROGRAMMING 3500.0 Simplified Chinese Tutorial
1810 Shuffle constructive algorithms dp greedy trees Statement E Codeforces Global Round 26 {1984} PROGRAMMING 3000.0 Codeforces Global Round 26 Editorial
4059 Wonderful Tree! brute force dfs and similar dp flows greedy trees Statement E EPIC Institute of Technology Round Summer 2024 (Div. 1 + Div. 2) {1987} PROGRAMMING 1750.0 EPIC Institute of Technology Round Summer 2024 (Div. 1 + Div. 2) Editorial
342 Spinning Round (Easy Version) dp trees Statement G1 EPIC Institute of Technology Round Summer 2024 (Div. 1 + Div. 2) {1987} PROGRAMMING 3000.0 EPIC Institute of Technology Round Summer 2024 (Div. 1 + Div. 2) Editorial
5986 The Omnipotent Monster Killer brute force dp trees Statement D Codeforces Round 958 (Div. 2) {1988} PROGRAMMING 2000.0 Editorial of Codeforces Round 958 (Div. 2)
23267 Substring and Subsequence bitmasks brute force dp graphs greedy hashing strings trees Statement B Educational Codeforces Round 167 (Rated for Div. 2) {1989} PROGRAMMING Educational Codeforces Round 167 Editorial
15828 Maximize the Root binary search dfs and similar dp greedy trees Statement D Educational Codeforces Round 168 (Rated for Div. 2) {1997} PROGRAMMING Video Tutorial
2298 Ksyusha and the Loaded Set binary search data structures dp implementation trees Statement H Codeforces Round 966 (Div. 3) {2000} PROGRAMMING 132689
5069 Sheriff's Defense dfs and similar dp trees Statement F Codeforces Round 974 (Div. 3) {2014} PROGRAMMING Discussion stream (With Hints)
7392 Connect the Dots brute force dfs and similar dp dsu graphs math trees Statement D Codeforces Round 976 (Div. 2) and Divide By Zero 9.0 {2020} PROGRAMMING 1500.0 Tutorial for Codeforces Round 976 (Div. 2) and Divide By Zero 9.0
264 Count Leaves dp math number theory Statement F Codeforces Round 976 (Div. 2) and Divide By Zero 9.0 {2020} PROGRAMMING 2750.0 Tutorial for Codeforces Round 976 (Div. 2) and Divide By Zero 9.0
1918 Digital Village (Easy Version) brute force data structures dp dsu graphs greedy implementation math shortest paths trees Statement E1 Codeforces Round 977 (Div. 2, based on COMPFEST 16 - Final Round) {2021} PROGRAMMING 1750.0 Codeforces Round #977 (Div. 2, based on COMPFEST 16 — Final Round) Editorial
1198 Digital Village (Hard Version) data structures dp dsu graphs math trees Statement E2 Codeforces Round 977 (Div. 2, based on COMPFEST 16 - Final Round) {2021} PROGRAMMING 750.0 Codeforces Round #977 (Div. 2, based on COMPFEST 16 — Final Round) Editorial
174 Tree of Life dp greedy trees Statement E Codeforces Round 980 (Div. 1) {2023} PROGRAMMING 2750.0 135341
1047 Choose Your Queries dfs and similar dp graphs greedy trees Statement F Educational Codeforces Round 170 (Rated for Div. 2) {2025} PROGRAMMING Educational Codeforces Round 170 Editorial
397 Bermart Ice Cream data structures dfs and similar divide and conquer dp implementation trees Statement F Educational Codeforces Round 171 (Rated for Div. 2) {2026} PROGRAMMING Educational Codeforces Round 171 Editorial
1892 Alice's Adventures in the Rabbit Hole constructive algorithms dfs and similar dp greedy math probabilities trees Statement E Codeforces Round 986 (Div. 2) {2028} PROGRAMMING 2000.0 Codeforces Round 986 (Div. 2) Editorial
9642 Penchick and Desert Rabbit data structures dfs and similar dp dsu greedy two pointers Statement D Codeforces Round 987 (Div. 2) {2031} PROGRAMMING 2000.0 Codeforces Round 987 (Div. 2) Editorial
2677 Penchick and Chloe's Trees data structures dfs and similar dp greedy sortings trees Statement E Codeforces Round 987 (Div. 2) {2031} PROGRAMMING 2500.0 Codeforces Round 987 (Div. 2) Editorial
1990 Sakurako and Chefir data structures dfs and similar dp trees Statement G Codeforces Round 981 (Div. 3) {2033} PROGRAMMING 135520
1092 Tree Operations binary search dfs and similar dp trees Statement F Codeforces Global Round 27 {2035} PROGRAMMING 2250.0 Codeforces Global Round 27 Editorial
171 Go Learn! (Easy Version) dp trees Statement G1 Codeforces Global Round 27 {2035} PROGRAMMING 2250.0 Codeforces Global Round 27 Editorial
520 Vertex Pairs binary search brute force dfs and similar dp greedy trees Statement E Educational Codeforces Round 172 (Rated for Div. 2) {2042} PROGRAMMING 136886
3796 Medium Demon Problem (hard version) dfs and similar dp dsu graphs implementation trees Statement G2 Codeforces Round 993 (Div. 4) {2044} PROGRAMMING Codeforces Round 993 (Div. 4) Editorial
1307 Kevin and Math Class brute force data structures divide and conquer dp math trees two pointers Statement F Codeforces Global Round 28 {2048} PROGRAMMING 2000.0 Tutorial
5356 Tree Destruction dfs and similar dp greedy trees Statement G Codeforces Round 991 (Div. 3) {2050} PROGRAMMING Разбор Codeforces Round 991 (Div. 3)
395 Managing Cluster dp graphs math trees Statement M 2024-2025 ICPC, NERC, Northern Eurasia Finals (Unrated, Online Mirror, ICPC Rules, Teams Preferred) {2052} PROGRAMMING
4503 Resourceful Caterpillar Sequence dfs and similar dp games graphs implementation trees Statement E Good Bye 2024: 2025 is NEAR {2053} PROGRAMMING 2000.0 Good Bye 2024: 2025 is NEAR Editorial
1016 Nested Segments combinatorics dp math trees Statement E Codeforces Round 997 (Div. 2) {2056} PROGRAMMING 2250.0 Codeforces Round #997 (Div. 2) Editorial
3531 Balanced Tree dfs and similar dp greedy trees Statement D Ethflow Round 1 (Codeforces Round 1001, Div. 1 + Div. 2) {2062} PROGRAMMING 2000.0 Ethflow Round 1 (Codeforces Round 1001, Div. 1 + Div. 2) Editorial
14529 Remove Exactly Two brute force data structures dp graphs greedy sortings trees Statement C Codeforces Round 1000 (Div. 2) {2063} PROGRAMMING 1500.0 Codeforces Round 1000 (Div. 2) — Editorial
2343 Triangle Tree data structures dfs and similar dp dsu greedy trees Statement E Codeforces Round 1000 (Div. 2) {2063} PROGRAMMING 2750.0 Codeforces Round 1000 (Div. 2) — Editorial
265 Morse Code dp greedy sortings trees Statement D European Championship 2025 - Online Mirror (Unrated, ICPC Rules, Teams Preferred) {2068} PROGRAMMING 140239
10995 Tree Jumps combinatorics dfs and similar dp trees Statement D Educational Codeforces Round 175 (Rated for Div. 2) {2070} PROGRAMMING Video Tutorial
153 Shoo Shatters the Sunshine combinatorics dp trees Statement F Codeforces Round 1024 (Div. 1) {2101} PROGRAMMING 3750.0 142788
3306 Tree Colorings combinatorics dp graphs math trees Statement E Educational Codeforces Round 180 (Rated for Div. 2) {2112} PROGRAMMING Educational Codeforces Round 180 — Editorial
9365 Reachability and Tree constructive algorithms dfs and similar dp trees Statement D Educational Codeforces Round 180 (Rated for Div. 2) {2112} PROGRAMMING Educational Codeforces Round 180 — Editorial
13931 Kirei Attacks the Estate dfs and similar dp trees Statement E Codeforces Round 1027 (Div. 3) {2114} PROGRAMMING 143268
565 23 Rises Again brute force data structures dfs and similar dp flows graphs implementation probabilities trees Statement H Atto Round 1 (Codeforces Round 1041, Div. 1 + Div. 2) {2127} PROGRAMMING 4000.0 Atto Round 1 (Codeforces Round 1041, Div. 1 + Div. 2) Editorial
3340 Maple and Tree Beauty (Hard Version) bitmasks brute force dfs and similar divide and conquer dp fft trees Statement C2 Codeforces Round 1048 (Div. 1) {2138} PROGRAMMING 750.0 Codeforces Round 1048 (Div. 1, Div. 2) Editorial
5391 Maple and Tree Beauty (Easy Version) dfs and similar dp graphs trees Statement C1 Codeforces Round 1048 (Div. 1) {2138} PROGRAMMING 1250.0 Codeforces Round 1048 (Div. 1, Div. 2) Editorial
249 Rainbow Branch dp trees Statement E Codeforces Round 1064 (Div. 1) {2165} PROGRAMMING 3000.0 148452
7056 Tree, TREE!!! data structures dp trees Statement F Codeforces Round 1062 (Div. 4) {2167} PROGRAMMING Arpa Video Tutorial
7038 Rae Taylor and Trees (hard version) binary search constructive algorithms data structures dp dsu implementation trees Statement F Codeforces Round 1065 (Div. 3) {2171} PROGRAMMING Codeforces Round 1065 (Div. 3) Editorial
11420 Rae Taylor and Trees (easy version) binary search data structures dp dsu greedy implementation trees Statement D Codeforces Round 1065 (Div. 3) {2171} PROGRAMMING Codeforces Round 1065 (Div. 3) Editorial
447 Mosaic Tree combinatorics dp fft math trees Statement F Codeforces Round 1069 (Div. 1) {2174} PROGRAMMING 3500.0 Codeforces Round 1069 Editorial
1291 Blackslex and Plants bitmasks data structures dp math Statement H Codeforces Round 1071 (Div. 3) {2179} PROGRAMMING Codeforces Round 1071 (Div. 3) Editorial
346 Short Garland data structures dp trees Statement G Educational Codeforces Round 186 (Rated for Div. 2) {2182} PROGRAMMING Educational Codeforces Round 186 Editorial
1098 Jumping Man combinatorics data structures dp trees Statement F Hello 2026 {2183} PROGRAMMING 2750.0
3807 Cherry Tree dfs and similar dp graphs trees Statement F Codeforces Round 1072 (Div. 3) {2184} PROGRAMMING Codeforces Round 1072 (Div. 3) Editorial
65 Al Fine (Counting Version) dp trees Statement F2 Codeforces Round 1077 (Div. 1) {2187} PROGRAMMING 3500.0 Codeforces Round 1077 (Div. 1, Div. 2) Editorial
216 Zhora the Vacuum Cleaner dp implementation sortings trees Statement F Codeforces Round 1075 (Div. 2) {2189} PROGRAMMING 3250.0 Codeforces Round 1075 (Div. 2) Editorial
3454 Cost of Tree data structures dfs and similar dp trees Statement D Codeforces Round 1081 (Div. 2) {2192} PROGRAMMING 1750.0 Codeforces Round 1081 (Div. 2) Editorial
1024 Remove the Grail Tree dfs and similar dp greedy trees Statement H Codeforces Round 1076 (Div. 3) {2193} PROGRAMMING Разбор Codeforces Round 1076 (Div. 3)
166 Again Trees... (hard version) bitmasks data structures dfs and similar dp fft trees Statement F2 Codeforces Round 1078 (Div. 2) {2194} PROGRAMMING 1750.0 Codeforces Round #1078 Editorial
871 Again Trees... (Easy Version) bitmasks dfs and similar dp fft trees Statement F1 Codeforces Round 1078 (Div. 2) {2194} PROGRAMMING 1750.0 Codeforces Round #1078 Editorial
8330 Idiot First Search dfs and similar dp trees Statement E Codeforces Round 1080 (Div. 3) {2195} PROGRAMMING Codeforces Round 1080 (Div. 3) Editorial
4713 Simons and Beating Peaks data structures divide and conquer dp greedy implementation trees Statement D Codeforces Round 1083 (Div. 2) {2205} PROGRAMMING 1750.0 Tutorial
216 Christmas Tree Un-decoration data structures dp trees Statement D 2026 ICPC Asia Pacific Championship - Online Mirror (Unrated, Online Mirror, ICPC Rules, Teams Preferred) {2206} PROGRAMMING Tutorial (PDF)
2041 Boxed Like a Fish dfs and similar dp games trees Statement D Codeforces Round 1085 (Div. 1 + Div. 2) {2207} PROGRAMMING 2250.0 Codeforces Round 1085 (Div. 1 + Div. 2) Editorial
807 Minimum Path Cover dp interactive number theory trees Statement E Nebius Round 2 (Codeforces Round 1088, Div. 1 + Div. 2) {2211} PROGRAMMING 2500.0 Nebius Round 2 and Codeforces Round 1088 Editorial
918 Coloring a Red Black Tree dp greedy probabilities trees Statement C Codeforces Round 1093 (Div. 1) {2219} PROGRAMMING 1750.0