brain

tamnd's digital brain — notes, problems, research

41650 notes

CF 1227D2 - Optimal Subsequences (Hard Version)

We are given a fixed array of integers and many queries. Each query asks us to imagine picking exactly $k$ elements from the array while preserving their original order. Among all such subsequences of length $k$, we first want the one with the maximum possible sum.

codeforcescompetitive-programmingdata-structuresgreedy
CF 1227C - Messy

We are given a sequence of parentheses and are allowed to apply an operation that reverses any contiguous segment.

codeforcescompetitive-programmingconstructive-algorithms
CF 1227B - Box

We are given a non-decreasing array q, which is claimed to be produced from some hidden permutation p by taking prefix maxima. At every position i, q[i] equals the largest value among the first i elements of p.

codeforcescompetitive-programmingconstructive-algorithms
CF 1227D1 - Optimal Subsequences (Easy Version)

We are given a sequence of numbers and, for each query, we must imagine selecting exactly k elements from this sequence while preserving their original order. Among all such subsequences, we first care about maximizing the sum of chosen values.

codeforcescompetitive-programmingdata-structuresgreedy
CF 1225F - Tree Factory

We are given a rooted tree where vertex labels already obey a strict ordering constraint: every node except the root has a parent with a smaller label.

codeforcescompetitive-programmingconstructive-algorithmsgreedytrees
CF 1225D - Power Products

We are given a sequence of positive integers and asked to count how many pairs of indices produce a product that is a perfect k-th power. In other words, for two distinct elements $ai$ and $aj$, we want to know whether their product can be written as $x^k$ for some integer $x$.

codeforcescompetitive-programminghashingmathnumber-theory
CF 1225C - p-binary

We are given a positive target number $n$. We also fix an integer $p$, which shifts a family of numbers of the form $2^x + p$, where $x ge 0$. Each such value is a single “building block”, and we are allowed to reuse the same block any number of times.

codeforcescompetitive-programmingbitmasksbrute-forcemath
CF 1223F - Stack Exterminable Arrays

We are given an array and a peculiar cancellation process that behaves like a stack with annihilation. We scan the array from left to right, maintaining a stack. When we see a value, if the stack top is different, we push it.

codeforcescompetitive-programmingdata-structuresdivide-and-conquerdphashing
CF 1223G - Wooden Raft

We are given a collection of logs, each with an integer length. From these logs we are allowed to cut pieces, but we are not allowed to glue pieces together. The goal is to assemble a rectangular raft structure that requires two kinds of side lengths, call them x and y.

codeforcescompetitive-programmingbinary-searchmathnumber-theory
CF 1223E - Paint the Tree

We are given a tree where every edge has a weight. The task is to assign colors to vertices under a very specific rule: each vertex receives exactly $k$ colors, and any particular color can appear at most twice across the entire tree.

codeforcescompetitive-programmingdpsortingstrees
CF 1223B - Strings Equalization

Each query gives two strings of the same length. You are allowed to repeatedly apply an operation on either string: pick two neighboring characters and overwrite one with the other.

codeforcescompetitive-programmingstrings
CF 1223A - CME

We are given a number of matches and we want to arrange them into a valid arithmetic equation of the form “a + b = c”, where each number is strictly positive.

codeforcescompetitive-programmingmath
CF 1221F - Choose a Square

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

codeforcescompetitive-programmingbinary-searchdata-structuressortings
CF 1221B - Knights

We are filling an $n times n$ chessboard where every cell must contain either a white knight or a black knight. The goal is not about placing pieces to avoid attacks, but rather to maximize how many pairs of opposing-colored knights can attack each other under standard knight…

codeforcescompetitive-programmingconstructive-algorithmsgreedy
CF 1221D - Make The Fence Great Again

We are given a sequence of fence boards, each with an initial height and a cost per unit increase in height. One operation lets us pick a board and increase its height by exactly one, paying its per-unit cost each time. We can repeat this any number of times for any board.

codeforcescompetitive-programmingdp
CF 1221E - Game With String

We are given a binary string made of two types of characters: empty cells denoted by . and blocked cells denoted by X. Two players alternate turns, starting with Alice.

codeforcescompetitive-programminggames
CF 1220G - Geolocation

We are given a fixed set of points in the plane, which we can think of as antennas. For each query, there is an unknown integer point in a bounded grid, and we are told the squared distances from that point to all antennas.

codeforcescompetitive-programminggeometry
CF 1220F - Gardener Alex

We are given a permutation of length $n$. From this permutation, a binary tree is constructed in a deterministic way: the smallest value in a segment becomes the root of that segment, and the remaining elements are split into the left and right subsegments around it.

