brain

tamnd's digital brain — notes, problems, research

41650 notes

CF 1335D - Anti-Sudoku

We start with a fully valid Sudoku grid. Every row, every column, and every 3 by 3 subgrid contains the digits 1 through 9 exactly once.

codeforcescompetitive-programmingconstructive-algorithmsimplementation
CF 1334D - Minimum Euler Cycle

We are asked to construct a walk in a complete directed graph on vertices labeled from 1 to n, where every ordered pair of distinct vertices forms a directed edge. This means between any two different vertices u and v, both directions u → v and v → u exist.

codeforcescompetitive-programmingconstructive-algorithmsgraphsgreedyimplementation
CF 1334C - Circle of Monsters

We are given a ring of monsters. Each monster has an initial health value, and also a fixed explosion damage value that is applied to its next neighbor when it dies.

codeforcescompetitive-programmingbrute-forceconstructive-algorithmsgreedymath
CF 1333B - Kind Anton

We are given two integer arrays of the same length. The first array starts with very restricted values, each position being either negative one, zero, or positive one. The second array can contain arbitrary integers, potentially very large in magnitude.

codeforcescompetitive-programminggreedyimplementation
CF 1333C - Eugene and an array

We are given a sequence of integers and asked to count how many contiguous segments of this sequence are “robust” in a very specific sense. A segment is considered valid if every one of its nonempty contiguous subsegments has a sum that is not zero.

codeforcescompetitive-programmingbinary-searchdata-structuresimplementationtwo-pointers
CF 1332G - No Monotone Triples

We are given an array of numbers and many queries over subsegments. For each query interval $[L, R]$, we must pick a subsequence of indices inside this interval, in increasing order, with length at least 3, such that the chosen values contain no triple of indices $i < j < k$…

codeforcescompetitive-programmingdata-structures
CF 1332E - Height All the Same

We are given a rectangular grid with $n times m$ cells, and each cell starts with some integer height $a{i,j}$. The game allows two types of moves that increase heights: either we add one cube to two adjacent cells at the same time, or we add two cubes to a single cell.

codeforcescompetitive-programmingcombinatoricsconstructive-algorithmsmathmatrices
CF 1331G - Lingua Romana

We are given a short program written in a heavily stylized “Roman-like” pseudocode language. The program reads a sequence of integers from standard input, and for each integer it computes a numeric function and prints either a formatted value or a special overflow message.

codeforcescompetitive-programming*special
CF 1331D - Again?

We are given a single 7-character number written in a mixed numeral system. The first character is always the letter A, which should be interpreted as the value 10. The remaining six characters are digits from 0 to 9. Together, they form a base-11 number of fixed length 7.

codeforcescompetitive-programming*specialimplementation
CF 1329E - Dreamoon Loves AA

We are given a very long binary string consisting only of the characters A and B, with the guarantee that the first and last characters are always A. In addition to these fixed endpoints, we are given the positions of some other A characters inside the string.

codeforcescompetitive-programmingbinary-searchgreedy
CF 1329D - Dreamoon Likes Strings

We are given a string that evolves under a deletion game. In one move, we are allowed to pick a contiguous substring, but only if that substring is “locally alternating”, meaning no two adjacent characters inside it are equal.

codeforcescompetitive-programmingconstructive-algorithmsdata-structures
CF 1329B - Dreamoon Likes Sequences

We are asked to count how many strictly increasing sequences of integers we can choose from the range $[1, d]$, with an extra constraint that depends on cumulative XORs of the chosen values.

codeforcescompetitive-programmingbitmaskscombinatoricsmath
CF 1329C - Drazil Likes Heap

Codeforces 1329C: Drazil Likes Heap

codeforcescompetitive-programmingconstructive-algorithmsdata-structuresgreedyimplementation
CF 1329A - Dreamoon Likes Coloring

We are given a row of cells initially all unpainted. We will perform a sequence of painting operations, where each operation paints a contiguous segment of fixed length, but we are free to choose the starting position of that segment.

