brain

tamnd's digital brain — notes, problems, research

43815 notes

CF 1200F - Graph Traveler

We are given a directed graph where each vertex behaves like a deterministic machine with a twist: the outgoing edge is not fixed, but chosen based on a changing integer state $c$.

codeforcescompetitive-programmingbrute-forcedata-structuresdfs-and-similardpgraphsimplementationmathnumber-theory
CF 1200D - White Lines

We are given an $n times n$ grid where each cell is either black or white. A single operation is allowed exactly once: we choose a top-left corner of a $k times k$ square and repaint every cell inside that square to white.

codeforcescompetitive-programmingbrute-forcedata-structuresdpimplementationtwo-pointers
CF 1200A - Hotelier

We are simulating a very small system: a hotel with exactly 10 rooms indexed from 0 to 9. Each room can either be empty or occupied.

codeforcescompetitive-programmingbrute-forcedata-structuresimplementation
CF 1199B - Water Lily

A water lily is attached to the bottom of a lake by a straight stem. Initially the stem is perfectly vertical, so the flower sits directly above its root point on the lake bed. The flower is floating above the water surface by a known height (H).

codeforcescompetitive-programminggeometrymath
CF 1198D - Rectangle Painting 1

We are given a binary grid where some cells are black and the rest are already white. Our only operation is to pick any axis-aligned rectangle and repaint every cell inside it to white. Each such operation has a cost equal to the larger of its height or width.

codeforcescompetitive-programmingdp
CF 1198E - Rectangle Painting 2

We are given an extremely large $n times n$ grid, but instead of listing individual black cells, the input describes black regions as up to 50 axis-aligned rectangles. Every cell outside these rectangles is white initially, and inside them is black.

codeforcescompetitive-programmingflowsgraph-matchingsgraphs
CF 1198A - MP3

We are given a sequence of sound intensities, each a non-negative integer. Think of it as a time series of sampled audio amplitudes.

codeforcescompetitive-programmingsortingstwo-pointers
CF 1198C - Matching vs Independent Set

We are given several undirected graphs, each with exactly $3n$ vertices. For each graph, we must construct one of two specific structures of size $n$: either a matching consisting of $n$ edges, or an independent set consisting of $n$ vertices.

codeforcescompetitive-programmingconstructive-algorithmsgraphsgreedysortings
CF 1198B - Welfare State

We are maintaining a dynamic list of balances for a fixed set of citizens. Initially, each citizen has a known amount of money. Then a sequence of events modifies these balances in two different ways.

codeforcescompetitive-programmingbinary-searchbrute-forcedata-structuressortings
CF 1197E - Culture Code

We are given a collection of matryoshka dolls. Each doll has two parameters: an outer volume and an inner empty volume. A doll can be placed inside another if the outer volume of the inner doll does not exceed the inner volume of the outer doll.

codeforcescompetitive-programmingbinary-searchcombinatoricsdata-structuresdpshortest-pathssortings
CF 1197F - Coloring Game

Each strip can be viewed as a line of positions, and each position holds a chip. A chip starts at the rightmost cell of its strip, and players alternately move exactly one chip per turn, pushing it left by 1, 2, or 3 positions, as long as the move stays inside the strip and is…

codeforcescompetitive-programmingdpgamesmatrices
CF 1197A - DIY Wooden Ladder

We are given several independent sets of wooden planks, where each plank has a fixed length and cannot be cut. From each set, we want to assemble a structure called a ladder with as many steps as possible. A k-step ladder is formed by selecting exactly k + 2 planks.

codeforcescompetitive-programminggreedymathsortings
CF 1197B - Pillars

We are given a row of pillars, each initially holding exactly one disk. Each disk has a distinct radius, so we can think of the input as a permutation of values from 1 to n placed on positions 1 through n. The only allowed move is very restrictive.

codeforcescompetitive-programminggreedyimplementation
CF 1197D - Yet Another Subarray Problem

