brain

tamnd's digital brain — notes, problems, research

43815 notes

CF 2220A - Blocked

We are given two nonnegative integers (x) and (y). We must construct two new nonnegative integers (p) and (q) such that no bit is set in both numbers simultaneously, that is, [ p ,&, q = 0.

codeforcescompetitive-programminggreedysortings
CF 2220C - Grid L

We are given two types of building blocks: unit-length segments and L-shaped pieces made of two segments joined at a right angle. We need to construct a rectangular grid with dimensions $n times m$ so that every piece is used exactly once.

codeforcescompetitive-programmingbrute-forcemath
CF 2216E - Oriented Journey

The value $V = 7frac{1}{16}$ corresponds to the chi-square statistic computed from $k = 11$ categories, as in Eq. (5). The number of degrees of freedom is therefore $nu = k - 1 = 10$.

codeforcescompetitive-programmingcommunicationconstructive-algorithmsinteractive
CF 2216F - Star Map

After sorting the stars by increasing $x$-coordinate, every star appears at a unique horizontal position and also has a unique $y$-coordinate. The geometry is completely determined by the permutation of the $y$-values in this order.

codeforcescompetitive-programmingconstructive-algorithmsgeometry
CF 2216A - Course Wishes

We are given a small system of courses, each currently assigned a priority level from 1 up to k+1. The last level behaves differently: it has no capacity restriction and is the final target state for every course.

codeforcescompetitive-programminggreedy
CF 2216C - Interval Mod

We are given an array of integers and can repeatedly pick subarrays of length at least k and reduce every element in that subarray modulo one of two given values p or q. The goal is to minimize the sum of the array after any number of such operations.

codeforcescompetitive-programminggreedy
CF 2216D - RReeppeettiittiioonn

The value $V = 7frac{1}{16}$ corresponds to the chi-square statistic computed from $k = 11$ categories, as in Eq. (5). The number of degrees of freedom is therefore $nu = k - 1 = 10$.

codeforcescompetitive-programmingbrute-forceimplementationnumber-theory
CF 2216B - THU Packing Puzzle

The value $V = 7frac{1}{16}$ corresponds to the chi-square statistic computed from $k = 11$ categories, as in Eq. (5). The number of degrees of freedom is therefore $nu = k - 1 = 10$.

codeforcescompetitive-programminggreedy
CF 2202G2 - Monotone Monochrome Matrices (Hard Version)

We are maintaining a very large square grid that starts completely empty, meaning every cell is white. Over time, we flip some cells to black, one by one, and after each flip we must decide whether the resulting black-white pattern is still “valid” under a global…

codeforcescompetitive-programmingdata-structures
Kvant Math Problem 1591

Let $BL$ be the internal angle bisector at $B$ meeting $AC$ at $L$, and $AK$ be the internal angle bisector at $A$ meeting $BC$ at $K$.

kvantmathematicsolympiad
CF 2202G1 - Monotone Monochrome Matrices (Easy Version)

The value $V = 7frac{1}{16}$ corresponds to the chi-square statistic computed from $k = 11$ categories, as in Eq. (5). The number of degrees of freedom is therefore $nu = k - 1 = 10$.

codeforcescompetitive-programmingdata-structures
CF 2202F - Binary Not Search and Queries

We are asked to maintain a sequence of integers and repeatedly compute two properties after point updates. Specifically, for a given array a of length n, we want to find, after each update, the largest length k such that there exist two subarrays of length k with identical…

codeforcescompetitive-programmingdata-structuresgreedy
CF 2202E - Rigged Bracket Sequence

We are given a balanced bracket sequence, meaning every prefix has at least as many opening brackets as closing brackets, and the total numbers match at the end. From this sequence, we choose a non-empty subset of positions.

codeforcescompetitive-programmingdp
Kvant Math Problem 1568

This is a Type B problem.

kvantmathematicsolympiad
CF 2202B - ABAB Construction

The value $V = 7frac{1}{16}$ corresponds to the chi-square statistic computed from $k = 11$ categories, as in Eq. (5). The number of degrees of freedom is therefore $nu = k - 1 = 10$.

codeforcescompetitive-programmingdpgreedyimplementation
CF 2202D - Recollect Numbers

Working

codeforcescompetitive-programmingconstructive-algorithmsimplementation
CF 2202C1 - Lost Civilization (Easy Version)

We are asked to reverse-engineer a process that generates a sequence by repeatedly inserting an incremented copy of an existing element immediately after that element.

codeforcescompetitive-programmingdata-structuresdsugreedy
CF 2202C2 - Lost Civilization (Hard Version)

We are given a sequence of integers, and the task revolves around understanding a generative procedure used by an ancient civilization.

codeforcescompetitive-programmingdata-structuresdpdsugreedy
CF 2197F - Double Bracket Sequence

The value $V = 7frac{1}{16}$ corresponds to the chi-square statistic computed from $k = 11$ categories, as in Eq. (5). The number of degrees of freedom is therefore $nu = k - 1 = 10$.

codeforcescompetitive-programmingdata-structuresdpflowsgreedy
Kvant Math Problem 1569

Working

kvantmathematicsolympiad
Kvant Math Problem 1570

Consider three pairs of diametrically opposite points on a sphere, denoted $A, A'$, $B, B'$, $C, C'$, where $O$ is the center of the sphere.

kvantmathematicsolympiad
CF 2197E2 - Interactive Graph (Hard Version)

We are tasked with reconstructing a hidden directed acyclic graph with n vertices by asking queries about its paths. Each query gives the k-th path in lexicographical order.

codeforcescompetitive-programmingcombinatoricsdfs-and-similardpgraphsinteractive
CF 2197E1 - Interactive Graph (Simple Version)

We are tasked with reconstructing an unknown directed acyclic graph using an interactive interface. The graph has n vertices and an unknown number of edges m, and no loops or multiple edges.

codeforcescompetitive-programmingbinary-searchcombinatoricsdfs-and-similardpgraphsinteractive
CF 2197C - Game with a Fraction

The value $V = 7frac{1}{16}$ corresponds to the chi-square statistic computed from $k = 11$ categories, as in Eq. (5). The number of degrees of freedom is therefore $nu = k - 1 = 10$.

codeforcescompetitive-programminggamesgreedymath
CF 2197D - Another Problem about Beautiful Pairs

We are given an array of integers, and we need to count pairs of indices (i, j) where i < j and the product of the corresponding values equals the distance between the indices: a[i] a[j] = j - i.

codeforcescompetitive-programmingbrute-forcedata-structuresdivide-and-conquermathnumber-theory
CF 2197B - Array and Permutation

We are given a permutation p of length n and an array a of the same length. A permutation is an array of distinct integers from 1 to n, in some order.

codeforcescompetitive-programmingimplementationschedulessortingstwo-pointers
CF 2191G - Median Permutation

We are given a partially filled permutation of size $n$, represented as an array $a$ where zeros indicate unknown positions.

codeforcescompetitive-programmingcombinatorics
CF 2191F - Prufer Vertex

We start with a graph that is already a forest, meaning it is a collection of trees on the vertex set $1 ldots n$. Some edges are present, but the graph is acyclic and possibly disconnected.

codeforcescompetitive-programmingcombinatoricsnumber-theory
CF 2191E - Comparable Permutations

Something went wrong. If this issue persists please contact us through our help center at help.openai.com.

codeforcescompetitive-programminginteractivetwo-pointers
CF 2191C - Sorting Game

We are given a weighted undirected graph. We must choose exactly $n-1$ edges. If those $n-1$ edges form a spanning tree, the choice is forbidden. We want the minimum possible total weight among all choices of $n-1$ edges that do not form a tree.

codeforcescompetitive-programminggames
CF 2191D2 - Sub-RBS (Hard Version)

We are given a string s of parentheses of length n. The task is to consider all non-empty subsequences of s and compute a "score" for each. The score is defined as follows: if the subsequence is not a regular bracket sequence, its score is 0.

codeforcescompetitive-programmingdpgames
CF 2191D1 - Sub-RBS (Easy Version)

We are given a string of parentheses s that is already a valid regular bracket sequence. The task is to find the longest non-empty subsequence t of s that is also a valid regular bracket sequence and is “better” than s.

codeforcescompetitive-programmingconstructive-algorithms
CF 2191B - MEX Reordering

We are given an array of integers, and we are allowed to reorder it arbitrarily. After fixing an order, we look at every possible split position between prefix and suffix.

codeforcescompetitive-programmingconstructive-algorithmssortings
CF 2188G - Doors and Keys

We are given a line of rooms connected by doors, where each door has a time at which it opens automatically and each room may contain a key. You start in room 1 at time 0, and the goal is to find the minimum time to reach each subsequent room.

codeforcescompetitive-programmingdp
CF 2188F - Cool Problem

We are given a string made of characters 0, 1, and ?. Each complete version of this string defines a numerical process that generates a sequence of values. We start from c0 = 0. Then we scan the string from left to right.

codeforcescompetitive-programmingbitmasksdpmath
CF 2188E - Jerry and Tom

Every vertex has an edge to the next vertex, and possibly one additional long jump to a larger vertex. The extra edges never cross. If we draw every edge above the number line, no two extra edges form the pattern $ui < uj < vi < vj$. Jerry must move every turn.

codeforcescompetitive-programmingdata-structuresdfs-and-similargamesgraphsgreedytrees
CF 2188C - Restricted Sorting

We are given an array of integers and asked to find the largest integer $k$ such that the array can be sorted into non-decreasing order by repeatedly swapping any two elements whose difference is at least $k$. If no such $k$ exists, we return $-1$.

codeforcescompetitive-programminggreedysortings
CF 2188A - Divisible Permutation

We are asked to construct a rearrangement of the numbers from 1 to n such that adjacent elements satisfy a divisibility condition tied to their position. More concretely, we build an array p of length n containing each integer from 1 to n exactly once.

codeforcescompetitive-programmingconstructive-algorithms
CF 2188D - Shortest Statement Ever

Working

codeforcescompetitive-programmingbitmasksconstructive-algorithmsdpgreedymath
CF 2175F - Secret Message

We are given a weighted undirected graph. We must choose exactly $n-1$ edges. If those $n-1$ edges form a spanning tree, the choice is forbidden. We want the minimum possible total weight among all choices of $n-1$ edges that do not form a tree.

codeforcescompetitive-programmingdata-structuresimplementationtrees
Kvant Math Problem 1565

A query chooses 50 of the 100 elements and reveals their induced linear order, which determines all pairwise comparisons inside the chosen set.

kvantmathematicsolympiad
CF 2175E2 - Beautiful Patterns (Hard Version)

We are asked to compute the expected beauty of a one-dimensional mosaic of length $n$, where each position is independently colored using one of $m$ colors. The beauty is defined as the square of the number of palindromic subsegments of the mosaic.

codeforcescompetitive-programmingcombinatoricsmathprobabilities
CF 2175E1 - Beautiful Patterns (Easy Version)

We are looking at a random string of length $n$, where each position independently receives one of $m$ colors with equal probability.

codeforcescompetitive-programmingcombinatoricsmathprobabilities
CF 2175D - Wishing Cards

We are tasked with distributing a limited number of wishing cards among $n$ friends so that the cumulative happiness of Little A is maximized. Each friend $i$ can carry at most $ai$ cards, and the sum of all cards cannot exceed $k$.

codeforcescompetitive-programmingdpgreedy
CF 2175C - Needle in a Haystack

We are given two strings, s and t. The goal is to rearrange the letters of t such that s appears as a subsequence in the resulting string, while making the final string lexicographically as small as possible.

codeforcescompetitive-programminggreedystrings
CF 2175B - XOR Array

We are asked to construct an array of positive integers of length n such that the XOR of a single contiguous subarray from index l to r is zero, while the XOR of every other non-empty subarray is non-zero.

codeforcescompetitive-programmingconstructive-algorithmsmath
CF 2166B - Tab Closing

<Title valuea). If there are currently (="Solution Editorial"m) tabs open, every tab has length [ size="2xl"/<Title value="Problem Understanding" size="text{len} = minleft(b,frac{a}{m}right).

codeforcescompetitive-programmingmath
CF 2166F - Path Split

We are given a sequence of integers, and we want to split its elements into several subsequences. Each element must belong to exactly one subsequence, and within each subsequence, consecutive chosen elements must differ by exactly one in value.

codeforcescompetitive-programmingdata-structuresgraph-matchingsgreedy
CF 2166E - Binary Wine

We are given an array of integers, and we are allowed to increase individual elements by paying a cost equal to the total number of increments we perform.

codeforcescompetitive-programmingbitmasksdpgreedymath
CF 2166D - Marble Council

We are given a multiset of integers, which is just a collection where elements can repeat. The task is to count how many different multisets can be generated by repeatedly partitioning the original multiset into any number of non-empty groups and then taking one mode from each…

codeforcescompetitive-programmingdpmath
CF 2166A - Same Difference

We are given a string of lowercase letters. In one move, we pick a position and overwrite its character with the character immediately to its right. The operation only allows copying from right to left, so information flows strictly in one direction.

codeforcescompetitive-programmingbrute-forcegreedystrings
CF 2166C - Cyclic Merging

We are given a set of values placed around a circle, and we repeatedly compress this circle until only one value remains.

codeforcescompetitive-programmingconstructive-algorithmsdata-structuresdsugreedy
CF 2160G2 - Inverse Minimum Partition (Hard Version)

We are given an array of positive integers. For every subarray, we first define a function $f$ that depends on how we optimally split that subarray into consecutive pieces.

codeforcescompetitive-programmingdata-structuresdpgreedy
Kvant Math Problem 1562

We are asked whether a $5\times7$ rectangle can be covered by L-trominoes in several layers so that each cell of the rectangle is covered by the same number of cells from the trominoes.

kvantmathematicsolympiad
CF 2160F - Twin Polynomials

We are given a polynomial $f(x) = a0 + a1 x + dots + an x^n$, where each coefficient is a non-negative integer and the leading coefficient $an$ is positive. Some coefficients are fixed, others are unknown.

codeforcescompetitive-programmingcombinatoricsdpgraphsmath
CF 2160E - Rectangles

We are given a binary grid of size $n times m$, where each cell contains either 0 or 1. A rectangle in this context is defined not by the usual continuous blocks of 1s, but by the four corner cells: a rectangle $(u,d,l,r)$ exists if and only if the top-left, top-right…

codeforcescompetitive-programmingbrute-forcedpgreedyimplementationtwo-pointers
Kvant Math Problem 1564

Let

kvantmathematicsolympiad
CF 2160B - Distinct Elements

The solution correctly identifies the modified middle-square sequence as a special case of a quadratic congruential sequence modulo $2^e$.

codeforcescompetitive-programminggreedymath
CF 2160D - MAD Interactive Problem

We are given a hidden array of length $2n$. Every number from $1$ to $n$ appears exactly twice, but their order is unknown. We cannot see the array directly.

codeforcescompetitive-programmingconstructive-algorithmsgreedyinteractivemath
CF 2160C - Reverse XOR

We are given a target integer $n$, and we want to know whether it is possible to construct some positive integer $x$ such that a specific transformation applied to $x$ and combined with XOR produces exactly $n$.

codeforcescompetitive-programmingbitmasks
Kvant Math Problem 1560

Consider the population as a finite set of $N$ individuals arranged along a circle.

kvantmathematicsolympiad
CF 2151G2 - Hidden Single (Version 2)

We are given a hidden sequence of length $2n-1$ that contains every number from $1$ to $n$ exactly twice, except for one special value that appears only once. So the multiset looks like a perfect pairing structure with a single unpaired element. We cannot see the array directly.

codeforcescompetitive-programmingbinary-searchdivide-and-conquerinteractivemathprobabilities
CF 2151G1 - Hidden Single (Version 1)

We are given a hidden array of length 2n-1 where each number from 1 to n appears exactly twice except for one number, which appears exactly once. Our goal is to determine which number appears only once. We do not need to find its position, only the value.

codeforcescompetitive-programmingbinary-searchdivide-and-conquerinteractivemath
CF 2151F - Attraction Theory

We are given a one-dimensional line with $n$ people initially at positions $1$ through $n$, and each position $i$ has a value $ai$.

codeforcescompetitive-programmingcombinatoricsdp
CF 2151D - Grid Counting

We are given an $n times n$ grid and we must choose a set of black cells. The choice is constrained by three independent-looking counting rules. The first rule fixes how many black cells appear in each row. Row $k$ must contain exactly $ak$ chosen cells.

codeforcescompetitive-programmingcombinatorics
CF 2151E - Limited Edition Shop

We are asked to simulate a limited-edition shop where Alice and Bob take turns picking items, but with a twist: we do not control who goes first or in which order they enter. Each item has a value according to us, and Alice and Bob each have a personal ranking of the items.

codeforcescompetitive-programmingdata-structuresdpgamesgreedy
CF 2151A - Incremental Subarray

Let $m = 2^e$ and consider the modified middle-square sequence defined by Coveyou: $X0 text{ given}, qquad X{n+1} = operatorname{middle}(Xn^2 + 2^{e-1} Xn), eqno(4)$ where the function $operatorname{middle}(cdot)$ extracts the middle $2e$ bits of the argument in double precision.

codeforcescompetitive-programmingmathstrings
CF 2151B - Incremental Path

We are given a virtual strip with cells numbered from 1 to $10^9$, where some cells are initially black and the rest are white. Multiple people start from cell 1, and each executes a prefix of a command string composed of two instructions.

codeforcescompetitive-programmingimplementation
CF 2151C - Incremental Stay

We are given a sequence of 2n timestamps representing moments when visitors passed through a single museum door. Each timestamp corresponds either to an entrance or an exit, but the sensor cannot distinguish which.

codeforcescompetitive-programminggreedyimplementationmath
CF 2139F - Antiamuny and Slider Movement

We are given a set of sliders on a one-dimensional track, each occupying a single position. The sliders are initially ordered left to right, with no overlaps. Each operation attempts to move a particular slider to a target position.

codeforcescompetitive-programming
CF 2139E2 - Maple and Tree Beauty (Hard Version)

We are working with a rooted tree where every vertex will eventually be assigned either a zero or a one, but the assignment is not fixed. We only know how many zeros must appear overall, while the remaining vertices become ones.

codeforcescompetitive-programmingbitmasksdfs-and-similardpffttrees
CF 2139E1 - Maple and Tree Beauty (Easy Version)

We are given a rooted tree with n vertices, where each vertex must be labeled either 0 or 1. Exactly k vertices are labeled 0, and the remaining n-k are labeled 1. The tree's root is vertex 1, and each other vertex has a specified parent.

codeforcescompetitive-programmingdfs-and-similardpmathtrees
CF 2139D - Antiamuny Wants to Learn Swap

We are given a permutation and asked about many contiguous segments of it. For each segment, imagine trying to sort it into increasing order.

codeforcescompetitive-programmingdata-structuresgreedy
CF 2139B - Cake Collection

Maple has multiple ovens, each producing cakes at a fixed rate per second. She can collect all the cakes from one oven at the end of each second, and she can teleport to any oven, including the one she is already at.

codeforcescompetitive-programminggreedy
CF 2139C - Cake Assignment

The solution correctly interprets the problem. A "gap of length $r$" is the number of consecutive $U$’s falling outside $[alpha, beta)$ before the next $U$ falls inside that interval.

codeforcescompetitive-programmingbitmasksconstructive-algorithmsgreedy
CF 2136F2 - From the Unknown (Hard Version)

We are interacting with a text editor whose behavior depends on a hidden parameter $W$, the width of a line. An article is a sequence of word lengths, and the editor lays words into lines greedily: it fills the current line until the next word would overflow $W$, then starts a…

codeforcescompetitive-programmingconstructive-algorithmsinteractivemath
CF 2136E - By the Assignment

We are given an undirected connected graph where each vertex carries an integer label. Some labels are fixed, while others are unknown and must be chosen from the range $0$ to $V-1$. For any simple path, we define its value as the XOR of all vertex labels along that path.

codeforcescompetitive-programmingdfs-and-similardsugraphs
CF 2136F1 - From the Unknown (Easy Version)

We are given an interactive editor that wraps words into lines based on a hidden width parameter $W$. Each article is represented as a sequence of word lengths.

codeforcescompetitive-programmingconstructive-algorithmsinteractive
CF 2136D - For the Champion

Let $p = beta - alpha$ be the probability that a single $Uj$ lies in the interval $[alpha, beta)$, as in equation (4). A gap of length $r$ occurs when $r$ consecutive $U$'s fall outside $[alpha, beta)$, followed by a $U$ inside the interval.

codeforcescompetitive-programmingconstructive-algorithmsinteractivemath
CF 2136B - Like the Bitset

We are asked to construct a permutation of length $n$ that satisfies a positional maximum constraint determined by a binary string $s$ and an integer $k$.

codeforcescompetitive-programmingconstructive-algorithmsgreedytwo-pointers
CF 2136C - Against the Difference

We are given an array of integers, and our goal is to extract the longest possible subsequence that is "neat." A neat subsequence is made by concatenating one or more blocks, where a block is a sequence of identical numbers, and the value of the number equals the length of the…

codeforcescompetitive-programmingdata-structuresdp
CF 2130F - Permutation Blackhole

We are asked to count permutations that produce a given scoring pattern in a dynamic coloring process. Think of it as a row of white cells indexed from 1 to $n$.

codeforcescompetitive-programmingdp
CF 2130E3 - Interactive RBS (Hard Version)

We are asked to reconstruct a hidden sequence of parentheses of length $n$ using an interactive oracle. The sequence contains only '(' and ')' characters and is guaranteed to have at least one opening and one closing bracket.

codeforcescompetitive-programminginteractive
CF 2130E2 - Interactive RBS (Medium Version)

We are given a hidden sequence of parentheses of length n, containing at least one '(' and one ')'. The sequence is regular in the sense that some of its contiguous substrings are valid bracket sequences.

codeforcescompetitive-programmingbinary-searchbitmasksconstructive-algorithmsinteractivestrings
CF 2130E1 - Interactive RBS (Easy Version)

In the original interactive problem there is a hidden bracket sequence consisting of '(' and ')'. We may ask queries about selected positions, and the judge returns the number of regular bracket substrings in the constructed string.

codeforcescompetitive-programmingbinary-searchconstructive-algorithmsinteractivestrings
CF 2130D - Stay or Mirror

We are given a permutation of length $n$, which means an array containing every integer from $1$ to $n$ exactly once. For each element in this permutation, we are allowed to either leave it as is or replace it with a "mirrored" value defined by $2n - pi$.

codeforcescompetitive-programmingdata-structuresgreedy
CF 2130B - Pathless

We are given an array of integers where each element is either 0, 1, or 2, and a target sum s. Alice wants to start at the first element and move either left or right, step by step, until she reaches the last element.

codeforcescompetitive-programmingconstructive-algorithms
CF 2130C - Double Perspective

We are given a set of integer pairs, each representing both a segment on a number line and an edge in a graph. Our goal is to select a subset of these pairs to maximize the difference between the total length of covered integers, called $f(S')$, and the number of nodes that…

codeforcescompetitive-programmingconstructive-algorithmsdsugreedy
CF 2116E - Gellyfish and Eternal Violet

The problem can be reframed as follows. Gellyfish faces a group of n monsters, each with a given HP hi. She wants to reduce every monster's HP to exactly 1. She has m rounds of attacks, and in each round a special sword may “shine” with probability p.

codeforcescompetitive-programmingcombinatoricsdpgreedy
CF 2116F - Gellyfish and Forget-Me-Not

In this problem, we have a sequential two-player game with a numeric twist. Each round has a pair of numbers, one from array a and one from array b. There is also a binary string c that decides whose turn it is.

codeforcescompetitive-programmingbitmasksgreedymath
CF 2116D - Gellyfish and Camellia Japonica

We are given a length-n array that evolves under q operations. Each operation takes two indices x and y, computes the smaller of their current values, and writes that value into a third position z.

codeforcescompetitive-programmingconstructive-algorithmsdfs-and-similargraphsgreedytrees
CF 2116B - Gellyfish and Baby's Breath

We are given two permutations p and q of the numbers 0...n-1. For every position i, we must evaluate all pairs of indices (j, i-j) such that 0 ≤ j ≤ i, and compute $$2^{pj}+2^{q{i-j}}$$ Among all these candidates, we take the maximum and store it in r[i].

codeforcescompetitive-programminggreedymathsortings
CF 2116C - Gellyfish and Flaming Peony

We are given an array of positive integers. In one operation, we choose two different positions and replace one value with the gcd of the two values. The process may be repeated as many times as needed.

codeforcescompetitive-programmingbrute-forcedfs-and-similardpmathnumber-theoryshortest-paths
CF 2116A - Gellyfish and Tricolor Pansy

We are asked to predict the winner of a turn-based duel between two players, Gellyfish and Flower. Each player has a main character and a knight, each with its own health points (HP). Gellyfish has a HP, Flower has b HP, Gellyfish's knight has c HP, and Flower's knight has d HP.

codeforcescompetitive-programminggamesgreedy
CF 2102F - Mani and Segments

We are given a permutation and asked to count how many of its contiguous segments have a very specific structural property involving order.

codeforcescompetitive-programmingdata-structuresgreedy
CF 2102D - Quartet Swapping

We have a permutation and a single allowed operation on four consecutive positions: $$[ai,a{i+1},a{i+2},a{i+3}] rightarrow [a{i+2},a{i+3},ai,a{i+1}]$$ Viewed differently, the element at position $i$ swaps with $i+2$, and the element at position $i+1$ swaps with $i+3$.

codeforcescompetitive-programmingdata-structuresgreedysortings
CF 2102E - 23 Kingdom

We are asked to maximize the "beauty" of a derived array based on an input array. The input array a gives an upper bound on each element of a new array b, which must have the same length. Each element of b satisfies 1 ≤ bi ≤ ai.

codeforcescompetitive-programmingdata-structuresgreedyternary-searchtwo-pointers
CF 2102C - Mex in the Grid

We are asked to place all integers from $0$ to $n^2 - 1$ into an $n times n$ grid, each number used exactly once.

codeforcescompetitive-programmingconstructive-algorithms
CF 2098F - Homework

We are given two binary strings of equal length. We are allowed to repeatedly apply a structured operation that splits a string into two halves and then either mixes the halves coordinate-wise using XOR, or recurses into both halves and applies the same process independently.

codeforcescompetitive-programming
CF 2098D - Baggage Claim

Working

codeforcescompetitive-programmingcombinatoricsdfs-and-similargraphsmath