Codeforces Round 867 (Div. 3) Solutions
First CF solution write-up
First CF solution write-up
States and state transition equations
For example… the one-stroke problem?

Hash and BFS
AI Translated from Chinese Problem: Luogu UVa 12166 Problem Statement Given a binary tree with depth not exceeding 16, representing a balance scale. Each rod is hung in the center, and the weight of each counterweight is known. What is the minimum number of counterweight weights that need to be modified to balance the scale? — Liu Rujia “Algorithm Competition Introduction Basics” Analysis At first glance, it seems difficult to start with. We can first study what properties a balanced scale has. ...
AI Translated from Chinese Problem: Luogu UVa439 Problem Statement Input an m*n matrix representing a map, where 1 represents obstacles and 0 represents free space. The robot needs to move from (1,1) to (m,n) on the m*n map. Each move can go one cell in one of the four directions (up, down, left, right), and can consecutively cross at most k obstacles. Data satisfies 1 <= m, n <= 20, 0 <= k <= 20. ...

AI Translated from Chinese First time writing a solution ~ Simple, but got stuck for a while. Finally realized I forgot to zero the array XD Problem: Luogu UVa439 Problem Statement Input two coordinates on an 8×8 chessboard (start and end points. Column: ah, Row: 18). Find the minimum number of moves a Knight needs to get from start to end. Analysis Typical BFS shortest path problem. 2D array id[10][10] stores the step count after taking one more step from this cell. Queues qx, qy store coordinates. ...

Reducing unnecessary enumeration

Everything looks like a binary tree lately (
Collision of Python and mathematics