brain

tamnd's digital brain — notes, problems, research

43815 notes

CF 1046I - Say Hello

We are given two points moving in the plane over time, but their motion is only specified at discrete timestamps. Between consecutive timestamps, each friend moves in a straight line at constant speed, so the position at any intermediate time is obtained by linear interpolation.

codeforcescompetitive-programminggeometry
CF 1046C - Space Formula

We are given a leaderboard of astronauts sorted by their current total points in non-increasing order, meaning the first astronaut currently has the highest score and the last has the lowest. One specific astronaut, identified by their position $D$, is the one we care about.

codeforcescompetitive-programminggreedy
CF 92114 - Labyrinth-14

I can’t reliably write a correct 3200-rated editorial from just the title and a broken/empty statement link. The structure you provided points to Codeforces 921 Problem 1, but the actual problem content (grid/graph rules, input format, and what needs to be computed) is…

codeforcescompetitive-programming
CF 92112 - Labyrinth-12

The task describes a large grid maze where each cell is a room and adjacent rooms may or may not be traversable directly. Between neighboring cells there can be empty space, a wall, or a locked door. The robot starts at a fixed cell and must reach any one of several exit cells.

codeforcescompetitive-programming
CF 92110 - Labyrinth-10

I can’t write a correct 3200-rated editorial from just the problem link because the statement content isn’t included here and I don’t have access to fetch it.

codeforcescompetitive-programming
CF 92108 - Labyrinth-8

I can’t reliably access the full statement from that Codeforces link in this environment, and for a 3200-rated problem I’d need the exact rules to avoid hallucinating details.

codeforcescompetitive-programming
CF 92107 - Labyrinth-7

I can write the full editorial in the exact format you want, but I need the actual problem statement content. The link alone (921/problem/01) is not accessible from here, and without the statement I’d have to guess the rules, which would make the editorial unreliable at a…

codeforcescompetitive-programming
CF 92106 - Labyrinth-6

I can’t safely write a correct full editorial for “Labyrinth-6” from Codeforces 921 without the actual problem statement content. Right now, the only thing available is the title and rating, and the link itself does not expose the statement text in a way I can rely on.

codeforcescompetitive-programming
CF 92105 - Labyrinth-5

I can’t reliably access the full statement from that Codeforces link in this environment, and for a 3200-rated problem I can’t safely reconstruct it from the title alone without risking inventing details.

codeforcescompetitive-programming
CF 92103 - Labyrinth-3

I cannot write a correct 3200-level editorial for this problem yet because the actual problem statement content for Labyrinth-3 (92103) is not available in your prompt.

codeforcescompetitive-programming
CF 92102 - Labyrinth-2

I cannot responsibly write a correct 3200-rated editorial for “Codeforces 92102 - Labyrinth-2” from the link you provided because the actual problem statement is not accessible in the material included in your prompt.

codeforcescompetitive-programming
CF 92101 - Labyrinth-1

We can view the labyrinth as a large grid graph where each cell is a vertex and adjacency exists between cells sharing a side. Movement between adjacent cells is sometimes blocked by a permanent wall, sometimes by a door, and otherwise is free.

codeforcescompetitive-programming
CF 920B - Tea Queue

We are simulating a single-server queue that evolves over time. Each student appears at a known second and joins the end of a line. The server is a teapot that can serve exactly one student per second, and serving always goes to the student currently at the front of the queue.

codeforcescompetitive-programmingimplementation
CF 920F - SUM and REPLACE

We are working with an array of integers where two operations are repeatedly applied over ranges. One operation replaces every value in a segment with its number of positive divisors, and the other asks for the sum of values in a segment after all previous updates.

codeforcescompetitive-programmingbrute-forcedata-structuresdsunumber-theory
CF 919A - Supermarket

The task is to decide how to buy a fixed amount of apples while minimizing total cost, given multiple supermarkets with different pricing schemes. Each supermarket does not directly give a per-kilogram price.

codeforcescompetitive-programmingbrute-forcegreedyimplementation
CF 914G - Sum the Fibonacci

We are given a sequence of integers, each of which can be thought of as a 17-bit mask. From this array we must form ordered selections of five positions.

codeforcescompetitive-programmingbitmasksdivide-and-conquerdpfftmath
CF 914E - Palindromes in a Tree

We are given a tree where each node carries a lowercase character from a limited alphabet of size 20. The task is to examine every simple path in the tree and determine whether the multiset of characters along that path can be rearranged into a palindrome.

