brain

tamnd's digital brain — notes, problems, research

43815 notes

CF 1214D - Treasure Island

We are given an $n times m$ grid that represents a map. Each cell is either blocked or free. We start at the top-left cell $(1,1)$ and want to reach the bottom-right cell $(n,m)$.

codeforcescompetitive-programmingdfs-and-similardpflowshashing
CF 1214E - Petya and Construction Set

We are asked to build a graph on $2n$ labeled vertices using exactly $2n-1$ edges. Since a connected graph with $2n$ vertices and $2n-1$ edges is necessarily a tree, the construction is really about designing a tree on these labeled nodes.

codeforcescompetitive-programmingconstructive-algorithmsgraphsmathsortingstrees
CF 1213F - Unstable String Sort

We are given two permutations of the indices of a string, and both permutations describe an ordering in which the hidden string must appear sorted.

codeforcescompetitive-programmingdata-structuresdfs-and-similardsugraphsgreedyimplementationstrings
CF 1213E - Two Small Strings

We are asked to build a string of length $3n$ over the alphabet ${a,b,c}$, where each character appears exactly $n$ times. In addition to this balancing constraint, two forbidden patterns are given, each being a length-2 string.

codeforcescompetitive-programmingbrute-forceconstructive-algorithms
CF 1213A - Chips Moving

We are given several chips placed on integer positions on a line. Our goal is to move all chips so that they end up on a single shared coordinate, using the cheapest possible sequence of moves. Each chip can move in two different ways.

codeforcescompetitive-programmingmath
CF 1211G - King's Path

We are given a tree where each node initially holds a color. There is also a target color for every node. The King performs a single walk on the tree. During this walk, whenever he traverses an edge, the endpoints of that edge swap their current flags.

codeforcescompetitive-programming*specialmathtrees
CF 1210F1 - Marek and Matching (easy version)

We are given a complete bipartite structure with $n$ vertices on the left and $n$ vertices on the right. For every possible pair $(i, j)$, the edge between left vertex $i$ and right vertex $j$ exists independently with probability $p{ij}/100$.

codeforcescompetitive-programmingbrute-forceprobabilities
CF 1210B - Marcin and Training Camp

We are given a collection of students, each described by two values. The first value encodes which of up to 60 possible algorithms a student knows, and can be thought of as a bitmask. The second value is a skill score.

codeforcescompetitive-programmingbrute-forcegreedy
CF 1209E2 - Rotate Columns (hard version)

We are given a grid with a small number of rows and a potentially large number of columns. The only operation allowed is to take any single column and rotate it cyclically any number of times.

codeforcescompetitive-programmingbitmasksdpgreedysortings
CF 1209F - Koala and Notebook

We are given an undirected connected graph with up to 100,000 cities and roads, where each road has a unique identifier from 1 to m. Koala starts at city 1 and travels through the graph.

codeforcescompetitive-programmingdata-structuresdfs-and-similargraphsshortest-pathsstringstrees
CF 1209G2 - Into Blocks (hard version)

We are given an array that evolves over time through point updates. After each modification, we must compute a value called the difficulty of the array, which measures how far the array is from being representable as a sequence of contiguous uniform blocks.

codeforcescompetitive-programmingdata-structures
CF 1209C - Paint the Digits

We are given a sequence of digits and we must assign each position one of two labels, 1 or 2. After labeling, we form a new sequence by taking all digits labeled 1 in their original order, followed by all digits labeled 2 in their original order.

codeforcescompetitive-programmingconstructive-algorithmsgreedyimplementation
CF 1209D - Cow and Snacks

We are given a collection of snack types and a group of guests. Each snack type appears exactly once, so there are $n$ distinct items labeled $1$ to $n$. Each guest has two preferred snack types.

codeforcescompetitive-programmingdfs-and-similardsugraphs
CF 1208G - Polygons

We are asked to build several regular polygons that all lie on the same circle, and we want to reuse the circle’s boundary points as much as possible. Each polygon is determined only by how many vertices it has.

codeforcescompetitive-programminggreedymathnumber-theory
CF 1208F - Bits And Pieces

We are given a sequence of integers and asked to choose three indices $i < j < k$. For each such triple, we take the value of the first element OR the bitwise AND of the other two elements. The goal is to maximize this expression over all valid triples.

codeforcescompetitive-programmingbitmasksdfs-and-similardpgreedy
CF 1208C - Magic Grid

We are asked to fill an $n times n$ table with all integers from $0$ to $n^2 - 1$ exactly once, so every number is used in a permutation of the grid cells.

