Accel Thinking

Channel

CP Weekly Challenges

Weekly CCC and USACO style problem walkthroughs.

Filter by tag
Filter by year

22 articles

usacosimulationbronzeUSACO 2019 January Bronze Shell Game Solution: Simulate Every Starting PositionTrack one state variable, simulate all three possible starting shells, and avoid the subtle double-if transition bug.Read article →cccenumerationprobabilitysimulationCCC 2013 J5/S3 Chances of Winning Solution: Enumerate Every Remaining ResultModel every unplayed game as a three-way decision, then count all complete futures where the favourite team finishes strictly first.Read article →cccmathparitymanhattan-distanceCCC 2017 J3 Exactly Electrical Solution: Manhattan Distance and ParityUse Manhattan distance and parity to decide whether the car can reach its destination while using exactly all available charge.Read article →usacobronzeenumerationUSACO 2020 December Bronze Daisy Chains Solution: Bounded Enumeration with Exact Average ChecksWalkthrough of USACO 2020 December Bronze Daisy Chains: enumerate every interval, test divisibility for an integer average, and check the average exists in the range. Python and C++ solutions, complexity, and why N=100 makes brute force the intended answer.Read article →cccsliding-windowstringssetshashingCCC 2020 S3 Searching for Strings Solution: Sliding Window, Frequency Signature, Set DeduplicationWalkthrough of CCC 2020 S3 Searching for Strings: slide a fixed window, compare 26-letter frequency signatures, and deduplicate matching substrings with a set. Includes exact and double-hash Python solutions, C++17, proof, and pitfalls.Read article →ccccountingfrequency-arrayCCC 2017 J5/S3 Nailed It! Solution: Count Pairs per Height with a Frequency ArrayFix each fence height, count complement pairs with a frequency array, and track how many heights tie for the best fence.Read article →cccsortingexchange-argumentgreedyCCC 2016 J5/S2 Tandem Bicycle Solution: Sort First, Then Pairing Has Only One AnswerSort both teams, pair in the same order for the minimum or opposite order for the maximum, and prove why with an exchange argument.Read article →ccccenter-expansionintervalsCCC 2023 S2 Symmetric Mountains Solution: Center Expansion for Minimum Asymmetry at Every LengthFix each odd or even center, expand outward, and find the minimum asymmetry for every crop length in O(N²).Read article →ccchash-mapcountingCCC 2022 J4/S2 Group Work Solution: Count Violated Constraints in One Pass with a DictionaryMap each name to its group with a dictionary, then count every violated constraint in two linear passes, with Python and C++ solutions.Read article →usacobronzesimulationUSACO 2018 December Bronze Mixing Milk Solution: Simulating 100 PoursLearn the USACO 2018 December Bronze Mixing Milk solution with direct simulation, cyclic updates, invariants, and tested Python and C++ code.Read article →cccgeometrycountingCCC 2023 J4/S1 Trianglane Solution: Perimeter by Counting Shared EdgesLearn CCC 2023 J4/S1 Trianglane with perimeter counting, shared edges, parity, and O(C) Python and C++ solutions.Read article →cccdsaroadmapjunior-to-seniorCCC DSA Roadmap: Data Structures and Algorithms from Junior to SeniorA CCC DSA roadmap from Junior to Senior, covering simulation, strings, grids, counting, prefix sums, graph search, greedy, DSU, shortest paths, dynamic programming, and typical historical CCC problems.Read article →cccprefix-sumssimulationCCC 2017 S1 Sum Game Solution: Running Prefix Sums and Last Equal DayLearn how to solve Sum Game with running prefix sums, cumulative totals, and last-valid-position tracking in Python and C++.Read article →cccflood-fillbfsgridCCC 2024 J5 Harvest Waterloo Solution: Flood Fill and Grid BFSLearn how to solve CCC 2024 J5 Harvest Waterloo with flood fill, BFS, connected components, and grid accumulation in Python and C++.Read article →cccgraphbfsimplicit-graphCCC 2020 J5/S2 Escape Room Solution: BFS on an Implicit GraphLearn how to solve Escape Room with BFS on an implicit graph, product-to-cells indexing, and visited-value optimization in Python and C++.Read article →cccparitycountingCCC 2021 J5/S2 Modern Art Solution: Count Gold Cells with ParityLearn how to solve Modern Art with parity, row and column toggling, and an O(M + N + K) counting formula in Python and C++.Read article →cccprefix-sumsarraysCCC 2025 J4 Sunny Days Solution: Longest Sunny Streak After One FixLearn how to solve Sunny Days with prefix and suffix streak counts, one-day correction logic, and Python/C++ implementations.Read article →cccdpgridCCC 2025 J5 - Connecting Territories Solution & AnalysisUse dynamic programming, local neighbor transitions, and rolling arrays to find the minimum-cost path through a repeating-cost grid.Read article →cccgeometrysparse-coordinatesCCC 2022 J5 - Square Pool Solution & AnalysisUse sparse tree coordinates, candidate top-left corners, and careful shrinking to find the largest empty square.Read article →cccgridsearchCCC 2023 J5 - Word Hunt Solution & AnalysisUse grid search, direction vectors, and one right-angle bend to count every hidden occurrence of a word.Read article →cccgrid-simulationvisited-setcoordinatessimulationCCC 2026 J4 - Snail Path Solution & AnalysisSimulate the snail step by step, track slimy squares with a visited set, and count every revisit.Read article →cccintervalsdifference-arrayprefix-sumssweep-lineCCC 2026 J5/S2 - Beams of Light Solution & AnalysisUse interval coverage, a difference array, and prefix sums to answer illumination queries efficiently.Read article →