brain

tamnd's digital brain — notes, problems, research

41650 notes

CF 1076G - Array Game

We are given a one-dimensional board where each cell contains a positive number of tokens. A chip starts on the left boundary of a chosen segment, and players alternate moves.

codeforcescompetitive-programmingdata-structuresgames
CF 1076C - Meme Problem

We are given a number $d$, and we want to decide whether we can split it into two non-negative real numbers $a$ and $b$ such that two conditions hold at the same time: their sum equals $d$, and their product also equals $d$.

codeforcescompetitive-programmingbinary-searchmath
CF 1076D - Edge Deletion

We are given a weighted undirected graph and we first imagine running a shortest path computation from vertex 1. This produces a distance value for every vertex, which we can think of as the true optimal cost of reaching that vertex in the original graph.

codeforcescompetitive-programminggraphsgreedyshortest-paths
CF 1076F - Summer Practice Report

We are given a sequence of pages, and each page contains a fixed number of two types of items: tables and formulas.

codeforcescompetitive-programmingdpgreedy
CF 1073F - Choosing Two Paths

We are given a tree, meaning a connected graph with no cycles. On this tree we must pick two simple paths, each defined by choosing two endpoints. The endpoints of the two paths must all be distinct, and neither path is allowed to contain either endpoint of the other path.

codeforcescompetitive-programmingdfs-and-similardpgreedytrees
CF 1073G - Yet Another LCP Problem

We are given a fixed string, and each query asks us to compare two groups of suffixes of this string. Every element in the query is a starting position in the string, so each position represents the suffix beginning there.

codeforcescompetitive-programmingdata-structuresstring-suffix-structures
CF 1073A - Diverse Substring

We are given a single string consisting of lowercase letters, and we are asked to find any contiguous segment of this string such that no single character dominates that segment by appearing more than half of its length. If such a segment exists, we may output any one of them.

codeforcescompetitive-programmingimplementationstrings
CF 1073B - Vasya and Books

We are given a stack of books where each book has a unique label. The stack order matters: the first array describes which book is at the top, and the last element is at the bottom.

codeforcescompetitive-programmingimplementationmath
CF 1073D - Berland Fair

We are simulating a cyclic walk over an array of booth prices. Polycarp starts at position 1 and keeps moving clockwise in a fixed cycle. At each booth, he checks whether his remaining money is at least the price of one candy at that booth.

codeforcescompetitive-programmingbinary-searchbrute-forcedata-structuresgreedy
CF 1070L - Odd Federalization

We are given an undirected graph of cities and roads. The task is to partition all vertices into some number of groups, and we are allowed to choose how many groups we want.

codeforcescompetitive-programmingconstructive-algorithms
CF 1070M - Algoland and Berland

We are given two sets of points in the plane, one set belonging to Algoland and the other to Berland. The task is to construct exactly $a + b - 1$ straight line segments, each connecting one Berland city to one Algoland city. Every segment becomes a bidirectional road.

codeforcescompetitive-programmingconstructive-algorithmsdivide-and-conquergeometry
CF 1070J - Streets and Avenues in Berhattan

We are given a grid-like city structure formed by two independent labelings. There are horizontal streets and vertical avenues, and every street intersects every avenue, so each intersection corresponds to a pair consisting of one street and one avenue.

codeforcescompetitive-programmingdp
CF 1070H - BerOS File Suggestion

We are given a fixed collection of short file names and a stream of queries. Each query is a short string, and we must determine how many file names contain that string as a contiguous substring.

codeforcescompetitive-programmingbrute-forceimplementation
CF 1070G - Monsters and Potions

We are given a one-dimensional board of length $n$. Each cell can contain a monster with some HP, a potion that increases HP, or be empty. In addition, there are $m$ heroes initially placed on distinct empty cells, each hero starting with its own HP.

codeforcescompetitive-programmingbrute-forcedpgreedyimplementation
CF 1070D - Garbage Disposal

Each day produces some number of garbage units, and every unit must be thrown away either on the day it appears or on the following day.

codeforcescompetitive-programminggreedy
CF 1070B - Berkomnadzor

We are given a collection of constraints over IPv4 addresses, where each constraint describes a contiguous interval of 32-bit integers. Some intervals are marked as forbidden and some are marked as required to remain accessible.

codeforcescompetitive-programmingdata-structuresgreedy
CF 1070C - Cloud Computing

We are given a timeline of n days. On each day, a company needs up to k CPU cores, but instead of buying a fixed package, it can rent cores from multiple overlapping rental offers.

codeforcescompetitive-programmingdata-structuresgreedy
CF 1070A - Find a Number