codeforcescompetitive-programmingconstructive-algorithms
CF 1208D - Restore Permutation

We are given a hidden permutation of numbers from 1 to n. Instead of seeing the permutation directly, we are given a derived value for each position. For position i, the value s[i] is the sum of all elements that appear before i and are smaller than the element placed at i.

codeforcescompetitive-programmingbinary-searchdata-structuresgreedyimplementation
CF 1208B - Uniqueness

We are given a sequence of numbers and we are allowed to remove one continuous block from it, or remove nothing at all. After this single deletion, the remaining elements must all be different from each other.

codeforcescompetitive-programmingbinary-searchbrute-forceimplementationtwo-pointers
CF 1207G - Indie Album

We are given a growing collection of strings, where each new string is either a single character or an old string extended by exactly one character at the end.

codeforcescompetitive-programmingdata-structuresdfs-and-similarhashingstring-suffix-structuresstringstrees
CF 1207E - XOR Guessing

We are playing an interactive guessing game where a hidden number $x$ is fixed in advance, and it lies in the range from $0$ to $2^{14}-1$. We are allowed to ask up to two questions.

codeforcescompetitive-programmingbitmasksinteractivemath
CF 1207D - Number Of Permutations

We are given a collection of $n$ labeled tiles, where each tile carries a pair of integers $(ai, bi)$. Our task is to count how many ways we can reorder these tiles such that the resulting sequence avoids two very specific failure patterns.

codeforcescompetitive-programmingcombinatorics
CF 1207C - Gas Pipeline

We are building a linear structure along a road that is represented as a binary string. Each position corresponds to a unit segment of road. A 0 means normal road, while a 1 means a crossroad where the pipeline must be lifted. The pipeline normally runs at height 1.

codeforcescompetitive-programmingdpgreedy
CF 1201E2 - Knightmare (hard)

We are placed on an even-by-even grid, and two knights start on different squares. One is white, one is black. Each player controls exactly one knight and alternates moves, starting with the white side if we choose it. A move is standard knight movement.

codeforcescompetitive-programminggraphsinteractiveshortest-paths
CF 1201B - Zero Array

We are given a list of numbers, and we repeatedly perform an operation that picks two different positions and reduces both values by one. The goal is to decide whether we can eventually bring every value down exactly to zero using some sequence of such operations.

codeforcescompetitive-programminggreedymath
CF 1175F - The Number of Subpermutations

We are given a sequence of integers, and we want to count how many contiguous segments behave like a perfect permutation of consecutive integers starting from 1.

codeforcescompetitive-programmingbrute-forcedata-structuresdivide-and-conquerhashingmath
CF 1175A - From Hero to Zero

We are given a number $n$ and a parameter $k$. Starting from $n$, we want to reach zero using two allowed operations: subtract one, or if the current value is divisible by $k$, replace it with the quotient after dividing by $k$.

codeforcescompetitive-programmingimplementationmath
CF 1172F - Nauuo and Bug

We are given a static array of integers and a parameter $p$. There is a peculiar addition routine used inside a hidden implementation: it adds numbers left to right, but after each addition it performs a conditional correction.

codeforcescompetitive-programmingdata-structures
CF 1172E - Nauuo and ODT

The input describes a tree where each node carries a color label. What we are asked to compute is not about a single path, but about all simple paths between ordered pairs of distinct nodes.

codeforcescompetitive-programmingdata-structures
CF 1172D - Nauuo and Portals

We are given an $n times n$ grid where movement is deterministic. From any cell, a traveller moves in a fixed direction until something changes that flow.

codeforcescompetitive-programmingconstructive-algorithms
CF 1172A - Nauuo and Cards

We are given a system split into two parts: a hand of cards and a pile of cards. Together they contain every integer card from 1 to n exactly once, while zeros represent empty placeholders that behave like dummy cards with no value.

codeforcescompetitive-programminggreedyimplementation
CF 1172C2 - Nauuo and Pictures (hard version)

We are given a collection of pictures, each with a positive weight. These weights determine how likely each picture is shown when Nauuo visits the website: a picture is selected with probability proportional to its current weight, so picture $i$ is chosen with probability $wi…

codeforcescompetitive-programmingdpprobabilities
CF 1168D - Anagram Paths

We are given a rooted binary tree where each edge carries either a fixed lowercase letter or a wildcard character. Every leaf defines a string obtained by walking from the root to that leaf and concatenating edge labels.