codeforcescompetitive-programmingconstructive-algorithmsgreedyimplementationmath
CF 1328F - Make k Equal

Codeforces 1328F: Make k Equal

codeforcescompetitive-programminggreedy
CF 1328D - Carousel

We are given a circular arrangement of positions, each holding an animal type. The positions are connected in a cycle, so after the last position comes the first again. We must assign a color to each position.

codeforcescompetitive-programmingconstructive-algorithmsdpgraphsgreedymath
CF 1328C - Ternary XOR

We are given a ternary string x, meaning each position is a digit among 0, 1, or 2. The task is to split this single number into two ternary numbers a and b, both of the same length as x, such that if we add them digit by digit modulo 3, we recover x.

codeforcescompetitive-programminggreedyimplementation
CF 1327C - Game with Chips

We are given a grid of size $n times m$ with several chips placed on cells. Each chip can be moved simultaneously with all others by applying a single global move in one of four directions: up, down, left, or right.

codeforcescompetitive-programmingconstructive-algorithmsimplementation
CF 1327F - AND Segments

We are building an array of length $n$, where each position stores an integer with at most $k$ bits. On top of that, we are given several constraints, each describing a segment $[l, r]$ and a required value for the bitwise AND of all elements in that segment.

codeforcescompetitive-programmingbitmaskscombinatoricsdata-structuresdptwo-pointers
CF 1326E - Bombs

We are given a permutation p, which we can think of as values arriving in a fixed order from position 1 to n. While processing this order, we maintain a multiset A. Each time we process position i, we insert p[i] into A.

codeforcescompetitive-programmingdata-structurestwo-pointers
CF 1326D2 - Prefix-Suffix Palindrome (Hard version)

We are given a string and we want to build the longest possible palindrome that can be formed by taking a prefix of the string, a suffix of the string, or both, and concatenating them in that order.

codeforcescompetitive-programmingbinary-searchgreedyhashingstring-suffix-structuresstrings
CF 1326G - Spiderweb Trees

We are given a geometric tree: each vertex is a point in the plane and edges form a non-crossing tree. This already means the embedding is fixed, so geometric notions like convex hull are meaningful relative to the given drawing.

codeforcescompetitive-programmingdpgeometrytrees
CF 1325E - Ehab's REAL Number Theory Problem

We are given a sequence of integers, and we want to select a subsequence whose product becomes a perfect square. Among all such subsequences, we need the minimum possible length.

codeforcescompetitive-programmingbrute-forcedfs-and-similargraphsnumber-theoryshortest-paths
CF 1325B - CopyCopyCopyCopyCopy

We are given an array and we construct a much larger array by repeating it end-to-end many times. The repetition count is equal to the original length of the array, so the final sequence has size $n cdot n$.

codeforcescompetitive-programminggreedyimplementation
CF 1324A - Yet Another Tetris Problem

We are given a sequence of column heights representing a vertical terrain. Each column has some initial number of blocks stacked on it. The only operation available is to repeatedly choose a column and place a fixed vertical piece that increases that column’s height by 2.

codeforcescompetitive-programmingimplementationnumber-theory
CF 1324D - Pair of Topics

We are given a list of topics, each topic carrying two different scores. One score measures how interesting the topic is for the teacher, and the other measures how interesting it is for students.

codeforcescompetitive-programmingbinary-searchdata-structuressortingstwo-pointers
CF 1323A - Even Subset Sum Problem

We are given several independent arrays of positive integers. For each array, we must select a non-empty group of positions such that the sum of the chosen values is even. If no such group exists, we report failure.

codeforcescompetitive-programmingbrute-forcedpgreedyimplementation
CF 1322F - Assigning Fares

We are given a tree with $n$ stations and $n-1$ tunnels, so between any two stations there is exactly one simple path. On this tree, we are also given $m$ special routes.

codeforcescompetitive-programmingdptrees
CF 1322A - Unusual Competitions