codeforcescompetitive-programmingbitmasksdata-structuresdivide-and-conquertrees
CF 912E - Prime Gift

We are asked to enumerate a very specific set of integers and then pick a particular element from that ordered list. The allowed numbers are those whose prime factors all come from a fixed small set of given primes.

codeforcescompetitive-programmingbinary-searchdfs-and-similarmathmeet-in-the-middlenumber-theorytwo-pointers
CF 909B - Segments

We are given an integer $N$. From the points $0, 1, 2, dots, N$ on a number line, consider every possible segment whose endpoints are chosen among these points. That means every pair $(l, r)$ with $0 le l < r le N$ defines a segment.

codeforcescompetitive-programmingconstructive-algorithmsmath
CF 909E - Coprocessor

The program consists of tasks that must be executed in an order consistent with a dependency graph. Each task may depend on earlier tasks, forming a directed acyclic graph where execution is only allowed once all prerequisites are completed.

codeforcescompetitive-programmingdfs-and-similardpgraphsgreedy
CF 907B - Tic-Tac-Toe

The board is a 9 by 9 grid, but it is conceptually split into nine 3 by 3 sub-boards arranged in a 3 by 3 macro layout. Each cell can contain either a mark from the first player, a mark from the second player, or be empty. The game is not ordinary tic-tac-toe.

codeforcescompetitive-programmingimplementation
CF 907A - Masha and Bears

We are given four small integers representing sizes of three bears and Masha. The bears require three car sizes that are strictly decreasing from father’s car to son’s car.

codeforcescompetitive-programmingbrute-forceimplementation
CF 902A - Visiting a Friend

We are given a set of teleporters placed along a one-dimensional number line. Pig starts at position 0 and wants to reach position m.

codeforcescompetitive-programminggreedyimplementation
CF 901E - Cyclic Cipher

We are given two integer sequences of length $n$. One sequence $b$ acts as a fixed “key”, and the other sequence $c$ is the observed encrypted output of some unknown sequence $a$ under that key.

codeforcescompetitive-programmingfftmath
CF 901D - Weighting a Tree

We are given a connected undirected graph where every edge must eventually receive an integer weight. For each vertex, we are also given a target value, and the requirement is that if you look at all edges incident to a vertex and sum their weights, that sum must exactly match…

codeforcescompetitive-programmingconstructive-algorithmsdfs-and-similargraphs
CF 901A - Hashing Trees

We are given a rooted tree described indirectly through a “level size profile.” Instead of edges, we only know how many nodes exist at each distance from the root.

codeforcescompetitive-programmingconstructive-algorithmstrees
CF 901C - Bipartite Segments

We are given a graph whose vertices are arranged in a fixed line from 1 to n. The edges are arbitrary, but the structure is restricted so that the graph does not contain any cycle of even length when edges are treated as simple undirected edges.

codeforcescompetitive-programmingbinary-searchdata-structuresdfs-and-similardsugraphstwo-pointers
CF 901B - GCD of Polynomials

We are asked to construct two integer polynomials, each of degree at most $n$, with very small coefficients (each coefficient is either -1, 0, or 1), and both leading coefficients equal to 1.

codeforcescompetitive-programmingconstructive-algorithmsmath
CF 1046F - Splitting money

We are given several Bitcoin wallets, each holding some amount of satoshis. The goal is to redistribute these coins into possibly more wallets so that no wallet ends up holding more than a fixed limit $x$.

codeforcescompetitive-programmingimplementation
CF 1047B - Cover Points

We are given a set of points on a plane. We must place a very specific triangle shape so that every point lies either inside it or on its boundary.

codeforcescompetitive-programminggeometrymath
CF 1047A - Little C Loves 3 I

We are given a single integer $n$, and we need to represent it as a sum of three positive integers $a, b, c$. The extra restriction is that none of these three numbers is allowed to be divisible by 3.

codeforcescompetitive-programmingmath
CF 1051G - Distinctification

We are given a growing sequence of points on the integer line. Each point has a position value and a weight. As we reveal more points one by one, we want to maintain a configuration where all positions are distinct, but we are allowed to move points left or right using very…

codeforcescompetitive-programmingdata-structuresdsugreedy
CF 1051D - Bicolorings

We are working with a very small geometric object: a grid with exactly two rows and $n$ columns. Each cell can independently be painted in one of two colors, which we can think of as black or white.

codeforcescompetitive-programmingbitmasksdp
CF 1051F - The Shortest Statement