codeforcescompetitive-programmingdpimplementationtrees
CF 1168C - And Reachability

We are given a sequence of integers arranged on a line, and we want to answer connectivity queries between pairs of positions, but connectivity is not based on adjacency.

codeforcescompetitive-programmingbitmasksdp
CF 1163E - Magical Permutation

We are given a set of integers that represent allowed XOR “moves”. We are asked to build a permutation of all integers from 0 up to some power of two minus one, such that every adjacent pair in the permutation differs by a value that belongs to the given set.

codeforcescompetitive-programmingbitmasksbrute-forceconstructive-algorithmsdata-structuresgraphsmath
CF 1116A2 - Generate equal superposition of four basis states

We start with a register of qubits initialized in the all-zero computational basis state. Alongside this, we are given four classical bitstrings of length $N$, each describing one computational basis state on these qubits.

codeforcescompetitive-programming*special
CF 1106E - Lunar New Year and Red Envelopes

We are given a timeline from 1 to n and a collection of intervals, each representing a “red envelope” that becomes usable only during a certain time window.

codeforcescompetitive-programmingdata-structuresdp
CF 1105A - Salem and Sticks

We are given a list of stick lengths, and we are allowed to replace each length with any other positive integer. Changing a stick from its original length to a new length costs exactly the absolute difference between the two values.

codeforcescompetitive-programmingbrute-forceimplementation
CF 1103C - Johnny Solving

We are given a connected undirected simple graph where every vertex has degree at least three. Along with the graph, we are also given an integer $k$. The task is not to compute a single structure, but to decide between two fundamentally different constructions.

codeforcescompetitive-programmingconstructive-algorithmsdfs-and-similargraphsmath
CF 1100E - Andrew and Taxi

We are given a directed graph representing a city map, where each road has a direction and a cost associated with reversing it.

codeforcescompetitive-programmingbinary-searchdfs-and-similargraphs
CF 1100B - Build a Contest

We are given a stream of problems, each tagged with a difficulty from 1 to n. Arkady keeps a pool of created problems, and at any moment he is allowed to form a contest if he can pick exactly one unused problem of every difficulty from 1 to n.

codeforcescompetitive-programmingdata-structuresimplementation
CF 1100D - Dasha and Chess

We are simulating an interaction on a 999 by 999 grid with a single white king and many black rooks. The king moves first and can step to any of the eight neighboring cells.

codeforcescompetitive-programmingconstructive-algorithmsgamesinteractive
CF 1099C - Postcard

We are given a string that mixes plain lowercase letters with two special symbols that always appear immediately after a letter. One symbol behaves like a weak modifier that allows the preceding letter to be either kept or deleted.

codeforcescompetitive-programmingconstructive-algorithmsimplementation
CF 1099A - Snowball

The process describes a snowball sliding downward from a starting height until it reaches the ground. At every integer height level, the snowball repeatedly changes its weight in three ordered phases: it first gains additional weight equal to its current height, then possibly…

codeforcescompetitive-programmingimplementation
CF 1099F - Cookies

We are given a rooted tree where each vertex contains a pile of cookies. Every vertex also has a cost for eating one cookie at that vertex, and every edge from a node to its parent has a cost for moving upward along it. A chip starts at the root.

codeforcescompetitive-programmingbinary-searchdata-structuresdfs-and-similardpgamestrees
CF 1098F - Ж-function

We are given a fixed string and many substring queries. For each query, we take the substring and compute a specific aggregate over all its suffixes. For a string, the Z-function at position i measures how long the prefix of the string matches the substring starting at i.

codeforcescompetitive-programmingstring-suffix-structuresstrings
CF 1098D - Eels

We maintain a dynamic multiset of positive integers, where each number represents the weight of an eel. After every update, we are asked to compute a value called “danger”, which depends on an optimal process of repeatedly merging all eels into a single one.

codeforcescompetitive-programmingdata-structures
CF 1098E - Fedya the Potter

We are given an array and asked to repeatedly build new structures on top of derived information from its subarrays. The first transformation takes every contiguous segment and replaces it with the greatest integer that divides all elements inside that segment.

codeforcescompetitive-programmingbinary-searchimplementationmathnumber-theory
CF 1098A - Sum in the tree

We are given a rooted tree where vertex 1 is the root. Every vertex originally had a non-negative integer value written on it, but those values are now lost. What remains is partial information about prefix sums along root paths.

codeforcescompetitive-programmingconstructive-algorithmsdfs-and-similargreedytrees
CF 1098C - Construct a tree