We are given a string consisting only of parentheses, and we are allowed to modify it using an operation that picks any contiguous segment and permutes its characters arbitrarily. The cost of such an operation equals the length of the chosen segment.

codeforcescompetitive-programminggreedy
CF 1321C - Remove Adjacent

We are given a string of lowercase letters. We repeatedly remove characters under a local rule: a character can be deleted only if at least one of its current neighbors is exactly one letter earlier in the alphabet than itself.

codeforcescompetitive-programmingbrute-forceconstructive-algorithmsgreedystrings
CF 1320D - Reachable Strings

We are given a fixed binary string, and we repeatedly consider two kinds of local transformations on any contiguous segment of length three: swapping 011 into 110, or the reverse swap 110 into 011.

codeforcescompetitive-programmingdata-structureshashingstrings
CF 1320B - Navigation System

We are given a directed graph where intersections are nodes and roads are one-way edges. We also know a fixed simple route Polycarp actually drives from his home to his work.

codeforcescompetitive-programmingdfs-and-similargraphsshortest-paths
CF 1316F - Battalion Strength

We are given a list of officers, each with a numerical power. From these officers, a battalion is formed by choosing any subset uniformly at random, including the empty set.

codeforcescompetitive-programmingdata-structuresdivide-and-conquerprobabilities
CF 1315C - Restoring Permutation

We are given a sequence of values that are meant to represent the smaller element in each of several disjoint pairs. In the final construction, we must build an array of length 2n using every number from 1 to 2n exactly once, and then split it into n consecutive pairs.

codeforcescompetitive-programminggreedy
CF 1315B - Homecoming

We are given a one-dimensional town represented as a line of crossroads indexed from 1 to n. Each position has exactly one type of transport station: either type A (bus-compatible segment marker) or type B (tram-compatible segment marker). The string s encodes this layout.

codeforcescompetitive-programmingbinary-searchdpgreedystrings
CF 1313A - Fast Food Restaurant

We are given three independent supplies: dumplings, juice, and pancakes. Each visitor receives a subset of these three items, with two constraints. First, a visitor cannot receive more than one of each item type. Second, no two visitors may receive the exact same subset.

codeforcescompetitive-programmingbrute-forcegreedyimplementation
CF 1312B - Bogosort

We are given an array of integers and are allowed to permute it arbitrarily. After rearranging, we assign each value to a position starting from 1. The array is considered valid if no two positions share the same value of the expression i - a[i].

codeforcescompetitive-programmingconstructive-algorithmssortings
CF 1311E - Construct the Binary Tree

We are asked to build a rooted tree on vertices labeled from 1 to n, where vertex 1 is the root. Every vertex except the root has exactly one parent, and each vertex is allowed to have at most two children, so the structure must be a binary tree in the rooted sense.

codeforcescompetitive-programmingbrute-forceconstructive-algorithmstrees
CF 1310D - Tourism

We are given a complete directed graph of cities where every ordered pair of distinct cities has a travel cost. Starting from city 1, we must perform exactly $k$ moves, and end again at city 1. Each move is just choosing a directed edge and paying its cost.

codeforcescompetitive-programmingdpgraphsprobabilities
CF 1310B - Double Elimination

We are given a full double elimination tournament with $2^n$ teams, where the bracket structure is completely fixed.

codeforcescompetitive-programmingdpimplementation
CF 1307G - Cow and Exercise

We are given a directed weighted graph with up to 50 vertices, representing fields connected by roads. A cow starts at node 1 and wants to reach node n, and the time it takes is determined by the shortest path in this graph. Now the twist: we are allowed to “slow down” edges.

codeforcescompetitive-programmingflowsgraphsshortest-paths
CF 1307B - Cow and Friend

A rabbit starts at the origin in the plane and wants to land exactly at the point $(x, 0)$. He moves by making a sequence of jumps, and each jump can have any direction, but its length must match one of the allowed values given in the input.

codeforcescompetitive-programminggeometrygreedymath
CF 1307D - Cow and Fields

