brain

tamnd's digital brain — notes, problems, research

41650 notes

CF 1988B - Make Majority

We are given a binary sequence that can change shape over time. The only allowed move is to take any contiguous segment and compress it into a single value equal to the majority of that segment, where ties are resolved in favor of zero.

codeforcescompetitive-programminggreedyimplementation
CF 1988D - The Omnipotent Monster Killer

We are given a tree with n vertices, where each vertex holds a monster with a certain attack power. You, the monster killer, face the monsters for effectively an infinite number of rounds.

codeforcescompetitive-programmingbrute-forcedfs-and-similardptrees
CF 1988E - Range Minimum Sum

We are working with a permutation of numbers from 1 to n, placed on a line. For any arrangement of numbers, we define a value based on all contiguous subarrays: each subarray contributes its minimum element, and we sum these contributions over every possible subarray.

codeforcescompetitive-programmingbinary-searchbrute-forcedata-structuresdivide-and-conquerimplementation
Kvant Math Problem 834

This is a two-part geometric covering problem.

kvantmathematicsolympiad
CF 1988C - Increasing Sequence with Fixed OR

We are given a number $n$, and we want to build the longest possible strictly increasing sequence of positive integers, where every element is at most $n$. The key constraint is that every adjacent pair must combine under bitwise OR to exactly $n$.

codeforcescompetitive-programmingbitmasksconstructive-algorithmsgreedy
CF 1988A - Split the Multiset

We start with a multiset that contains a single number n. The only way to change this multiset is to repeatedly pick one existing number u, delete it, and replace it with at most k positive integers whose sum is exactly u.

codeforcescompetitive-programmingbrute-forcegreedyimplementationmath
CF 1989F - Simultaneous Coloring

We are given a matrix with n rows and m columns, initially colorless. The allowed operations are painting an entire row red or an entire column blue.

codeforcescompetitive-programmingdfs-and-similardivide-and-conquergraphs
CF 1989A - Catch the Coin

We are given a grid representing the arcade screen with coordinates $(x, y)$, where Monocarp starts at the origin $(0, 0)$. There are $n$ coins scattered on the grid. Each second, Monocarp can move in one of the eight directions (up, down, left, right, and the four diagonals).

codeforcescompetitive-programmingimplementation
CF 1989D - Smithing Skill

We are given a collection of weapon blueprints and several independent piles of raw material. Each blueprint describes how many ingots are needed to build a weapon and how many ingots are recovered if that weapon is later melted.

codeforcescompetitive-programmingbrute-forcedata-structuresdpgreedymathsortingstwo-pointers
CF 1989E - Distance to Different

We are given an integer array, but we are not asked to build or choose the array directly. Instead, every valid array $a$ over values $1$ to $k$ induces a derived array $b$, where each position $i$ stores how far you must walk left or right from $i$ to encounter a different…

codeforcescompetitive-programmingcombinatoricsdpmath
CF 1989B - Substring and Subsequence

We are asked to construct a string that satisfies two overlapping constraints: it must contain one given string, $a$, as a substring, and another string, $b$, as a subsequence. The difference between substring and subsequence is crucial.

codeforcescompetitive-programmingbrute-forcegreedystrings
CF 1989C - Two Movies

Each person has a pair of opinions, one for each of two movies. The opinion is ternary: it contributes either +1, 0, or -1 if that person reviews that movie. We must assign every person to exactly one of the two movies, and this choice determines both movie scores.

codeforcescompetitive-programminggreedymath
CF 1990F - Polygonal Segments

We are given a dynamic array of positive values, and we repeatedly modify it while also answering range queries. The interesting object is a subarray that behaves like the side lengths of a polygon.

codeforcescompetitive-programmingbrute-forcedata-structuresdivide-and-conquerdpgreedytwo-pointers
CF 1990E2 - Catch the Mole(Hard Version)

We are working with a rooted tree where node 1 is fixed as the root. Somewhere in this tree there is a hidden token, called the mole, which occupies a single node. We do not know its position initially, but we can interact with the system by querying any node x.