codeforcescompetitive-programmingbinary-searchdata-structures
CF 1220D - Alex and Julian

We are given a finite set of positive integers, but the structure we build from it is infinite. Every integer is a vertex, and each number in the set is interpreted as a “distance type”.

codeforcescompetitive-programmingbitmasksmathnumber-theory
CF 1220E - Tourism

We are given a connected undirected graph where each vertex represents a city and each city has a fixed value. Alex starts from a specific city and walks through the graph by traversing edges, with one restriction: he is not allowed to immediately traverse back along the same…

codeforcescompetitive-programmingdfs-and-similardpdsugraphsgreedytrees
CF 1220A - Cards

We are given a multiset of letters that originally came from writing several binary words, where each word is either the string "zero" representing digit 0 or "one" representing digit 1.

codeforcescompetitive-programmingimplementationsortingsstrings
CF 1218I - The Light Square

We are given three ingredients that define a transformation problem on a binary grid. First is an initial $N times N$ board of lights, each cell either on or off. Second is a target $N times N$ configuration we want to reach.

codeforcescompetitive-programming2-satdfs-and-similargreedy
CF 1218G - Alpha planetary system

We are given a network of spaceports connected by undirected shuttle routes. Each spaceport belongs to exactly one of three planets labeled X, Y, or Z. Every shuttle connects two different spaceports, and only connections between different planets exist.

codeforcescompetitive-programmingconstructive-algorithmsgraphsshortest-paths
CF 1218D - Xor Spanning Tree

We are given an undirected graph where each edge represents a wormhole between two planets and has a repair cost.

codeforcescompetitive-programmingdivide-and-conquerfftgraphs
CF 1218E - Product Tuples

We are given an array of values, and each query asks us to evaluate a very specific symmetric polynomial built from a transformed version of that array. For a fixed number $q$, we first convert every element $ai$ into $bi = q - ai$.

codeforcescompetitive-programmingdivide-and-conquerfft
CF 1218A - BubbleReactor

We are given an undirected graph with $N$ vertices and exactly $N$ edges, and no pair of vertices is connected by more than one edge.

codeforcescompetitive-programmingdpgraphs
CF 1218B - Guarding warehouses

We are given a set of non-overlapping convex polygonal regions in the plane. Each polygon represents a warehouse. Bob stands at the origin, and for every point inside any warehouse we want to know whether Bob can “see” it using a special optical device.

codeforcescompetitive-programmingdata-structuresgeometry
CF 1218C - Jumping Transformers

We are moving through a grid from the top-left cell to the bottom-right cell, and each second we can only move either one step to the right or one step down. Any valid path is therefore a monotone path with exactly $N + M - 2$ moves.

codeforcescompetitive-programmingdp
CF 1217F - Forced Online Queries Problem

The graph starts empty, but it is continuously modified by two types of operations. The first operation toggles an edge between two vertices, and the second operation asks whether two vertices are connected in the current graph.

codeforcescompetitive-programmingdata-structuresdivide-and-conquerdsugraphstrees
CF 1217A - Creating a Character

We are given a character with two base attributes: strength and intelligence. We are also given a pool of extra experience points that must all be distributed. Each point can increase either strength or intelligence by exactly one unit.

codeforcescompetitive-programmingbinary-searchmath
CF 1217E - Sum Queries?

We are given an array of integers that changes over time, and we are repeatedly asked to inspect a chosen segment of this array.

codeforcescompetitive-programmingdata-structuresgreedyimplementationmath
CF 1217D - Coloring Edges

We are given a directed graph where each edge is fixed in advance, and we must assign a color (an integer label) to every edge. The constraint is not about vertices but about directed cycles: if you look at all edges of a single color, they must not contain any directed cycle.

codeforcescompetitive-programmingconstructive-algorithmsdfs-and-similargraphs
CF 1216D - Swords

We are given a collection of sword types, each type having some remaining count after a theft. For each type $i$, the value $ai$ tells us how many swords of that type are still present in the basement. Originally, every type had the same unknown quantity $x$.

codeforcescompetitive-programmingmath
CF 1216A - Prefixes

We are given a binary string made only of the characters a and b, and its length is guaranteed to be even. The task is to transform this string using the minimum number of single-character flips so that every prefix whose length is even contains exactly the same number of a…

codeforcescompetitive-programmingstrings
CF 1214H - Tiles Placement

We are given a tree with $n$ vertices, where each vertex represents a square in a pedestrian network. Each vertex must be assigned one of $k$ colors.

codeforcescompetitive-programmingconstructive-algorithmsdfs-and-similartrees
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