We are given an undirected, connected graph representing fields connected by roads. A traveler starts at node 1 and wants to reach node n using the shortest possible route.

codeforcescompetitive-programmingbinary-searchdata-structuresdfs-and-similargraphsgreedyshortest-pathssortings
CF 1305E - Kuroni and the Score Distribution

We are asked to construct a strictly increasing sequence of integers $a1 < a2 < dots < an$, all between 1 and $10^9$, such that a specific combinatorial condition on triples is satisfied.

codeforcescompetitive-programmingconstructive-algorithmsgreedyimplementationmath
CF 1305H - Kuroni the Private Tutor

We are given an exam with a fixed number of questions, where each question contributes either 0 or 1 point to each student.

codeforcescompetitive-programmingbinary-searchgreedy
CF 1305D - Kuroni and the Celebration

We are given a fixed tree with up to 1000 vertices. Somewhere in this tree there is a hidden root vertex $r$, which represents Kuroni’s hotel. The structure of the tree is known, but the root is not.

codeforcescompetitive-programmingconstructive-algorithmsdfs-and-similarinteractivetrees
CF 1304F2 - Animal Observation (hard version)

We are given a grid of values over time. Each row represents a day, and each column represents a spatial segment of a forest. The value in a cell tells how many animals can be observed in that segment on that day.

codeforcescompetitive-programmingdata-structuresdpgreedy
CF 1304B - Longest Palindrome

We are given a collection of distinct strings, all of the same length, and we are allowed to pick any subset of them and arrange the chosen strings in some order. After concatenation, the goal is to obtain a palindrome with maximum possible total length.

codeforcescompetitive-programmingbrute-forceconstructive-algorithmsgreedyimplementationstrings
CF 1304F1 - Animal Observation (easy version)

We are given a grid that evolves over time. Each day produces a full array of animal counts across a line of forest sections. We want to place two cameras repeatedly over a sequence of days, where each camera always covers a contiguous segment of exactly $k$ forest sections.

codeforcescompetitive-programmingdata-structuresdp
CF 1304D - Shortest and Longest LIS

We are given a pattern of strict comparisons between consecutive positions in a permutation of size n. Each position tells whether the next value must be larger or smaller than the current one. From this constraint, many permutations are possible.

codeforcescompetitive-programmingconstructive-algorithmsgraphsgreedytwo-pointers
CF 1303D - Fill The Bag

We are given a target amount of space, and a collection of available blocks whose sizes are powers of two. The task is to decide whether we can exactly compose the target size using these blocks, and if not, report impossibility.

codeforcescompetitive-programmingbitmasksgreedy
CF 1303G - Sum of Prefix Sums

We are given a tree where each node stores a positive integer. For any simple path between two vertices, we read the values along that path in order and then compute a special score: we first form all prefix sums of that sequence and then sum those prefix sums together.

codeforcescompetitive-programmingdata-structuresdivide-and-conquergeometrytrees
CF 1303F - Number of Components

We are working on a grid that starts completely empty in the sense that every cell contains the same value, zero. Over time, we perform a sequence of updates.

codeforcescompetitive-programmingdsuimplementation
CF 1303B - National Project

We are building a road of length $n$, where each unit of road must eventually be asphalted exactly once. The construction proceeds day by day, and on each day we may either work on exactly one unit or do nothing. The weather is periodic.

codeforcescompetitive-programmingmath
CF 1303C - Perfect Keyboard

We are given a string consisting of lowercase letters, and we want to decide whether it is possible to arrange all 26 letters of the alphabet in a single line such that every consecutive pair of characters appearing in the string are also adjacent in this line layout.

codeforcescompetitive-programmingdfs-and-similargreedyimplementation
CF 1302J - Keep talking and nobody explodes -- hard

We are given a lock described by a sequence of exactly 100 decimal digits. Think of it as a row of 100 small wheels, each showing a digit from 0 to 9.

codeforcescompetitive-programming
CF 1302G - Keep talking and nobody explodes -- medium