We are given a connected undirected weighted graph with up to one hundred thousand vertices and edges, but with a crucial structural restriction: the number of edges exceeds the number of vertices by at most twenty.

codeforcescompetitive-programminggraphsshortest-pathstrees
CF 1051C - Vasya and Multisets

We are given a sequence of numbers, but it behaves like a multiset, meaning duplicates matter and order only matters for output assignment. Each occurrence of a value must be assigned to one of two groups, A or B.

codeforcescompetitive-programmingbrute-forcedpgreedyimplementationmath
CF 1051E - Vasya and Big Integers

We are given one very long decimal string a, and we want to split it into a sequence of contiguous pieces. Each piece is a substring of a, taken in order, and the concatenation of all pieces must reproduce a exactly.

codeforcescompetitive-programmingbinary-searchdata-structuresdphashingstrings
CF 1051B - Relatively Prime Pairs

We are given a contiguous segment of integers from $l$ to $r$, and the task is to partition all these numbers into pairs. Every number must appear in exactly one pair, so the segment is fully covered.

codeforcescompetitive-programminggreedymathnumber-theory
CF 1051A - Vasya And Password

We are given a password string consisting of digits and Latin letters in mixed case. The goal is to end up with a string that contains at least one lowercase letter, at least one uppercase letter, and at least one digit.

codeforcescompetitive-programminggreedyimplementationstrings
CF 1053E - Euler tour

We are given a sequence of length $2n - 1$, which is supposed to represent the order in which a squirrel visits vertices of some tree during a full traversal.

codeforcescompetitive-programmingconstructive-algorithmstrees
CF 1054H - Epic Convolution

We are given two sequences, one indexed by $i$ and one indexed by $j$, and we are asked to combine every pair $(i, j)$ into a single weighted contribution. The weight is not linear or even separable in the usual sense: each pair contributes $$ai cdot bj cdot c^{i^2 j^3}.

codeforcescompetitive-programmingchinese-remainder-theoremfftmathnumber-theory
CF 1054G - New Road Network

We are asked to construct a tree on $n$ labeled vertices, representing citizens, using exactly $n-1$ edges so that the graph is connected and acyclic.

codeforcescompetitive-programmingconstructive-algorithmsgreedymath
CF 1054F - Electric Scheme

We are given a set of points in the plane, each point being an “event location” where a horizontal wire and a vertical wire must cross. Every wire is axis-aligned: horizontal wires lie on a fixed y-coordinate, vertical wires lie on a fixed x-coordinate.

codeforcescompetitive-programmingflowsgraph-matchings
CF 1054C - Candies Distribution

We are given a line of children, and we need to reconstruct any valid assignment of candy counts to them. Each child has already reported two numbers: how many children to their left have strictly more candies than them, and how many children to their right have strictly more…

codeforcescompetitive-programmingconstructive-algorithmsimplementation
CF 1054E - Chips Puzzle

We are given a grid where each cell contains a short string made of characters 0 and 1. Think of each cell as a small stack of chips written in a row, where we can see the order of chips from left to right.

codeforcescompetitive-programmingconstructive-algorithmsimplementationmath
CF 1054D - Changing Array

We are given an array of integers where each value is represented using exactly $k$ bits. Alongside the array, we are allowed a very specific transformation: for any position, we can flip all bits of the number, turning it into its bitwise complement within the $k$-bit space.

codeforcescompetitive-programminggreedyimplementation
CF 1054B - Appending Mex

We are given a sequence that is claimed to be constructed step by step starting from an empty array. At each step, the builder is allowed to look at any subset of elements that already exist in the array, compute the mex of that subset, and append that mex as the next element.

codeforcescompetitive-programmingimplementation
CF 1054A - Elevator or Stairs?

Masha starts on a floor $x$ and wants to reach floor $y$. She has two ways to travel vertically inside the building: stairs or an elevator. The stairs always work in a simple linear way, every move between neighboring floors costs a fixed amount of time $t1$.

codeforcescompetitive-programmingimplementation
CF 1055F - Tree and XOR

The tree gives you a system where every vertex can be assigned a value: the XOR of edge weights on the path from an arbitrary root (say vertex 1) to that vertex.

codeforcescompetitive-programmingstringstrees
CF 1055E - Segments on the Line

We are given an array of values laid out on a line, and a collection of candidate intervals on that line. From these intervals, we must pick exactly $m$ of them.

codeforcescompetitive-programmingbinary-searchdp
CF 1055B - Alice and Hairdresser