We are given a sequence of numbers and asked to pick one contiguous segment, or skip picking anything at all, in order to maximize a specific score function. The score of a chosen segment is its plain sum minus a penalty that depends only on its length.

codeforcescompetitive-programmingdpgreedymath
CF 1196E - Connected Component on a Chessboard

We are working on an infinite checkerboard indexed by positive integer coordinates. The cell at (1, 1) is fixed as white, and colors alternate like a standard chessboard: parity of (x + y) determines whether a cell is black or white.

codeforcescompetitive-programmingconstructive-algorithmsimplementation
CF 1196F - K-th Path

We are given an undirected weighted graph where every pair of vertices is connected by at least one path. Between any two vertices, there is a well-defined shortest path length.

codeforcescompetitive-programmingbrute-forceconstructive-algorithmsshortest-pathssortings
CF 1196D2 - RGB Substring (hard version)

We are given a string made only of the letters R, G, and B. From this string we want to pick a contiguous block of fixed length k and modify characters so that this block matches some segment of an infinite repeating pattern "RGBRGBRGB...".

codeforcescompetitive-programmingdata-structuresdpimplementationtwo-pointers
CF 1196C - Robot Breakout

We are given several independent queries. Each query describes a set of robots placed on an infinite grid. Every robot starts at a fixed coordinate, and it also has a personal movement system described by which of the four cardinal directions it can use.

codeforcescompetitive-programmingimplementation
CF 1196B - Odd Sum Segments

We are given several independent arrays. For each one, we must cut it into exactly k contiguous pieces, where each piece has an odd sum. The array order is fixed, so the only freedom is choosing cut positions.

codeforcescompetitive-programmingconstructive-algorithmsmath
CF 1196D1 - RGB Substring (easy version)

We are given a string made only of three characters, R, G, and B. From this string, we want to find a contiguous segment of fixed length k that is as close as possible to the repeating pattern RGBRGBRGB....

codeforcescompetitive-programmingimplementation
CF 1195F - Geometers Anonymous Club

We are given a sequence of convex polygons, and each polygon is described by its vertices in counterclockwise order. For any query interval $[l, r]$, we conceptually take all polygons in that range and compute their Minkowski sum.

codeforcescompetitive-programmingdata-structuresgeometrymathsortings
CF 1195E - OpenStreetMap

We are given a large grid whose values are not stored explicitly but generated in row-major order from a linear recurrence. Each cell represents a height value.

codeforcescompetitive-programmingdata-structurestwo-pointers
CF 1195B - Sport Mafia

We are simulating a process that evolves in discrete moves. There is a container that starts empty, and Alya performs exactly n actions. The first action is fixed: she always adds exactly one candy.

codeforcescompetitive-programmingbinary-searchbrute-forcemath
CF 1195A - Drinks Choosing

We are given a group of students, each of whom prefers exactly one type of drink. The drink types are numbered from 1 to k. The preferences form an array where each entry tells us which drink a particular student likes.

codeforcescompetitive-programminggreedymath
CF 1195D1 - Submarine in the Rybinsk Sea (easy edition)

We are given an array of numbers, all written with the same number of digits. For every ordered pair of elements in this array, we must compute a special digit-interleaving function that builds a new number by taking digits from the two inputs in alternating order starting…

codeforcescompetitive-programmingcombinatoricsmathnumber-theory
CF 1194G - Another Meme Problem

We are asked to count ordered pairs of positive integers $(x, y)$ with both coordinates at most a very large bound $n$, where $n$ can have up to 100 decimal digits.

codeforcescompetitive-programmingdp
CF 1194E - Count The Rectangles

We are given a collection of axis-aligned line segments in the plane. Each segment is either perfectly horizontal or perfectly vertical. Horizontal segments never overlap with other horizontal segments, and the same is true for vertical segments.

codeforcescompetitive-programmingbitmasksbrute-forcedata-structuresgeometrysortings
CF 1194D - 1-2-K Game

We are given a single chip placed at the right end of a linear strip of cells indexed from 0 up to n. Two players alternate moves starting from the rightmost position n, and each move consists of shifting the chip left by exactly 1, 2, or k positions, as long as the chip stays…