codeforcescompetitive-programmingbinary-searchdata-structuresdfs-and-similardivide-and-conquerinteractivetrees
CF 1990E1 - Catch the Mole(Easy Version)

We are working with a rooted tree where node 1 is the root, and one hidden token, the “mole”, starts at some unknown node. We cannot observe its position directly. Instead, we interact with the tree using queries on nodes.

codeforcescompetitive-programmingbinary-searchdata-structuresdfs-and-similarinteractivetrees
CF 1990D - Grid Puzzle

We are given a one-dimensional array of integers, where each integer represents how many consecutive cells in a row of a grid are initially black.

codeforcescompetitive-programmingbitmasksbrute-forcedpgreedyimplementation
Kvant Math Problem 815

Place the $4k$ points on a circle in their cyclic order and denote their labels by $a_1,a_2,\ldots,a_{4k}$.

kvantmathematicsolympiad
CF 1990A - Submission Bait

We have a two-player game on an array of integers. Alice and Bob take turns, with Alice starting first. Initially, a variable mx is zero. On their turn, a player can choose an array element a[i] if it is at least mx, set mx to that value, and then set a[i] to zero.

codeforcescompetitive-programmingbrute-forcegamesgreedysortings
CF 1990C - Mad MAD Sum

We are given an array of integers, and we need to repeatedly update it while accumulating a running sum. The update rule is based on the concept of $operatorname{MAD}$ - the maximum number that appears at least twice in a prefix of the array.

codeforcescompetitive-programmingbrute-forcegreedymath
CF 1990B - Array Craft

We need to construct an array of length $n$, where each element is either $+1$ or $-1$. Two special positions are defined based on prefix sums and suffix sums. For prefixes, we look at all partial sums $Si = a1 + dots + ai$.

codeforcescompetitive-programmingconstructive-algorithmsgreedy
Kvant Math Problem 843

Let the plane of the triangle be $z=0$.

kvantmathematicsolympiad
CF 1991I - Grid Game

We are asked to play an interactive game on a rectangular grid of size $n times m$. Each cell must be filled with a unique integer from $1$ to $n cdot m$. Once the grid is filled, the interactor and we take turns picking unchosen cells.

codeforcescompetitive-programmingconstructive-algorithmsgamesgraph-matchingsgreedyinteractive
CF 1991H - Prime Split Game

In this problem, Alice and Bob are playing a turn-based game with piles of stones. Each pile contains some number of stones, and a player on their turn must choose a number of piles to remove and an equal number of piles to split, where the split must produce piles with prime…

codeforcescompetitive-programmingbitmasksdpfftgamesmathnumber-theory
CF 1991G - Grid Reset

We are asked to manage a dynamic grid coloring process. The grid has $n$ rows and $m$ columns, all initially white. We are given an integer $k$ and a sequence of operations. Each operation is either horizontal or vertical.

codeforcescompetitive-programmingconstructive-algorithmsgreedyimplementation
CF 1991F - Triangle Formation

We are given a sequence of sticks, each with a positive integer length. For each query, we are asked whether it is possible to pick exactly six distinct sticks from a given contiguous subarray such that we can form two non-degenerate triangles.

codeforcescompetitive-programmingbrute-forcegreedyimplementationmathsortings
CF 1991E - Coloring Game

We are asked to play a two-player game on a connected undirected graph where each vertex can be colored with one of three colors. The game proceeds in rounds equal to the number of vertices.

codeforcescompetitive-programmingconstructive-algorithmsdfs-and-similargamesgraphsgreedyinteractive
CF 1991C - Absolute Zero

We are given an array of non-negative integers, and in one operation we can pick any number $x$ and replace every element $ai$ with its absolute difference from $x$, $ The key constraint is the array size $n$ up to $2 cdot 10^5$ and the sum of $n$ across all test cases also…