We are maintaining an array of hair lengths on a line of positions, and the system evolves over time as some positions grow.

codeforcescompetitive-programmingdsuimplementation
CF 1056F - Write The Contest

The problem describes a scheduling process where each task depends heavily on a continuously changing “skill level”. You are given several problems, each with a difficulty value and a reward.

codeforcescompetitive-programmingbinary-searchdpmath
CF 1056G - Take Metro

We are given a circular metro line with stations numbered from 1 to n. Moving along the circle is always possible in both directions, so from any station we can go clockwise or counter-clockwise with wrap-around.

codeforcescompetitive-programmingbrute-forcedata-structuresgraphs
CF 1056H - Detect Robots

The city is a graph where crossroads are vertices and roads are undirected edges. Each ride is a simple path in this graph, meaning the driver never revisits a vertex within that ride. Across all rides, we observe many such simple paths.

codeforcescompetitive-programmingdata-structuresstrings
CF 1056B - Divide Candies

Each cell in an $n times n$ grid defines a number of candies equal to $i^2 + j^2$, where $i$ and $j$ are the row and column indices. For every cell, we imagine taking that many identical candies and trying to split them evenly among $m$ friends.

codeforcescompetitive-programmingmathnumber-theory
CF 1056D - Decorate Apple Tree

We are given a rooted tree, with node 1 fixed as the root. Only leaf nodes initially receive colors, and all other nodes are uncolored. A leaf, in this problem, is defined as a node whose subtree consists of only itself, which in a rooted tree means a node with no children.

codeforcescompetitive-programmingconstructive-algorithmsdfs-and-similardpgraphsgreedysortingstrees
CF 1056E - Check Transcription

We are given a binary template string s, where each character is either 0 or 1, and a target string t consisting of lowercase letters.

codeforcescompetitive-programmingbrute-forcedata-structureshashingstrings
CF 1056A - Determine Line

We are given a sequence of moments during a tram ride, where each moment corresponds to a stop where Arkady briefly observed which tram lines serve that stop. Each stop lists a set of line identifiers, and Arkady remembers the full set at every observed stop.

codeforcescompetitive-programmingimplementation
CF 1057A - Bmail Computer Network

We are given a growing network of routers that forms a tree rooted at router 1. Every router except the first was added one by one, and each new router was directly connected to exactly one earlier router.

codeforcescompetitive-programming*specialdfs-and-similartrees
CF 1059E - Split the Tree

We are given a rooted tree where every vertex contains a positive weight. The task is to partition all vertices into a minimum number of vertical paths.

codeforcescompetitive-programmingbinary-searchdata-structuresdpgreedytrees
CF 1059D - Nature Reserve

We are given a set of points in the plane, each representing an animal’s location. We need to place a circle that covers all these points. At the same time, there is a fixed horizontal river, which after transformation becomes the x-axis, so the line is $y = 0$.

codeforcescompetitive-programmingbinary-searchgeometryternary-search
CF 1059C - Sequence Transformation

We start with a fixed sequence containing the integers from 1 up to n. We repeatedly perform an operation where we look at all remaining elements, compute their greatest common divisor, record that value, and then delete exactly one element of our choice.

codeforcescompetitive-programmingconstructive-algorithmsmath
CF 1059B - Forgery

We are given a binary grid representing a target drawing made of ink cells. Each cell is either already filled or empty, and we want to determine whether this final pattern could have been produced from an initially empty grid using a specific stamping tool.

codeforcescompetitive-programmingimplementation
CF 1059A - Cashier

We are given a workday of fixed length and a sequence of service intervals where a cashier must be continuously present. Between these service intervals, there are gaps of free time.

codeforcescompetitive-programmingimplementation
CF 1060G - Balls and Pockets

We are given an infinite line of positions starting from zero. Initially, each position i holds a ball labeled i, so the configuration is perfectly aligned: position equals ball number. Some positions are marked as pockets.

codeforcescompetitive-programmingdata-structures
CF 1060F - Shrinking Tree

We are given a tree with up to 50 vertices, and we repeatedly compress it until only one vertex remains. Each operation picks an edge uniformly at random. The two endpoints of that edge disappear, and they are replaced by a single merged vertex.

codeforcescompetitive-programmingcombinatoricsdp
CF 1060H - Sophisticated Device

We are working in a very unusual computational model: instead of directly manipulating variables, we interact with an array of hidden memory cells. Only two of them initially contain unknown values, while all others are initialized to one.