codeforcescompetitive-programminggamesmath
CF 1194A - Remove a Progression

We start with a list containing the integers from 1 to n in increasing order. The process repeatedly removes elements from this list in a very specific way: on the first step we remove the first remaining element, on the second step we remove what is now the second remaining…

codeforcescompetitive-programmingmath
CF 1194B - Yet Another Crosses Problem

We are given several independent grids. Each grid is a matrix of characters where each cell is either already black or still white. We are allowed to turn white cells into black one at a time. The goal is to make the grid contain at least one “cross”.

codeforcescompetitive-programmingimplementation
CF 1193C - Scissors and Tape

We are given two simple polygons in the plane, an initial shape and a target shape. Both polygons have equal area, but their geometry can be completely different.

codeforcescompetitive-programming*specialconstructive-algorithmsgeometry
CF 1193A - Amusement Park

We are given a set of attractions and some planned one-way slides between pairs of them. After construction, each slide can be reversed or kept as is, independently of others. What we ultimately choose is therefore just a direction for every existing edge.

codeforcescompetitive-programming*specialdpmath
CF 1193B - Magic Tree

We are given a rooted tree where vertex 1 is the root, and each other vertex has exactly one parent, so the structure is fixed and acyclic. Some non-root vertices contain a single fruit.

codeforcescompetitive-programming*specialdata-structuresdptrees
CF 1192C - Cubeword

We are given a collection of strings that can be placed on the edges of a cube. Each string has length between 3 and 10, and we are allowed to use any of them repeatedly. A valid construction consists of taking a cube and assigning one string to each of its 12 edges.

codeforcescompetitive-programming*specialbrute-forcedpmeet-in-the-middle
CF 1192B - Dynamic Diameter

Codeforces 1192B: Dynamic Diameter

codeforcescompetitive-programming*specialdata-structuresdfs-and-similardivide-and-conquertrees
CF 1191A - Tokitsukaze and Enhancement

Codeforces 1191A: Tokitsukaze and Enhancement

codeforcescompetitive-programmingbrute-force
CF 1190A - Tokitsukaze and Discard Items

We are given a long line of items indexed from 1 to $n$. Among them, $m$ positions are marked as special. These special items are removed in a repeated process that works in rounds.

codeforcescompetitive-programmingimplementationtwo-pointers
CF 1190D - Tokitsukaze and Strange Rectangle

We are given a set of points in the plane, and we are allowed to choose a special kind of region: a vertical strip between two x-coordinates, say between l and r, but open on the sides, combined with a horizontal threshold a such that we only take points strictly above that…

codeforcescompetitive-programmingdata-structuresdivide-and-conquersortingstwo-pointers
CF 1190E - Tokitsukaze and Explosion

We are working in a plane where the origin represents the explosion point. A set of people are placed at integer coordinates, and we are allowed to draw up to $m$ infinite straight lines.

codeforcescompetitive-programmingbinary-searchgreedy
CF 1190C - Tokitsukaze and Duel

We are given a binary string representing a line of cards, each showing either 0 or 1. A move consists of choosing exactly k consecutive positions and forcing all of them to become identical, either all 0 or all 1. The rest of the array is unchanged.

codeforcescompetitive-programmingbrute-forcegamesgreedy
CF 1189C - Candies!

We are given an array of digits. The array length is not arbitrary in queries: every query asks about a segment whose length is exactly a power of two. On each segment, we repeatedly compress the array in a very specific way.

codeforcescompetitive-programmingdata-structuresdpimplementationmath
CF 1188A2 - Add on a Tree: Revolution

I cannot reliably reconstruct the exact statement of Codeforces 1188A2 (“Add on a Tree: Revolution”) from memory alone, and this problem is one of those 2500-rated constructives where small misinterpretations completely change the solution.

codeforcescompetitive-programmingconstructive-algorithmsdfs-and-similarimplementationtrees
CF 1188D - Make Equal