We are given a fixed 5-digit lock state. Each digit can be incremented cyclically, so 9 wraps back to 0. Starting from an initial 5-digit configuration, we must apply a long, fixed sequence of conditional rules.

codeforcescompetitive-programming
CF 1302E - Amazing bitset

We are given a binary string of length $n$, but instead of being fixed, each position is generated independently as a random bit: it becomes $1$ with probability $p = frac{a}{b}$ and $0$ with probability $1 - p$.

codeforcescompetitive-programming
CF 1302F - Keep talking and nobody explodes -- easy

We are given a 5-digit lock state. Each digit behaves like a circular counter from 0 to 9, so increasing a digit by 1 means moving to the next digit and wrapping 9 back to 0. The process consists of a fixed sequence of 20 deterministic instructions.

codeforcescompetitive-programmingbitmasksbrute-forceexpression-parsing
CF 1302A - Nash equilibrium

We are working with a rectangular grid of numbers. Each cell behaves like a player in a two-dimensional game: it is compared vertically against its column and horizontally against its row.

codeforcescompetitive-programming
CF 1301E - Nanosoft

We are given a colored grid where each cell is one of four colors. Inside this grid, we are asked many independent queries.

codeforcescompetitive-programmingbinary-searchdata-structuresdpimplementation
CF 1301D - Time to Run

The grid in this problem can be viewed as a directed version of the standard rectangular lattice where every pair of horizontally or vertically adjacent cells is connected by two opposite directed edges.

codeforcescompetitive-programmingconstructive-algorithmsgraphsimplementation
CF 1301B - Motarack's Birthday

We are given an array of length $n$ where some positions contain fixed integers and some positions are marked as missing. All missing positions will be filled with a single chosen value $k$.

codeforcescompetitive-programmingbinary-searchgreedyternary-search
CF 1301A - Three Strings

We are given three strings of equal length. Think of them as three rows of characters aligned in columns. At each column position, we are allowed to perform exactly one operation: we pick either the character in the third string and swap it with the character in the first…

codeforcescompetitive-programmingimplementationstrings
CF 1299E - So Mean

We are given a hidden permutation of numbers from $1$ to $n$, where $n$ is even. We cannot directly see it, but we can query any subset of indices. For a chosen subset, the judge tells us only whether the average value of the selected positions is an integer.

codeforcescompetitive-programminginteractivemath
CF 1299C - Water Balance

We are given a sequence of water volumes arranged in a line. One operation allows us to pick any contiguous segment and replace every value in that segment with their average. This operation can be repeated any number of times on any segments.

codeforcescompetitive-programmingdata-structuresgeometrygreedy
CF 1297I - Falling Blocks

We are given a sequence of horizontal segments that arrive one after another on a 1D board of length $d$. Each segment represents a block that falls vertically until it either touches the ground or touches the top of some previously placed block.

codeforcescompetitive-programming*specialdata-structures
CF 1297H - Paint the String

We are given a string and must assign each character to one of two groups, which we can think of as placing each character into either a red bucket or a blue bucket while preserving their original order inside each bucket.

codeforcescompetitive-programming*specialdpstrings
CF 1297G - M-numbers

We are given a target value $m$ and asked to consider all positive integers whose digits multiply exactly to $m$. These integers form an infinite set in general, and we are asked to sort this set in increasing numerical order and return the $k$-th element.

codeforcescompetitive-programming*specialdpmath
CF 1297F - Movie Fan

We are given several movies, each movie has a time window during which it can be watched in the cinema. If a movie is watched inside its window, it is considered “on time”.

codeforcescompetitive-programming*specialdata-structuresgreedyimplementationsortings
CF 1297D - Bonus Distribution

Each employee has a fixed base salary, and we are allowed to distribute an additional integer bonus so that the total bonus across all employees is exactly k. After adding bonuses, each employee’s final salary becomes their original salary plus their assigned bonus.

codeforcescompetitive-programming*specialbinary-searchgreedysortings
CF 1297E - Modernization of Treeland