codeforcescompetitive-programmingconstructive-algorithms
CF 1060E - Sergey and Subway

We start with a tree of subway stations. Every station is a node, and every tunnel is an edge, so there is exactly one simple path between any two stations.

codeforcescompetitive-programmingdfs-and-similardptrees
CF 1060B - Maximum Sum of Digits

We are given a single large integer $n$, and we want to split it into two non-negative integers $a$ and $b$ such that their sum stays exactly $n$.

codeforcescompetitive-programminggreedy
CF 1060D - Social Circles

We are given several guests, and each guest has a personal requirement about how they sit in a circular arrangement.

codeforcescompetitive-programminggreedymath
CF 1060C - Maximum Subrectangle

The matrix in this problem is not given explicitly. Instead, every cell is formed by multiplying an element from array a with an element from array b. This creates a grid where each row is a scaled version of b, and each column is a scaled version of a.

codeforcescompetitive-programmingbinary-searchimplementationtwo-pointers
CF 1060A - Phone Numbers

We are given a multiset of digit cards, each card containing a single character from 0 to 9. From these cards, we want to assemble as many valid phone numbers as possible.

codeforcescompetitive-programmingbrute-force
CF 1061F - Lost Root

We are given a tree that is known to be a perfect $k$-ary tree, meaning it has a root, every internal node has exactly $k$ children, and all leaves are at the same depth.

codeforcescompetitive-programminginteractiveprobabilities
CF 1061E - Politics

We are given two different spanning trees over the same set of cities. Each tree represents how one candidate organizes the country, with a chosen root city acting as their capital.

codeforcescompetitive-programmingflowsgraphs
CF 1061D - TV Shows

We are given a collection of time intervals, each representing a TV show that occupies a continuous range of minutes. The key constraint is that a single TV cannot be used to watch two shows whose intervals overlap in time.

codeforcescompetitive-programmingdata-structuresgreedyimplementationsortings
CF 1061B - Views Matter

We are given several vertical stacks of blocks placed side by side. Each position $i$ has a stack of height $ai$. From above, the camera only cares whether a position is occupied or empty, so every column contributes exactly one visible cell as long as it has at least one block.

codeforcescompetitive-programminggreedyimplementationsortings
CF 1061C - Multiplicity

We are asked to count how many subsequences of a given array are “valid” under a position-based divisibility rule.

codeforcescompetitive-programmingdata-structuresdpimplementationmathnumber-theory
CF 1061A - Coins

We are given a collection of coin denominations that includes every integer value from 1 up to n, and we are allowed to use any number of coins of any of these values.

codeforcescompetitive-programminggreedyimplementationmath
CF 1062F - Upgrading Cities

We are given a directed acyclic graph of cities connected by one-way roads. From the constraints, the graph has no directed cycles, so it behaves like a partial order: some cities are comparable through reachability, and others are incomparable.

codeforcescompetitive-programmingdfs-and-similargraphs
CF 1062B - Math

We are given a single integer as a starting point, and we are allowed to transform it using two operations. One operation multiplies the current number by any positive integer we choose, effectively letting us inflate the number arbitrarily.

codeforcescompetitive-programminggreedymathnumber-theory
CF 1062E - Company

The company hierarchy forms a rooted tree where employee 1 is the root, and every other employee has exactly one direct boss. This defines a parent relationship and also induces depths from the root, where depth is the number of edges from employee 1.

codeforcescompetitive-programmingbinary-searchdata-structuresdfs-and-similargreedytrees
CF 1062D - Fun with Integers

We are given a set of integers from the range of absolute values 2 up to n, and each number also has its negative counterpart available. Think of every integer i in this range as a node in a graph, including both i and -i.

codeforcescompetitive-programmingdfs-and-similargraphsimplementationmath
CF 1062C - Banh-mi

We are given a binary array where each position has a value of either zero or one. We repeatedly remove elements from a chosen segment, and every time we remove an element, two things happen: we gain its value immediately, and all remaining elements in that segment get…

codeforcescompetitive-programminggreedyimplementationmath
CF 1062A - A Prank

We are given a strictly increasing array of integers, all between 1 and 1000. Someone is allowed to erase exactly one contiguous block of elements, leaving a gap in the sequence. The remaining elements stay in their original positions.

codeforcescompetitive-programminggreedyimplementation
CF 1063F - String Journey

We are given a single string and we want to decompose it into a sequence of progressively shorter substrings, where each substring in the sequence must appear inside the previous one.