We are given an array of integers, and we are allowed to repeatedly choose a single element and increase it by a power of two, where the chosen power can be any nonnegative exponent independently each time.

codeforcescompetitive-programmingdp
CF 1188C - Array Beauty

We are given an array and asked to examine every subsequence of a fixed length $k$. For each chosen subsequence, we sort its elements mentally and look at all pairwise differences.

codeforcescompetitive-programmingdp
CF 1187G - Gang Up

We are given a small undirected graph representing a town, with a designated meeting point at node 1. Several people start at specified nodes and all want to reach node 1. Time is discrete, and each person can either wait at their current node or traverse one edge per minute.

codeforcescompetitive-programmingflowsgraphs
CF 1187E - Tree Painting

We are given a tree where every vertex starts unpainted, and we gradually paint vertices black. The first move can start anywhere, and after that every move must pick a white vertex that is adjacent to at least one black vertex.

codeforcescompetitive-programmingdfs-and-similardptrees
CF 1187D - Subarray Sorting

We are given two arrays of equal length and allowed to repeatedly pick any contiguous segment of the first array and sort only that segment in non-decreasing order.

codeforcescompetitive-programmingdata-structuressortings
CF 1187F - Expected Square Beauty

We are given an array whose elements are not fixed numbers but independent random integers. Each position $i$ can take any integer in the interval $[li, ri]$, all values equally likely and independent across indices.

codeforcescompetitive-programmingdpmathprobabilities
CF 1187C - Vasya And Array

We are asked to construct any integer array of length $n$ that is consistent with a set of constraints about subarrays. Each constraint describes either that a segment must be non-decreasing or that it must fail to be non-decreasing.

codeforcescompetitive-programmingconstructive-algorithmsgreedyimplementation
CF 1187A - Stickers and Toys

Each query describes a collection of identical eggs. Every egg contains some combination of two possible items: a sticker and a toy. Across all eggs, there are exactly s stickers and exactly t toys in total, and every egg contributes either one or both of these items.

codeforcescompetitive-programmingmath
CF 1186F - Vus the Cossack and a Graph

We are given an undirected simple graph. Every vertex has some initial degree, and we are allowed to delete edges. After deletions, each vertex must still keep at least half of its original incident edges, rounded up.

codeforcescompetitive-programmingdfs-and-similargraphsgreedyimplementation
CF 1186E - Vus the Cossack and a Field

The construction described in this problem defines an infinite binary matrix generated from a small starting grid.

codeforcescompetitive-programmingdivide-and-conquerimplementationmath
CF 1186D - Vus the Cossack and Numbers

We are given an array of real numbers whose total sum is exactly zero. Each number has a fixed decimal precision, so every value can be thought of as a rational number with a known fractional part.

codeforcescompetitive-programmingconstructive-algorithmsgreedymath
CF 1186A - Vus the Cossack and a Contest

We are given a small distribution problem. There are several participants in a contest, and each participant must receive two items: one pen and one notebook.

codeforcescompetitive-programmingimplementation
CF 1185G2 - Playlist for Polycarp (hard version)

We are given a collection of songs, each song having a duration and a genre label from a small set of three possible genres. We want to build an ordered playlist using some of these songs, with two strict rules.

codeforcescompetitive-programmingcombinatoricsdp
CF 1185G1 - Playlist for Polycarp (easy version)

We are given a small collection of songs. Each song has a duration and a genre, and we want to form an ordered playlist by selecting some of these songs without repetition. The playlist must satisfy three constraints at the same time.

codeforcescompetitive-programmingbitmaskscombinatoricsdp
CF 1185A - Ropewalkers

Three people stand on an infinite number line at positions $a$, $b$, and $c$. They are allowed to move along the line, but movement is extremely restricted: at each second, exactly one person may move, and that move is always by one unit either left or right.

codeforcescompetitive-programmingmath
CF 1185E - Polycarp and Snakes