We are given a tree of cities. From this tree we must choose a subset of cities $S$ such that two conditions hold simultaneously.

codeforcescompetitive-programming*specialdfs-and-similartrees
CF 1297C - Dream Team

We are given an array of integers for each test case, where each value represents the contribution of a developer. We want to pick a subset of indices to form a team, and the value of the team is simply the sum of the chosen elements.

codeforcescompetitive-programming*specialgreedy
CF 1296F - Berland Beauty

We are given a connected network of $n$ stations connected by $n-1$ railway segments, which means the structure is a tree. Each edge in this tree has an unknown integer weight in the range from 1 to $10^6$. We are also given several observations from passengers.

codeforcescompetitive-programmingconstructive-algorithmsdfs-and-similargreedysortingstrees
CF 1296D - Fight with Monsters

We are given a sequence of monsters standing in a fixed order. Each monster has a certain amount of health, and they must be defeated one after another from left to right.

codeforcescompetitive-programminggreedysortings
CF 1296E2 - String Coloring (hard version)

We are given a string and we are allowed to assign a color label to each character position. After coloring, we gain a very specific operation: we may swap two adjacent characters only if their colors are different. Swaps can be repeated arbitrarily many times.

codeforcescompetitive-programmingdata-structuresdp
CF 1296B - Food Buying

We are given an initial amount of money, and we repeatedly perform a very specific type of purchase operation. In each operation, we choose some amount $x$ that we can afford at that moment, spend it, and immediately receive back $lfloor x/10 rfloor$.

codeforcescompetitive-programmingmath
CF 1295E - Permutation Separation

We are given a permutation where every value from 1 to n appears exactly once, but the order is arbitrary. Each position also has a cost associated with its element, and that cost is what we pay whenever we move that element between two groups.

codeforcescompetitive-programmingdata-structuresdivide-and-conquer
CF 1295D - Same GCDs

We are working with a fixed number $a$ and a modulus-like bound $m$. For every integer shift $x$ in the range $[0, m-1]$, we look at the number $a + x$ and compare its greatest common divisor with $m$ against the original value $gcd(a, m)$.

codeforcescompetitive-programmingmathnumber-theory
CF 1294F - Three Paths on a Tree

We are working with a tree, which means there is exactly one simple path between any two vertices. From this tree we must choose three distinct vertices, call them $a$, $b$, and $c$.

codeforcescompetitive-programmingdfs-and-similardpgreedytrees
CF 1293B - JOE is on TV!

The game can be seen as a process where we start with n opponents and repeatedly trigger rounds that remove some of them.

codeforcescompetitive-programmingcombinatoricsgreedymath
CF 1292D - Chaotic V.

The graph in this problem is not given explicitly, but fully determined by the structure of integers. Every positive integer is a node, and each number $x 1$ has a directed edge to $x / f(x)$, where $f(x)$ is the smallest prime factor of $x$.

codeforcescompetitive-programmingdpgraphsgreedymathnumber-theorytrees
CF 1292E - Rin and The Unknown Flower

We are trying to reconstruct a hidden string of length up to 50. The string is guaranteed to use only three symbols: C, H, and O.

codeforcescompetitive-programmingconstructive-algorithmsgreedyinteractivemath
CF 1292C - Xenon's Attack on the Gangs

We are given a tree with $n$ nodes and $n-1$ edges. Each edge is assigned a distinct label from $0$ to $n-2$, so every label appears exactly once. For any pair of nodes $u, v$, we look at the unique path between them and collect all edge labels on that path.

codeforcescompetitive-programmingcombinatoricsdfs-and-similardpgreedytrees
CF 1291B - Array Sharpening

We are given an array of non-negative integers. We are allowed to repeatedly decrease any element by 1 as long as it stays non-negative.

codeforcescompetitive-programminggreedyimplementation
CF 1291A - Even But Not Even

We are given a digit string and we are allowed to delete some of its digits while keeping the remaining digits in the same relative order.