codeforcescompetitive-programmingconstructive-algorithmsgreedymath
CF 1991D - Prime XOR Coloring

We are given a set of vertices labeled from 1 to n. Two vertices are connected if the XOR of their labels is a prime number. The task is to assign a color to every vertex so that no edge connects two vertices of the same color, while using as few colors as possible.

codeforcescompetitive-programmingbitmasksconstructive-algorithmsgraphsgreedymathnumber-theory
CF 1991B - AND Reconstruction

We are given an array b of length n-1 and need to construct an array a of length n such that each element of b equals the bitwise AND of consecutive elements of a. In other words, for each i from 1 to n-1, b[i] = a[i] & a[i+1].

codeforcescompetitive-programmingbitmasksconstructive-algorithmsgreedy
CF 1991A - Maximize the Last Element

We are given an array of odd length, and we repeatedly compress it by deleting two neighboring elements in one move until only one value remains. Each deletion removes a contiguous pair, and everything else shifts together.

codeforcescompetitive-programminggreedyimplementation
Kvant Math Problem 794

Let the first circle be $\omega_1$ and the second circle be $\omega_2$.

kvantmathematicsolympiad
CF 1992C - Gorilla and Permutation

We are asked to construct a permutation of numbers from 1 to $n$ such that a certain expression is maximized. The expression is the sum of all prefix sums of "large" numbers (greater than or equal to $k$) minus the sum of all prefix sums of "small" numbers (less than or equal…

codeforcescompetitive-programmingconstructive-algorithmsmath
Kvant Math Problem 825

Let the segments be

kvantmathematicsolympiad
CF 1992G - Ultra-Meow

We are given an array a of length n containing integers from 1 to n, possibly in any order and possibly repeated.

codeforcescompetitive-programmingcombinatoricsdpmath
CF 1992F - Valuable Cards

We are given a sequence of n cards, each with an integer price, and a target integer x. None of the cards are equal to x. A segment of consecutive cards is considered bad if it is impossible to pick a subset of cards within that segment whose product equals x.

codeforcescompetitive-programmingbrute-forcedpgreedynumber-theorytwo-pointers
CF 1992E - Novice's Mistake

The task describes a very small “birthday arithmetic” model, but the twist is that the computation is not performed numerically in the usual way. Instead, the intermediate value is treated as a string, which completely changes how subtraction behaves.

codeforcescompetitive-programmingbrute-forceconstructive-algorithmsimplementationmathstrings
CF 1992B - Angry Monk

We are asked to compute the minimum number of operations required to merge a pre-cut potato casserole back into a single piece. The casserole has total length n and was cut into k pieces of lengths a1 through ak. Two operations are allowed.

codeforcescompetitive-programminggreedymathsortings
CF 1992D - Test of Love

We are given a river that behaves like a linear board of n cells. Each cell is either safe ground in the form of a log, dangerous water, or an instant-failure crocodile tile. The goal is to move from the left bank before the first cell to the right bank after the last cell.

codeforcescompetitive-programmingdpgreedyimplementation
CF 1992A - Only Pluses

We are given three small integers that represent the initial sizes of three factors contributing to a product. The final quantity we care about is the product of these three numbers, and we are allowed to improve it by performing at most five operations.

codeforcescompetitive-programmingbrute-forceconstructive-algorithmsgreedymathsortings
Kvant Math Problem 812

The sum is

kvantmathematicsolympiad
CF 1993F2 - Dyn-scripted Robot (Hard Version)

We are asked to simulate the movement of a robot inside a bounded rectangle, starting at the bottom-left corner. The robot follows a script of movements, each of which is one of the four cardinal directions.

codeforcescompetitive-programmingchinese-remainder-theoremmathnumber-theory
CF 1993E - Xor-Grid Problem

We are given a small matrix of integers, and the operations we can perform are unusual. For any row, we can replace every element with the XOR of the corresponding column. For any column, we can replace every element with the XOR of the corresponding row.

codeforcescompetitive-programmingbitmasksconstructive-algorithmsdpimplementation
CF 1993D - Med-imize

We are given an array of integers and a parameter $k$. We can repeatedly remove any contiguous subarray of length exactly $k$ from the array, shrinking it. Once the array's length is no longer greater than $k$, we stop.

codeforcescompetitive-programmingbinary-searchdpgreedy
CF 1993F1 - Dyn-scripted Robot (Easy Version)

We are simulating a deterministic robot moving on a grid that is bounded by a rectangle. The robot starts at the origin and repeatedly executes a fixed instruction string consisting of unit moves in four directions.

codeforcescompetitive-programmingbrute-forcechinese-remainder-theoremconstructive-algorithmsmathnumber-theory
CF 1993C - Light Switches

The problem involves an apartment with multiple rooms, each starting with its light turned off. Each room gets a chip installed at a distinct time, and each chip toggles the light in its room on and off periodically, with a period k minutes.

codeforcescompetitive-programmingimplementationmath
CF 1993A - Question Marks

We are given a multiple-choice test with $4n$ questions, where each of the four options 'A', 'B', 'C', 'D' is correct exactly $n$ times. Tim answers the questions but may leave some as '?', representing unknown answers.

codeforcescompetitive-programminggreedyimplementation
CF 1993B - Parity and Sum

We are given an array of positive integers, and we want all elements to share the same parity - either all even or all odd. The only allowed operation is to pick two elements of differing parity and add the larger number to the smaller.

codeforcescompetitive-programmingconstructive-algorithmsgreedy
Kvant Math Problem 763

Let

kvantmathematicsolympiad
Kvant Math Problem 749

Part (1) concerns the cyclic expression

kvantmathematicsolympiad
Kvant Math Problem 746

Let the square have side length $2$ and center $O$.

kvantmathematicsolympiad
Kvant Math Problem 788

Let

kvantmathematicsolympiad
CF 1995E2 - Let Me Teach You a Lesson (Hard Version)

We have $2n$ knights sitting at $n$ desks arranged in a circle. Each desk has exactly two knights, the first at position $2i-1$ and the second at $2i$. Each knight has an integer intelligence value.

codeforcescompetitive-programmingdata-structuresdpmatricestwo-pointers
CF 1995D - Cases

We are given a string of uppercase letters representing a text in an ancient language. The language uses only the first $c$ letters of the Latin alphabet, and each word in the language has a “case” determined solely by its last letter. Words can have lengths up to $k$.

codeforcescompetitive-programmingbitmasksbrute-forcedpstrings
CF 1995E1 - Let Me Teach You a Lesson (Easy Version)

We have 2n knights arranged around a circle. Desk i contains knights (2i-1, 2i), so every desk contributes a sum of two intelligence values. The only operation allowed is swapping opposite positions in the circle.

codeforcescompetitive-programming2-satdata-structuresdpmatricestwo-pointers
CF 1995C - Squaring

We are given several independent arrays, and for each one we are allowed to modify elements using a very specific operation: pick an index and replace the value at that position with its square. We may repeat this operation on the same index multiple times.

codeforcescompetitive-programmingbrute-forceconstructive-algorithmsgreedyimplementationmathnumber-theory
CF 1995B1 - Bouquet (Easy Version)

Each flower has two properties that are actually the same number: its petal count and its price. A flower with k petals costs exactly k coins. We may buy any subset of the flowers available in the store.

codeforcescompetitive-programmingbinary-searchbrute-forcegreedysortingstwo-pointers
CF 1995B2 - Bouquet (Hard Version)

We are given several independent scenarios. In each scenario, there are different flower types, each type having a petal value and a limited supply. Every flower costs exactly its petal value in coins, and we have a fixed budget. We want to build a bouquet under two restrictions.

codeforcescompetitive-programmingbinary-searchdata-structuresgreedymathsortingstwo-pointers
CF 1995A - Diagonals

We are working on an $n times n$ grid where each cell belongs to exactly one diagonal if we group cells by the value $i + j$. Every such value defines a diagonal that runs from the top edge toward the right or bottom edge depending on where it sits in the square.

codeforcescompetitive-programmingbrute-forcegreedyimplementationmath
CF 1996G - Penacony

The problem describes a circular town with n houses connected by roads that form a single cycle. Each house i connects to i+1, and the last house n connects back to house 1. Among these residents, there are m friendships, each linking two distinct houses.

codeforcescompetitive-programmingbrute-forcedata-structuresgraphsgreedyhashing
CF 1996F - Bomb

We are asked to maximize a score over a series of operations on two arrays. Each array has length $n$. Array $a$ represents the current “value” of each element, and array $b$ represents how much that element decays after it is used.

codeforcescompetitive-programmingbinary-searchgreedymath
CF 1996E - Decode

We are given a binary string, and we look at every possible contiguous segment of it. Each segment itself contains many subsegments, and we are interested only in those subsegments whose number of zeros equals the number of ones.

codeforcescompetitive-programmingcombinatoricsdata-structuresimplementationmath
CF 1996D - Fun

We need to count ordered triples of positive integers $(a,b,c)$ that satisfy two independent restrictions. The first restriction limits the pairwise products: $$ab + ac + bc le n$$ The second restriction limits the sum: $$a + b + c le x$$ The word "ordered" matters.

codeforcescompetitive-programmingbinary-searchbrute-forcecombinatoricsmathnumber-theory
Kvant Math Problem 731

The game begins with the first player choosing an initial value $P_0 \in {2,3,4,5,6,7,8,9}$.

kvantmathematicsolympiad
CF 1996C - Sort

We are given two strings, a and b, of equal length n. For each query, defined by a range [l, r], we are allowed to modify individual characters of a within that range. The goal is to transform the substring a[l..

codeforcescompetitive-programmingdpgreedysortingsstrings
CF 1996B - Scale

We are given a square grid of size $n times n$ where each cell contains either a zero or a one. The task is to reduce this grid by a factor $k$, which is guaranteed to divide $n$ evenly.

codeforcescompetitive-programminggreedyimplementation
CF 1996A - Legs

The farm has only chickens and cows, and Farmer John counts a total of n legs. Chickens contribute 2 legs each and cows contribute 4 legs each. The question asks for the smallest possible number of animals consistent with the total leg count.

codeforcescompetitive-programmingbinary-searchmathternary-search
Kvant Math Problem 721

Let $ABC$ be the given triangle.

kvantmathematicsolympiad
CF 1997F - Chips on a Line

We are given a one-dimensional line with positions numbered from 1 to $x$. We must place exactly $n$ chips on these positions, allowing multiple chips at the same position.

codeforcescompetitive-programmingbrute-forcecombinatoricsdpgreedymath
CF 1997E - Level Up

In this problem, Monocarp is traversing a linear sequence of monsters, each with a level. He starts at level 1 and can fight monsters whose levels are at least as high as his current level. Whenever he fights k monsters, he levels up by one.

codeforcescompetitive-programmingbinary-searchbrute-forcedata-structuresdivide-and-conquerimplementation
CF 1997D - Maximize the Root

We are given a rooted tree. Every vertex contains a non-negative number. An operation can be applied to any non-leaf vertex. When we choose a vertex $v$, we increase the value at $v$ by one and simultaneously decrease every other vertex in the subtree of $v$ by one.

codeforcescompetitive-programmingbinary-searchdfs-and-similardpgreedytrees
CF 1997B - Make Three Regions

We have a grid with only two rows. Some cells are free (.), some are blocked (x). Free cells form a graph where adjacent cells sharing a side are connected. A connected region is simply a connected component of this graph.

codeforcescompetitive-programmingconstructive-algorithmstwo-pointers
CF 1997A - Strong Password

We are asked to strengthen a password by inserting exactly one lowercase letter anywhere in an existing string. The password's strength is quantified by the time it takes to type it. Typing rules are simple: the first character always takes two seconds.

codeforcescompetitive-programmingbrute-forceimplementationstrings
CF 1997C - Even Positions

We are given a bracket sequence of even length, but every character at an odd position has been erased. Only the brackets at positions 2, 4, 6, ... remain.

codeforcescompetitive-programmingconstructive-algorithmsdata-structuresgreedy
CF 1998D - Determine Winning Islands in Race

We have a directed acyclic graph on islands 1...n. The graph always contains the chain 1 - 2 - 3 - ... - n and additionally contains m extra directed edges (u, v) with u < v. Bessie can only move along the chain edges. Elsie can move along both chain and extra edges.

codeforcescompetitive-programmingdata-structuresdpgraphsgreedyshortest-paths
CF 1998E2 - Eliminating Balls With Merging (Hard Version)

We are given a sequence of balls numbered from 1 to $n$, each labeled with a positive integer. For each prefix of length $i$ ($1 le i le n$), we want to determine how many positions $j$ can survive as the last remaining ball if we repeatedly merge pairs of neighboring balls…

codeforcescompetitive-programmingbinary-searchbrute-forcedata-structuresdivide-and-conquergreedyimplementation
Kvant Math Problem 726

Let the regular $2n$-gon have vertices $A_1,A_2,\dots,A_{2n}$ in cyclic order, and let $P$ be a point inside the polygon.

kvantmathematicsolympiad
CF 1998E1 - Eliminating Balls With Merging (Easy Version)

We are given a row of $n$ balls, each with an integer written on it. The operation we can perform repeatedly involves selecting two adjacent values in the set $S$ and merging them according to their relative sizes.

codeforcescompetitive-programmingbinary-searchbrute-forcedata-structuresdivide-and-conquergreedy
CF 1998C - Perform Operations to Maximize Score

We are given an array of integers a and a parallel binary array b. The array b indicates which positions in a can be incremented. Each increment operation increases a chosen a[i] by 1, and we can perform at most k operations in total.

codeforcescompetitive-programmingbinary-searchbrute-forceconstructive-algorithmsgreedyimplementation
CF 1998B - Minimize Equal Sum Subarrays

We are given a permutation p of length n. We must construct another permutation q of the same length. For every subarray [i, j], we can compare the sum of that segment in p with the sum of the corresponding segment in q.

codeforcescompetitive-programmingconstructive-algorithmsmathnumber-theory
CF 1998A - Find K Distinct Points with Fixed Center

We are given a target center point $(xc, yc)$ and an integer $k$. The task is not to optimize anything or search for a special configuration. We simply need to construct exactly $k$ distinct integer-coordinate points whose arithmetic mean is exactly $(xc, yc)$.

codeforcescompetitive-programmingconstructive-algorithmsimplementationmath
CF 1999G2 - Ruler (hard version)

We are asked to find a missing number on a special ruler, which behaves almost like a normal ruler but skips a single value $x$ between 2 and 999. If you try to measure an object smaller than $x$, the ruler gives the correct length.

codeforcescompetitive-programmingbinary-searchinteractiveternary-search
CF 1999G1 - Ruler (easy version)

We are interacting with a hidden parameter $x$ between 2 and 999 that defines a faulty measuring device. Whenever we measure a length $y$, the device behaves normally for small values, but once the true length reaches $x$ or more, it consistently over-reports by exactly 1 unit.

codeforcescompetitive-programmingbinary-searchinteractive
CF 1999E - Triple Operations

We are given a consecutive sequence of integers from $l$ to $r$ inclusive, written on a board. Ivy can repeatedly perform an operation on any two numbers $x$ and $y$: she replaces them with $3x$ and $lfloor y/3 rfloor$.

codeforcescompetitive-programmingdpimplementationmath
CF 1999F - Expected Median

We are given a binary array containing only 0 and 1. For every subsequence of length k, where k is odd, we compute its median and add all these medians together. The array is binary, which changes the nature of the median completely.

codeforcescompetitive-programmingcombinatoricsmath
CF 1999D - Slavic's Exam

The task asks for the sum of the digits of a two-digit number for multiple test cases. Each input number $n$ is guaranteed to be between 10 and 99 inclusive, so the first digit is always nonzero.

codeforcescompetitive-programminggreedyimplementationstrings
Kvant Math Problem 710

The requirement that no term is equal to the sum of several others is ensured by a stronger property: for every $n$, if

kvantmathematicsolympiad
CF 1999C - Showering

We are given a day of length m minutes and a set of non-overlapping tasks, each occupying a continuous interval of time.

codeforcescompetitive-programminggreedyimplementation
CF 1999B - Card Game

We are asked to compute the number of ways Suneet can win a two-round card game against Slavic. Each player has exactly two cards, each numbered between 1 and 10.

codeforcescompetitive-programmingbrute-forceconstructive-algorithmsimplementation
CF 1999A - A+B Again?

The task asks for the sum of the digits of a two-digit number for multiple test cases. Each input number $n$ is guaranteed to be between 10 and 99 inclusive, so the first digit is always nonzero.

codeforcescompetitive-programmingimplementationmath
CF 2000F - Color Rows and Columns

Each rectangle is a grid of $ai$ columns and $bi$ rows. We may color individual cells one by one. Whenever a row becomes completely colored, we gain one point. Whenever a column becomes completely colored, we also gain one point. The rectangles are independent.

codeforcescompetitive-programmingdpgreedyimplementationmath
CF 2000E - Photoshoot for Gorillas

We are placing weighted objects onto a grid, but the score is not just the sum of values on the grid. Instead, every placement contributes multiple times: each cell participates in several overlapping fixed-size $k times k$ sub-squares, and the total score is the sum over all…

codeforcescompetitive-programmingcombinatoricsdata-structuresgreedymath
CF 2000A - Primary Task

We are given a list of integers written on a board, and one of them might be a corrupted representation of a number of the form $10^x$ where $x ge 2$. The corruption happens because the exponentiation symbol '^' was lost.

codeforcescompetitive-programmingimplementationmathstrings
CF 2000C - Numeric String Template

The problem asks us to check whether a string matches a numeric template. The template is an array of integers where the same number should correspond to the same letter in a string, and the same letter should correspond to the same number.

codeforcescompetitive-programmingdata-structuresstrings
Kvant Math Problem 645

Normalize the speeds so that Warnicke moves with speed $1$ and the criminal with speed $\frac12$.

kvantmathematicsolympiad
CF 2001A - Make All Equal

We are given an array of integers arranged cyclically, which means the first and last elements are considered adjacent.

codeforcescompetitive-programminggreedyimplementation
CF 2001D - Longest Max Min Subsequence

We are asked to process a sequence of integers and find a subsequence that maximizes length while containing no repeated elements.

codeforcescompetitive-programmingbrute-forceconstructive-algorithmsdata-structuresgreedyimplementation
Kvant Math Problem 699

Working

kvantmathematicsolympiad
CF 2001E2 - Deterministic Heap (Hard Version)

We are asked to count deterministic max-heaps that can be formed on a perfect binary tree after performing a sequence of increment operations. The tree has height $n$, so it contains $2^n - 1$ nodes. Initially, all node values are zero.

codeforcescompetitive-programmingcombinatoricsdptrees
CF 2001E1 - Deterministic Heap (Easy Version)

Codeforces 2001E1: Deterministic Heap (Easy Version)

codeforcescompetitive-programmingcombinatoricsdpmathtrees
CF 2001C - Guess The Tree

We are asked to reconstruct a hidden tree with n nodes by interacting with a judge that answers specific distance-based queries. Each query "? a b" returns the node x that minimizes the absolute difference in distances from a and b.

codeforcescompetitive-programmingbinary-searchbrute-forcedfs-and-similardivide-and-conquerdsugreedyinteractivetrees