We are looking for a positive integer that satisfies two simultaneous constraints. First, it must be divisible by a given integer $d$. Second, when written in decimal form, the sum of its digits must equal a given value $s$.

codeforcescompetitive-programmingdpgraphsnumber-theoryshortest-paths
CF 1068C - Colored Rooks

We are asked to construct a geometric configuration of colored rooks on a huge grid so that connectivity properties encode a given graph on colors. Each color corresponds to a set of points on a $10^9 times 10^9$ grid. Each point is a rook.

codeforcescompetitive-programmingconstructive-algorithmsgraphs
CF 1068A - Birthday

We are dealing with a fixed universe of distinct coin types, where there are N possible different coins in total. Ivan already owns K distinct coins from this universe. Now M friends will each give him gifts, and each friend must contribute the same number of coins.

codeforcescompetitive-programmingmath
CF 1067E - Random Forest Rank

We are given a tree with $n$ vertices. Each edge is independently kept with probability $1/2$, so after the process we obtain a random forest. For every such resulting forest, we can build its adjacency matrix over real numbers and take its linear algebraic rank.

codeforcescompetitive-programmingdpgraph-matchingsmathtrees
CF 1067D - Computer Game

We are given a collection of quests, each with two reward values and a success probability. Every second, Ivan chooses one quest and attempts it.

codeforcescompetitive-programmingdpgreedymathprobabilities
CF 1067B - Multihedgehog

We are given a tree with $n$ vertices and asked whether it can be generated by a very specific recursive construction parameterized by $k$.

codeforcescompetitive-programmingdfs-and-similargraphsshortest-paths
CF 1067C - Knights

We are asked to choose positions for $n$ knights on an infinite chessboard. After placing them, the board evolves deterministically: whenever an empty cell has at least four knights that can attack it in one knight move, a new knight is added there.

codeforcescompetitive-programmingconstructive-algorithms
CF 1067A - Array Without Local Maximums

We are given an array of length ( n ), where each position must eventually contain an integer between 1 and 200. Some positions are already fixed, while others are unknown and marked as (-1).

codeforcescompetitive-programmingdp
CF 1066E - Binary Numbers AND Sum

We are given two very large binary numbers, not as integers but as strings. The first number is fixed throughout the process, while the second number keeps shrinking. The process is mechanical: start with the full value of b.

codeforcescompetitive-programmingdata-structuresimplementationmath
CF 1066C - Books Queries

We are simulating a growing sequence of books placed on a shelf. Each book has a unique identifier, and we only ever add books either to the far left end or the far right end of the current arrangement. Over time, this produces a fixed linear ordering of all inserted books.

codeforcescompetitive-programmingimplementation
CF 1066D - Boxes Packing

We are given a sequence of objects laid out from left to right, each with a positive size, and a fixed number of identical boxes, each having the same capacity.

codeforcescompetitive-programmingbinary-searchimplementation
CF 1057B - DDoS

We are given a timeline split into seconds. For each second, we know how many requests hit a server. This gives us an array where each position represents request volume in that second.

codeforcescompetitive-programming*specialbrute-force
CF 1057C - Tanya and Colored Candies

We are given a row of candy boxes, each positioned at an integer coordinate. Every box contains a fixed number of candies, all sharing the same color, and each box is either red, green, or blue. We start at a specific box.

codeforcescompetitive-programming*specialdp
CF 1056C - Pick Heroes

Two players are building two equally sized teams by alternately taking heroes from a common pool of $2n$ candidates. Each hero has a fixed strength, and once taken it disappears from the game.

codeforcescompetitive-programminggreedyimplementationinteractivesortings
CF 1055G - Jellyfish Nightmare

We are given a fixed convex shape representing Bob, which can only move by translation inside a vertical swimming lane bounded by two vertical lines. Bob starts far below the plane and must reach far above it.

codeforcescompetitive-programming
CF 1055D - Refactoring

We are given several pairs of strings, where each pair describes how a variable name currently looks and how it should look after a single global refactoring operation.

codeforcescompetitive-programminggreedyimplementationstrings
CF 1055C - Lucky Days

Two people have periodic patterns of “good intervals” on the number line of days. Each pattern consists of a fixed segment of consecutive days inside a repeating cycle.

codeforcescompetitive-programmingmathnumber-theory
CF 1055A - Metro

The metro system can be seen as a line of stations from 1 to n, with two directed ways of movement. One track allows movement from smaller indices to larger ones, while the other allows movement in the opposite direction. Bob starts at station 1 and wants to reach station s.

codeforcescompetitive-programminggraphs
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 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 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 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