codeforcescompetitive-programminggreedymathstrings
CF 1291F - Coffee Varieties (easy version)

We are given a hidden sequence of café types, where each café produces exactly one integer “coffee variety”. We do not know the sequence itself, but we can probe cafés one by one. The interaction tool behaves like a sliding-window memory system.

codeforcescompetitive-programminggraphsinteractive
CF 1290F - Making Shapes

We are given a small set of integer vectors in the plane. Each vector can be used repeatedly as a step, and we form a closed polygonal walk by starting at the origin, repeatedly adding chosen vectors head-to-tail, and eventually returning to the origin.

codeforcescompetitive-programmingdp
CF 1290A - Mind Control

We are given an array of numbers and a line of people who will remove elements from the array one by one. Each person, when it becomes their turn, sees the current array and takes either the leftmost or rightmost element.

codeforcescompetitive-programmingbrute-forcedata-structuresimplementation
CF 1290E - Cartesian Tree

We are building a sequence one element at a time, where after inserting the first i values, we take the current array and construct its Cartesian tree.

codeforcescompetitive-programmingdata-structures
CF 1290D - Coffee Varieties (hard version)

We are given a hidden array of length $n$, where each position represents a café and each café produces exactly one type of coffee. The value at position $i$ is the coffee variety label $ai$, but we never see it directly.

codeforcescompetitive-programmingconstructive-algorithmsgraphsinteractive
CF 1288E - Messenger Simulator

We are maintaining a dynamic “recent chat list” of friends, represented as a permutation of the numbers from 1 to n. The list is ordered from most recent to least recent interaction.

codeforcescompetitive-programmingdata-structures
CF 1288F - Red-Blue Graph

We are given a bipartite graph where every edge can optionally be assigned one of two colors, red or blue, or left unused. Coloring an edge is not free: red costs r, blue costs b, and leaving it unused costs nothing.

codeforcescompetitive-programmingconstructive-algorithmsflows
CF 1286C2 - Madhouse (Hard version)

A hidden string of length $n$ is fixed before the game starts. The player’s goal is to recover this exact string. Instead of being given it directly, the only way to gain information is by querying substrings of ranges.

codeforcescompetitive-programmingbrute-forceconstructive-algorithmshashinginteractivemath
CF 1286B - Numbers on Tree

We are given a rooted tree where every node has a hidden integer value. What we do know is the tree structure and, for each node, a number ci.

codeforcescompetitive-programmingconstructive-algorithmsdata-structuresdfs-and-similargraphsgreedytrees
CF 1286C1 - Madhouse (Easy version)

We are dealing with a hidden string of length $n$, made of lowercase English letters. We cannot see the string directly. Instead, we can query any segment $s[l..

codeforcescompetitive-programmingbrute-forceconstructive-algorithmsinteractivemath
CF 1285D - Dr. Evil Underscores

We are given a list of integers, and we are allowed to choose a single integer $X$. Once $X$ is fixed, every array value is transformed by XOR with $X$, and we care about the largest transformed value. The goal is to pick $X$ so that this maximum value is as small as possible.

codeforcescompetitive-programmingbitmasksbrute-forcedfs-and-similardivide-and-conquerdpgreedystringstrees
CF 1285E - Delete a Segment

We are given several intervals on a number line. Each interval represents a continuous segment of covered points. If multiple intervals overlap or touch, their combined covered region merges into a single continuous piece when we take the union.

codeforcescompetitive-programmingbrute-forceconstructive-algorithmsdata-structuresdpgraphssortingstreestwo-pointers
CF 1285F - Classical?

We are given a list of positive integers and we want to choose two different positions in the list such that the least common multiple of the chosen values is as large as possible.

codeforcescompetitive-programmingbinary-searchcombinatoricsnumber-theory
CF 1284G - Seollal

The task is to take a small grid with blocked and open cells and construct a special “maze representation” on a refined grid. Each input cell becomes a node in a graph, and adjacency exists between orthogonally neighboring open cells.

codeforcescompetitive-programminggraphs