We are asked to build a rooted tree on vertices labeled from 1 to n, where vertex 1 is fixed as the root. Each node except the root has exactly one parent, so the structure is fully determined by the parent array.

codeforcescompetitive-programmingbinary-searchconstructive-algorithmsdfs-and-similargraphsgreedytrees
CF 1098B - Nice table

We are given a grid of size $n times m$, where each cell contains one of four characters: A, G, C, or T. We need to construct a new grid of the same dimensions that satisfies a strict local rule: every 2 by 2 subgrid must contain all four different characters exactly once.

codeforcescompetitive-programmingbrute-forceconstructive-algorithmsgreedymath
CF 1097H - Mateusz and an Infinite Sequence

We are working with an infinite sequence that is not written explicitly, but generated recursively. The construction starts from a single value zero.

codeforcescompetitive-programmingbitmasksbrute-forcedpstrings
CF 1097G - Vladislav and a Great Legend

We are working with a tree where every subset of vertices defines a natural “cost” based on how large a minimal connected subgraph is when we are forced to include all vertices in that subset.

codeforcescompetitive-programmingcombinatoricsdptrees
CF 1097C - Yuhao and a Parenthesis

We are given a collection of bracket strings, each string being some mixture of opening and closing parentheses. From these strings, we are allowed to form disjoint pairs.

codeforcescompetitive-programminggreedyimplementation
CF 1097E - Egor and an RPG game

We are given a permutation and we must break it into several subsequences taken in order from the original array. Each element must belong to exactly one subsequence. Every subsequence must be strictly monotone, either strictly increasing or strictly decreasing.

codeforcescompetitive-programmingconstructive-algorithmsgreedy
CF 1096A - Find Divisible

We are given multiple independent queries, each describing a numeric interval from $l$ to $r$. For each interval, we must pick two different integers inside it such that one of them is a divisor of the other.

codeforcescompetitive-programminggreedyimplementationmath
CF 1096F - Inversion Expectation

We are given a sequence of length $n$ that is supposed to be a permutation, except some positions are unknown and marked with $-1$.

codeforcescompetitive-programmingdpmathprobabilities
CF 1096B - Substring Removal

We are given a string made of lowercase letters, and we are allowed to remove one contiguous segment from it. After removing that segment, the remaining characters must all be identical, meaning either nothing remains or every remaining character is the same letter.

codeforcescompetitive-programmingcombinatoricsmathstrings
CF 1093E - Intersection of Permutations

We are working with two permutations of the same set of values from 1 to n. One permutation, call it a, gives a position-based arrangement, and the other permutation b also gives a different ordering of the same values.

codeforcescompetitive-programmingdata-structures
CF 1093G - Multidimensional Queries

We are working with a collection of points in a very low-dimensional space, where each point has up to five coordinates. The distance between two points is defined as the sum of absolute differences across each coordinate, which is the Manhattan metric.

codeforcescompetitive-programmingbitmasksdata-structures
CF 1093C - Mishka and the Last Exam

We are given a hidden non-decreasing array a of even length n. We never see a directly. Instead, we are told half of its structure: for every symmetric pair of positions, the sum of elements at the ends is known.

codeforcescompetitive-programminggreedy
CF 1093B - Letters Rearranging

We are given several independent strings made only of lowercase English letters. For each string, we are allowed to rearrange its characters in any order we want.

codeforcescompetitive-programmingconstructive-algorithmsgreedysortingsstrings
CF 1093A - Dice Rolling

We are given a standard six-faced dice, but instead of the usual values 1 to 6, its faces contain the integers 2, 3, 4, 5, 6, and 7, all distinct. Each roll produces one of these numbers, and the score for a sequence of rolls is the sum of the visible faces.

codeforcescompetitive-programmingmath
CF 1085F - Rock-Paper-Scissors Champion

We are given a line of players, each permanently assigned one of three Rock-Paper-Scissors moves. A tournament proceeds by repeatedly picking two adjacent players, playing a match, and removing the loser.

codeforcescompetitive-programming
CF 1085A - Right-Left Cipher

We are given a string that is the final result of repeatedly building another hidden string by alternately appending characters to the right and inserting characters to the left.

codeforcescompetitive-programmingimplementationstrings
CF 1085D - Minimum Diameter Tree

We are given a tree and a fixed total amount of “weight budget” $s$. Every edge must be assigned a non-negative real weight, and the sum over all edges must equal exactly $s$.

codeforcescompetitive-programmingconstructive-algorithmsimplementationtrees
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