We are given a grid where each cell is either empty or contains a lowercase Latin letter. The final grid is claimed to have been formed by repeatedly drawing “snakes”, where each snake is a straight segment of identical letters placed either horizontally or vertically.

codeforcescompetitive-programmingbrute-forceimplementation
CF 1185C2 - Exam in BerSU (hard version)

We are given a fixed sequence of students, each associated with a positive time value. If a student is allowed to pass the exam, they consume that amount of time, and this time accumulates strictly in order.

codeforcescompetitive-programmingbrute-forcedata-structuresgreedymath
CF 1184E2 - Daleks' Invasion (medium)

We are given a connected undirected graph where each edge represents a corridor with a unique energy cost. The Daleks always intend to build a minimum spanning tree, so among all possible spanning trees they will pick the one with minimum total cost, which is uniquely…

codeforcescompetitive-programmingdfs-and-similargraphsshortest-pathstrees
CF 1184E3 - Daleks' Invasion (hard)

We are given an undirected connected graph with weighted edges, where each edge represents a corridor between two locations and has an associated energy value.

codeforcescompetitive-programmingdata-structuresdsugraphstrees
CF 1184E1 - Daleks' Invasion (easy)

We are given a connected undirected graph where each edge represents a Time Corridor with an associated energy cost. The Daleks do not necessarily use all corridors.

codeforcescompetitive-programminggraphstrees
CF 1184D2 - Parallel Universes (Hard)

We are simulating a probabilistic system that evolves a one-dimensional structure of length l, where a distinguished position called the Doctor’s current universe is fixed inside this structure.

codeforcescompetitive-programmingmathmatrices
CF 1184A3 - Heidi Learns Hashing (Hard)

We are given two strings of equal length and we want to force a collision under a polynomial rolling hash. The hash is defined by interpreting each string as coefficients of a polynomial in a base $r$, and then evaluating it modulo a prime $p$.

codeforcescompetitive-programmingfftmathnumber-theory
CF 1184C2 - Heidi and the Turing Test (Medium)

We are given a set of points on a 2D plane and a fixed radius in Manhattan distance. The task is to choose a center anywhere in the plane, not necessarily at an integer coordinate, and find the largest number of given points that lie within Manhattan distance at most r from…

codeforcescompetitive-programmingdata-structures
CF 1184C1 - Heidi and the Turing Test (Easy)

We are given a small set of points on a grid, where almost all points lie exactly on the border of an axis-aligned square. Only one point is an exception and lies strictly inside the square. The task is to identify that single interior point. The square is not given explicitly.

codeforcescompetitive-programmingimplementation
CF 1184B1 - The Doctor Meets Vader (Easy)

Each spaceship has an attack power. Each empire base has a defense value and a gold amount. A spaceship can destroy every base whose defense is not greater than the spaceship's attack power.

codeforcescompetitive-programmingbinary-searchsortings
CF 1184B3 - The Doctor Meets Vader (Hard)

We are working on a weighted selection problem over two interacting layers. First, there is a small fixed graph of planets, where distances are measured as the shortest number of wormholes between nodes. Then there is a large set of spaceships and bases placed on these planets.

codeforcescompetitive-programmingflowsshortest-paths
CF 1183H - Subsequences (hard version)

We are given a string and we want to construct a collection of distinct strings, where each string must be a subsequence of the original.

codeforcescompetitive-programmingdpstrings
CF 1183G - Candy Box (hard version)

Each candy belongs to a type. For every type, we know how many candies of that type exist, and among those candies how many have f = 1. We want to build a gift by selecting some candies.

codeforcescompetitive-programminggreedyimplementationsortings
CF 1183B - Equalize Prices

We are given several independent scenarios. In each one, there is a list of product prices, and we are allowed to adjust each price by at most k in either direction, but we are not allowed to adjust it more than once.

codeforcescompetitive-programmingmath
CF 1183C - Computer Game

We are simulating a sequence of exactly $n$ game turns. At any moment Vova has a battery charge $k$, and each turn he must choose one of two actions that reduce the charge. One action is cheaper in terms of battery loss but can only be used when the battery is sufficiently high.