codeforcescompetitive-programmingdata-structuresdpstring-suffix-structures
CF 1063D - Candies for Children

We are simulating a deterministic passing process on a circular arrangement of $n$ children. A box starts at position $l$ and is passed clockwise.

codeforcescompetitive-programmingbrute-forcemath
CF 1063E - Lasers and Mirrors

The maze is an $n times n$ grid where each cell can either be empty or contain a fixed type of mirror that behaves like a 45-degree reflector. A laser starts from each column on the southern boundary and travels northward into the grid.

codeforcescompetitive-programmingconstructive-algorithmsmath
CF 1063C - Dwarves, Hats and Extrasensory Abilities

We are interacting with an unknown assignment of colors to points, where the opponent can choose each point’s color after seeing where we place it. We must output a sequence of distinct integer-coordinate points.

codeforcescompetitive-programmingbinary-searchconstructive-algorithmsgeometryinteractive
CF 1063A - Oh Those Palindromes

We are given a multiset of lowercase letters. We are allowed to rearrange these letters into any order we want, forming a new string of the same length. For any resulting string, we look at every contiguous substring and check whether it is a palindrome.

codeforcescompetitive-programmingconstructive-algorithmsstrings
CF 1063B - Labyrinth

The task places us on a grid maze where each cell is either open or blocked. We start from a given cell and can move in the four cardinal directions as long as we stay inside the grid and avoid obstacles.

codeforcescompetitive-programminggraphsshortest-paths
CF 1064A - Make a triangle!

We are given three positive integers representing the current lengths of three sticks. In one move, we are allowed to pick exactly one stick and increase its length by one unit.

codeforcescompetitive-programmingbrute-forcegeometrymath
CF 1064B - Equations of Mathematical Magic

The equation links a number a with a variable x using two operations: subtraction and bitwise XOR. For each given value of a, we are asked to count how many non-negative integers x satisfy the identity a - (a XOR x) - x = 0. The input consists of several independent values of a.

codeforcescompetitive-programmingmath
CF 1065F - Up and Down the Tree

We are given a rooted tree with vertex 1 as the root, and every vertex except the root has exactly one parent defined by the input. Some vertices are leaves in the usual sense of the tree structure.

codeforcescompetitive-programmingdfs-and-similardptrees
CF 1065G - Fibonacci Suffix

We are working with a family of binary strings built in the same recursive way as Fibonacci numbers, except instead of addition we concatenate strings.

codeforcescompetitive-programmingstrings
CF 1065E - Side Transmutations

We are given strings of length n over an alphabet of size Instead of tracking how a single string evolves, the real question is to understand which positions in the string are fundamentally indistinguishable under repeated application of these operations.

codeforcescompetitive-programmingcombinatoricsstrings
CF 1065D - Three Pieces

We are given an $N times N$ grid where every cell contains a unique number from $1$ to $N^2$. These numbers define a forced visiting order: we must start at the cell containing 1, then eventually reach the cell containing 2, then 3, and continue in increasing order until $N^2$.

codeforcescompetitive-programmingdfs-and-similardpshortest-paths
CF 1065B - Vasya and Isolated Vertices

We are given a simple undirected graph with a fixed number of vertices and edges. The graph has no self-loops and no duplicate edges.

codeforcescompetitive-programmingconstructive-algorithmsgraphs
CF 1065A - Vasya and Chocolate

Vasya has a fixed amount of money and wants to maximize how many chocolate bars he ends up with under a repeating promotion. Every bar has a fixed price, so his initial purchasing power is simply how many bars he can buy directly.

codeforcescompetitive-programmingimplementationmath
CF 1065C - Make It Equal

We are given a collection of vertical towers, each represented by a positive integer height. In one operation we choose a target height $H$, and then every tower that is taller than $H$ is cut down to exactly $H$, while shorter towers remain unchanged.

codeforcescompetitive-programminggreedy
CF 1066F - Yet another 2D Walking

We are given a set of points in the first quadrant of the grid, and Maksim starts at the origin. In one move he can step to any of the four neighboring lattice points, so every move costs one unit of Manhattan distance. The key restriction is not geometric but structural.

codeforcescompetitive-programmingdp
CF 1066B - Heaters

We are given a one-dimensional house represented as a binary array. Some positions contain heaters, marked with 1, while empty positions are 0. Every heater, if activated, warms a continuous interval around its position.

codeforcescompetitive-programminggreedytwo-pointers