codeforcescompetitive-programmingbinary-searchmath
CF 1183F - Topforces Strikes Back

We are given several independent datasets. In each dataset there is a multiset of positive integers, where each integer represents the “value” of a problem.

codeforcescompetitive-programmingbrute-forcemathsortings
CF 1183D - Candy Box (easy version)

We are given several independent candy collections. Each collection is just a multiset of integers, where each integer represents a candy type. From each collection, we want to build a single “gift” by selecting some candies.

codeforcescompetitive-programminggreedysortings
CF 1182B - Plus from Picture

We are given a grid of characters representing a picture, where each cell is either empty or filled. The task is to decide whether the filled cells form exactly one plus-shaped figure. A valid plus shape has a single central filled cell.

codeforcescompetitive-programmingdfs-and-similarimplementationstrings
CF 1182F - Maximum Sine

We are given a function over integers that depends on a scaled angle of a sine wave. For any integer position $x$, we compute an angle proportional to $x$, specifically $frac{p}{q}pi x$, and evaluate the absolute value of its sine.

codeforcescompetitive-programmingbinary-searchdata-structuresnumber-theory
CF 1182E - Product Oriented Recurrence

We are given a sequence defined by a multiplicative recurrence. The first three values are known, and every later value is built from the previous three by multiplying them together and then scaling by a power of a constant.

codeforcescompetitive-programmingdpmathmatricesnumber-theory
CF 1182C - Beautiful Lyrics

We are given a collection of words, and we want to group them into as many valid “lyrics” as possible. Each lyric uses four words arranged as two lines of two words each.

codeforcescompetitive-programmingdata-structuresgreedystrings
CF 1181A - Chunga-Changa

Two people hold some amounts of a currency and can optionally transfer integer amounts between each other before spending. Each unit of currency buys one item in chunks of size z, meaning each person independently converts their money into floor(money / z) items.

codeforcescompetitive-programminggreedymath
CF 1181E2 - A Story of One Country (Hard)

We are given a set of axis-aligned rectangles that represent “castles”. These rectangles do not overlap in area, although they may share boundaries or corners.

codeforcescompetitive-programmingbrute-forcegreedysortings
CF 1181D - Irrigation

We are given a sequence of past assignments where each of $m$ cities has hosted an event some number of times. After these first $n$ years, a deterministic rule takes over: in every future year, the city that has hosted the fewest events so far is chosen, and if multiple…

codeforcescompetitive-programmingbinary-searchdata-structuresimplementationsortingstreestwo-pointers
CF 1181C - Flag

We are given a rectangular grid with n rows and m columns, where each cell already has one of three colors. The goal is to repaint some cells so that the final grid looks like a “flag” pattern composed of three horizontal stripes.

codeforcescompetitive-programmingbrute-forcecombinatoricsdpimplementation
CF 1180B - Nick and Array

We are given an array of integers, and for each position we are allowed to repeatedly apply a transformation that replaces a value $x$ with $-x-1$.

codeforcescompetitive-programminggreedyimplementation
CF 1179E - Alesya and Discrete Math

We are dealing with several functions that behave like monotone step counters on a huge integer line. Each function starts at value zero at position zero, ends at a fixed value L at position 10^18, and can only change in a very restricted way: as we move from x−1 to x, the…

codeforcescompetitive-programmingdivide-and-conquerinteractive
CF 1179D - Fedor Runs for President

We are given a tree with $n$ vertices. Every pair of vertices has exactly one simple path between them. We are allowed to add exactly one extra edge between any two distinct vertices, turning the structure into a graph with one cycle.

codeforcescompetitive-programmingdata-structuresdptrees
CF 1179B - Tolik and His Uncle

We are given an $n times m$ grid, and we start from the top-left cell $(1,1)$. The goal is to produce a complete ordering of all grid cells such that we visit every cell exactly once, starting from $(1,1)$.

codeforcescompetitive-programmingconstructive-algorithms
CF 1178H - Stock Exchange

We are given a collection of $2n$ stocks. Each stock $i$ has a price that evolves over time in a very simple deterministic way: at integer time $t$, its price is $ai cdot t + bi$. Time starts at $t = 0$, and prices only change at integer moments.

codeforcescompetitive-programmingbinary-searchflowsgraphs
CF 1178G - The Awesomest Vertex

We are working with a rooted tree where every node contributes two values, ai and bi. For any node v, consider the path from the root down to v. Along this path we accumulate the sums of a values and b values separately.

codeforcescompetitive-programmingdata-structuresdfs-and-similar
CF 1178F2 - Long Colorful Strip

We are given a long strip of length $m$, initially all painted with color $0$. Then colors $1$ through $n$ are applied one by one. Each color $i$ is applied by choosing a segment $[ai, bi)$ that is currently monochromatic, and repainting it with color $i$.

codeforcescompetitive-programmingdp
CF 1178C - Tiles

We are tiling a rectangular grid of size $w times h$, where each cell must contain one square tile. Each tile is a square split along a diagonal into a black and a white triangular half.

codeforcescompetitive-programmingcombinatoricsgreedymath
CF 1178D - Prime Graph

We are asked to construct a simple undirected graph on exactly $n$ vertices. We are free to choose any edges as long as we avoid self-loops and duplicate edges. The graph must satisfy two number-theoretic constraints at the same time.

codeforcescompetitive-programmingconstructive-algorithmsgreedymathnumber-theory
CF 1178E - Archaeology

We are given a long string formed only from the letters a, b, and c, with the restriction that no two adjacent characters are equal.

codeforcescompetitive-programmingbrute-forceconstructive-algorithmsgreedystrings
CF 1177A - Digits Sequence (Easy Edition)

We are given a single positive integer $k$, and we imagine writing all positive integers in order, starting from 1, directly next to each other without spaces or separators. This produces one continuous digit stream like 12345678910111213... and so on.

codeforcescompetitive-programmingimplementation
CF 1176E - Cover it!

We are given an undirected connected graph for each query, and we must select a subset of vertices such that every vertex we do not select has at least one selected neighbor. In other words, every unchosen vertex must be “covered” by an adjacent chosen vertex.

codeforcescompetitive-programmingdfs-and-similardsugraphsshortest-pathstrees
CF 1176D - Recover it!

We are given an unknown array of integers. Each original value is between 2 and 200000. From this hidden array, a second array is produced by expanding every element into two values and then shuffling everything.

codeforcescompetitive-programmingdfs-and-similargraphsgreedynumber-theorysortings
CF 1176C - Lose it!

We are given a long sequence where every element is guaranteed to be one of six fixed values: 4, 8, 15, 16, 23, 42. The task is not to reorder or modify values, only to delete elements so that what remains can be partitioned into complete ordered chains of length six.

codeforcescompetitive-programmingdpgreedyimplementation
CF 1176B - Merge it!

We are given several independent arrays. In each array, we are allowed to repeatedly take any two elements, remove them, and insert their sum back into the array. Each operation reduces the number of elements by one while preserving the total sum.

codeforcescompetitive-programmingmath
CF 1175D - Array Splitting

We are given a sequence of numbers and we must cut it into exactly $k$ consecutive parts, where each element belongs to exactly one part and parts preserve order. Once the partition is fixed, every element gets a label equal to the index of the segment it lands in.

codeforcescompetitive-programminggreedysortings
CF 1174F - Ehab and the Big Finale

We are given a tree with nodes numbered from 1 to n, rooted at node 1. Inside this tree, there is a hidden node x.

codeforcescompetitive-programmingconstructive-algorithmsdivide-and-conquergraphsimplementationinteractivetrees
CF 1174D - Ehab and the Expected XOR Problem

We are asked to build a sequence of integers, each lying in the range from 1 up to $2^n - 1$, with a very specific restriction on its contiguous segments.

codeforcescompetitive-programmingbitmasksconstructive-algorithms