brain

tamnd's digital brain — notes, problems, research

43815 notes

CF 1066A - Vova and Train

The setting is a one-dimensional path from position 1 to position L, where time and position are synchronized so that at minute i, Vova is at coordinate i.

codeforcescompetitive-programmingmath
CF 1068B - LCM

We are given a single integer $b$, and we conceptually iterate over every positive integer $a$. For each $a$, we compute a value derived from the least common multiple of $a$ and $b$, specifically $frac{mathrm{lcm}(a,b)}{a}$.

codeforcescompetitive-programmingmathnumber-theory
CF 1070F - Debate

We are asked to choose a subset of people, each having a weight (influence) and one of four “support types” describing whether they support Alice, Bob, both, or neither.

codeforcescompetitive-programminggreedy
CF 1071E - Rain Protection

We are controlling a rigid but flexible “bar” formed by a rope whose endpoints are constrained to slide along two horizontal segments, one at height zero and one at height $h$.

codeforcescompetitive-programmingbinary-searchgeometry
CF 1073E - Segment Sum

We are asked to consider every integer inside a range $[l, r]$ and filter it by a digit constraint: we only keep numbers that use at most $k$ distinct decimal digits in their usual base-10 representation.

codeforcescompetitive-programmingbitmaskscombinatoricsdpmath
CF 1073C - Vasya and Robot

We are given a fixed sequence of moves for a robot on an infinite grid, starting from the origin. Each character in the sequence moves the robot one step in one of the four cardinal directions.

codeforcescompetitive-programmingbinary-searchtwo-pointers
CF 1075A - The King's Race

We are given an $n times n$ grid. One king starts at the bottom-left corner $(1,1)$ and the other starts at the top-right corner $(n,n)$. A coin is placed at $(x,y)$, and both kings try to reach it as fast as possible.

codeforcescompetitive-programmingimplementationmath
CF 1076E - Vasya and a Tree

We are given a rooted tree where vertex 1 acts as the root, and every vertex initially holds value 0. The tree is static, but we are asked to process a sequence of update operations.

codeforcescompetitive-programmingdata-structurestrees
CF 1076B - Divisor Subtraction

We are given a single large integer and we repeatedly apply a deterministic process that always reduces it. At each step, we inspect the current number, find its smallest prime factor, subtract that factor from the number, and continue until the value becomes zero.

codeforcescompetitive-programmingimplementationmathnumber-theory
CF 1076A - Minimizing the String

We are given a single string made of lowercase letters, and we are allowed to delete at most one character from it. After this optional deletion, we obtain a new string, and among all possible results (including doing nothing), we want the lexicographically smallest one.

codeforcescompetitive-programminggreedystrings
CF 1077F2 - Pictures with Kittens (hard version)

We are given a sequence of pictures arranged in a line, each with a beauty value. We need to choose exactly x of these pictures to repost, but the choice is constrained by a coverage rule: any contiguous block of length at least k must contain at least one chosen picture.

codeforcescompetitive-programmingdata-structuresdp
CF 1077F1 - Pictures with Kittens (easy version)

We are given a line of pictures, each with a value representing its beauty. The task is to select exactly a fixed number of pictures, and among all such selections we want the maximum total beauty.

codeforcescompetitive-programmingdp
CF 1077E - Thematic Contests

We are given a multiset of problems where each problem belongs to a topic. The same topic can appear many times. From this pool, we want to form several contests. Each contest must use only problems from a single topic, so it is homogeneous.

codeforcescompetitive-programminggreedysortings
CF 1077D - Cutting Out

We are given a multiset of integers, and we want to construct a pattern array of fixed length $k$. Once we choose this pattern, we repeatedly try to “extract” it from the original multiset: each extraction consumes one occurrence of every value in the pattern, and after…

codeforcescompetitive-programmingbinary-searchsortings
CF 1077C - Good Array

We are given a list of integers, and we want to identify which positions behave “special” under a deletion operation. For each index, we temporarily remove that element and look at the remaining array.

codeforcescompetitive-programming
CF 1077B - Disturbed People

We are given a row of flats, each either having its light on or off. The configuration is a binary array where 1 means lit and 0 means dark.

codeforcescompetitive-programminggreedy
CF 1077A - Frog Jumping

A frog moves along a number line starting from position zero. Its movement is strictly alternating: it first jumps to the right by a fixed distance a, then to the left by b, then right again by a, and so on.

codeforcescompetitive-programmingmath
CF 1078E - Negative Time Summation

We are given a very unusual computational model: a robot walks on an infinite grid while executing a program, and the grid itself can be rewritten and even “rewound in time”. Two binary integers are initially written on the grid.

codeforcescompetitive-programmingconstructive-algorithms
CF 1080D - Olya and magical square

We start with a square grid whose side length is a power of two, specifically $2^n times 2^n$. The only allowed operation is to take any existing square of side $a$ and split it into four equal smaller squares of side $a/2$.

codeforcescompetitive-programmingconstructive-algorithmsimplementationmath
CF 1080E - Sonya and Matrix Beauty

We are given a grid of characters. From this grid we may choose any axis-aligned subrectangle, and we are allowed to reorder characters independently inside each row of that chosen subrectangle.

codeforcescompetitive-programmingstrings
CF 1080F - Katya and Segments Sets

We are given several collections of segments, where each collection corresponds to a set index from 1 to n. Inside a single set, there may be many segments, and each segment is a closed interval on the number line. The task revolves around answering queries about a range of sets.

codeforcescompetitive-programmingdata-structuresinteractivesortings
CF 1080A - Petya and Origami

Petya is preparing invitation cards for a party, and each invitation consumes a fixed amount of colored paper sheets. Every invitation requires 2 red sheets, 5 green sheets, and 8 blue sheets.

codeforcescompetitive-programmingmath
CF 1080C - Masha and two friends

We are working on a very large grid, conceptually a chessboard with $n$ rows and $m$ columns. Each cell initially has a color determined by a fixed chessboard pattern, alternating between black and white. Two paint operations are applied on top of this initial pattern.

codeforcescompetitive-programmingimplementation
CF 1080B - Margarite and the best present

We are given a very large infinite sequence where each position has a deterministic value based only on its index. The value alternates sign and grows in magnitude linearly: position 1 contributes −1, position 2 contributes +2, position 3 contributes −3, and so on.

codeforcescompetitive-programmingmath
CF 1081F - Tricky Interactor

We are given a hidden binary array of length $n$, containing only zeros and ones. We are also told how many ones it originally contains, but not their positions. The array is placed in the hands of an interactive judge that mutates it after every query in a very specific way.

codeforcescompetitive-programmingconstructive-algorithmsimplementationinteractive
CF 1081H - Palindromic Magic

We are given two long strings, and from each string we are allowed to pick a single substring that is a palindrome. From the first string we choose one palindromic substring, from the second string we choose another palindromic substring, and we concatenate them in that order.

codeforcescompetitive-programmingdata-structureshashingstrings
CF 1081E - Missing Numbers

We are given only half of a hidden sequence of positive integers, specifically every even-positioned value. The full sequence has even length $n$, and has a very rigid structure: if you look at prefix sums, every prefix sum must be a perfect square.

codeforcescompetitive-programmingbinary-searchconstructive-algorithmsgreedymathnumber-theory
CF 1081G - Mergesort Strikes Back

Stopped thinking

codeforcescompetitive-programmingmathprobabilities
CF 1081A - Definite Game

We are given a single positive integer as the starting value of a number $n$. We are allowed to repeatedly transform this number by choosing an integer $x$ that is strictly smaller than the current value of $n$, with the restriction that $x$ must not divide $n$.

codeforcescompetitive-programmingconstructive-algorithmsmath
CF 1081D - Maximum Distance

We are given a connected weighted undirected graph where edges have costs, and a subset of vertices is marked as special.

codeforcescompetitive-programmingdsugraphsshortest-pathssortings
CF 1081C - Colorful Bricks

We are painting a line of $n$ bricks, each brick choosing one of $m$ available colors. Once the painting is done, we look at the positions where the color changes compared to the previous brick.

codeforcescompetitive-programmingcombinatoricsdpmath
CF 1081B - Farewell Party

We are given a group of n people. Each person wore exactly one hat, and every hat belongs to one of n possible types labeled from 1 to n. Multiple people may share the same hat type, and some hat types may not be used at all.

codeforcescompetitive-programmingconstructive-algorithmsimplementation
CF 1082G - Petya and Graph

We are given a simple undirected graph where each vertex carries a cost and each edge carries a reward. We are allowed to pick any subset of vertices, and then from the edges we may only keep those whose endpoints are both selected.

codeforcescompetitive-programmingflowsgraphs
CF 1082E - Increasing Frequency

We are given an array where each position stores an integer value. We are allowed to pick exactly one continuous segment and add the same integer value to every element inside that segment. This value can be positive, negative, or zero.

codeforcescompetitive-programmingbinary-searchdpgreedy
CF 1082F - Speed Dial

We are given a set of phone numbers, each associated with how frequently Polycarp dials it. Every time a number is dialed, he must physically press digits, but the phone allows up to $k$ special speed dial buttons.

codeforcescompetitive-programmingdpstringstrees
CF 1082D - Maximum Diameter Graph

We are given a set of vertices, and for each vertex we are told how many edges it is allowed to participate in at most. Our task is to actually construct a simple undirected connected graph that respects these degree limits and, among all such graphs, maximizes the diameter.

codeforcescompetitive-programmingconstructive-algorithmsgraphsimplementation
CF 1082A - Vasya and Book

We are given a book with pages arranged in a line from 1 to n. Vasya starts on page x and wants to reach page y. Each button press moves his current page either forward by d pages or backward by d pages, but any move that would leave the interval [1, n] is not allowed.

codeforcescompetitive-programmingimplementationmath
CF 1082B - Vova and Trophies

We are given a binary string of length $n$, where each position represents a trophy placed in a row. Each trophy is either golden or silver. The only thing that matters is the structure of contiguous golden segments.

codeforcescompetitive-programminggreedy
CF 1082C - Multi-Subject Competition

Each candidate belongs to exactly one subject and brings a numeric contribution, which may be positive or negative.

codeforcescompetitive-programminggreedysortings
CF 1083F - The Fair Nut and Amusing Xor

Two arrays evolve over time, and after each update we must determine how many operations are needed to make them identical under a very specific operation model.

codeforcescompetitive-programmingdata-structures
CF 1083E - The Fair Nut and Rectangles

Each rectangle is anchored at the origin and stretches to a point $(xi, yi)$, so geometrically every rectangle is a lower-left aligned axis-parallel rectangle.

codeforcescompetitive-programmingdata-structuresdpgeometry
CF 1083D - The Fair Nut's getting crazy

We are given an array and we want to count how many ordered pairs of subarrays behave in a very specific geometric way on the index line. Each subarray is a contiguous segment on indices. We choose two such segments. They must overlap, so their intersection is not empty.

codeforcescompetitive-programmingdata-structuresimplementation
CF 1083B - The Fair Nut and Strings

We are working with binary strings of fixed length, where each string consists only of characters a and b. The Fair Nut originally had a multiset of k such strings, each of length n, but the exact strings are lost.

codeforcescompetitive-programminggreedystrings
CF 1083C - Max Mex

We are given a rooted tree on $n$ nodes. Each node stores a distinct value from $0$ to $n-1$, so the values form a permutation. Alongside this, the tree structure is fixed, but the values can change over time through swap operations. Two operations are supported.

codeforcescompetitive-programmingdata-structurestrees
CF 1083A - The Fair Nut and the Best Path

We are given a tree where each node represents a city. Every city contains a fuel station, and each station allows us to obtain some fixed amount of fuel $wi$. Traveling between two cities connected by a road consumes fuel equal to that road’s length.

codeforcescompetitive-programmingdata-structuresdptrees
CF 1084C - The Fair Nut and String

We are given a string made of lowercase letters and we are interested only in the positions of two characters, namely 'a' and 'b'. From this string, we want to count how many strictly increasing sequences of indices we can form such that every chosen index points to an 'a'.

codeforcescompetitive-programmingcombinatoricsdpimplementation
CF 1084A - The Fair Nut and Elevator

The problem describes a single elevator in a building where each floor has a known number of residents. Each resident makes exactly two trips per day, one going down to the first floor and one returning back to their own floor.

codeforcescompetitive-programmingbrute-forceimplementation
CF 1084B - Kvass and the Fair Nut

We are given several kegs of kvass, each containing some initial amount. In one operation, we can reduce any single keg by exactly one liter, and each such operation contributes one liter toward a total amount we want to “pour out”.

codeforcescompetitive-programminggreedyimplementation
CF 1085G - Beautiful Matrix

We are given an $n times n$ matrix where every entry is an integer from $1$ to $n$. The matrix is constrained in two ways: each row contains no repeated values, and vertically adjacent cells in the same column are also distinct.

codeforcescompetitive-programmingcombinatoricsdata-structuresdp
CF 1085E - Vasya and Templates

We are given three strings over an alphabet of size $k$. Think of the letters $a, b, c, dots$ but only the first $k$ of them are used.

codeforcescompetitive-programminggreedyimplementationstrings
CF 1085B - Div Times Mod

We are given two integers, a target value built from a multiplication expression, and a fixed base parameter that controls how we split any positive integer into a quotient and a remainder.

codeforcescompetitive-programmingmath
CF 1085C - Connect Three

We are given three distinct cells on an infinite grid, each representing a square plot of land. Initially everything is blocked, and we are allowed to “clear” any cells we want.

codeforcescompetitive-programmingimplementationmath
CF 1086F - Forest Fires

We are given a set of initial fire sources placed on an infinite integer grid. Fire spreads every second in all eight directions, so each burning cell ignites every neighboring cell that shares a side or a corner.

codeforcescompetitive-programmingmath
CF 1088E - Ehab and a component choosing problem

We are given a weighted tree, where every node carries an integer value that can be positive, negative, or zero. The task is to select some nodes and partition the selected nodes into several connected components.

codeforcescompetitive-programmingdpgreedymathtrees
CF 1088D - Ehab and another another xor problem

We are trying to determine two hidden integers, a and b, each less than $2^{30}$. We cannot see them directly. Instead, we are allowed to query pairs $(c, d)$, and the judge compares the values $a oplus c$ and $b oplus d$, returning whether the first is greater, equal, or…

codeforcescompetitive-programmingbitmasksconstructive-algorithmsimplementationinteractive
CF 1088F - Ehab and a weird weight formula

We are given a set of nodes, each carrying a fixed positive weight. The task is not to compute anything on a given tree, but to design a tree structure on these nodes so that a certain cost expression becomes as small as possible. Two constraints shape the construction.

codeforcescompetitive-programmingdata-structurestrees
CF 1088A - Ehab and another construction problem

We are given a small integer $x$, and we need to construct two integers $a$ and $b$, both constrained to lie between 1 and $x$, such that a few arithmetic conditions hold simultaneously. First, $b$ must divide $a$, meaning $a$ is an exact multiple of $b$.

codeforcescompetitive-programmingbrute-forceconstructive-algorithms
CF 1088C - Ehab and a 2-operation task

We are given a sequence of integers and allowed to repeatedly apply operations that affect prefixes of the array.

codeforcescompetitive-programmingconstructive-algorithmsgreedymath
CF 1088B - Ehab and subtraction

We are repeatedly performing a global “level reduction” on an array. At each step, we look at all positive values currently present, identify the smallest among them, output that value, and then reduce every positive element by that same amount.

codeforcescompetitive-programmingimplementationsortings
CF 1104A - Splitting into digits

We are given a single integer $n$, and we want to represent it as a sum of positive integers, each between 1 and 9 inclusive.

codeforcescompetitive-programmingconstructive-algorithmsimplementationmath
CF 1104B - Game with string

We are given a single string consisting of lowercase letters. Two players alternate turns, and a move consists of picking a pair of identical characters that sit next to each other in the current string and removing both of them.

codeforcescompetitive-programmingdata-structuresimplementationmath
CF 1160A2 - Collaboration

We are given a base and a collection of job sites on a grid. Each job site describes a task located at a coordinate, with a fixed duration, a required number of workers, and a time window during which the job must finish.

codeforcescompetitive-programming*special
CF 1219G - Harvester

We are given a rectangular grid of values, where each cell represents how many bubbles can be collected from that position. Johnny can activate a harvesting operation at most four times.

codeforcescompetitive-programmingimplementation
CF 1219C - Periodic integer number

We are given two numbers. The first is a fixed block length L. The second is a very large integer A, given as a decimal string so it can have up to 100,000 digits.

codeforcescompetitive-programmingimplementationstrings
CF 1230B - Ania and Minimizing

We are given a very large decimal string representing a number with exactly n digits. We are allowed to change at most k of these digits, one position at a time, replacing a digit with any other digit from 0 to 9.

codeforcescompetitive-programminggreedyimplementation
CF 1230A - Dawid and Bags of Candies

We are given four separate bags, each containing some number of candies. Each bag is indivisible and must be given entirely to exactly one of two friends.

codeforcescompetitive-programmingbrute-forceimplementation
CF 1231C - Increasing Matrix

We are given a rectangular grid of integers. Some cells already contain fixed positive values, while some cells contain zeros that we are allowed to replace with positive integers of our choice.

codeforcescompetitive-programminggreedy
CF 1231E - Middle-Out

We are given two strings of equal length. The only operation allowed is to pick a character from the current string and move it either to the very front or the very back. Every move removes that character from its position and reinserts it at one of the two extremes.

codeforcescompetitive-programmingconstructive-algorithmsgreedystrings
CF 1240F - Football

We are given a set of teams and a list of potential matches between pairs of teams. Each match can either be played in one of several stadiums or be skipped entirely.

codeforcescompetitive-programminggraphs
CF 1246F - Cursor Distance

We are given a string of lowercase letters, where each position acts like a “tile” labeled by a character. A cursor sits on one of these positions, and we are allowed to move it using a special jump operation: pick a character and a direction, and the cursor teleports to…

codeforcescompetitive-programming
CF 1261F - Xor-Set

We are given two very large sets of integers, but they are not listed explicitly. Instead, each set is described as a union of intervals.

codeforcescompetitive-programmingbitmasksdivide-and-conquermath
CF 1341B - Nastya and Door

We are given an array of mountain heights. A “peak” is an index strictly inside a segment where the height is larger than both immediate neighbors, meaning it forms a local maximum. We are also given a fixed window length $k$, and we slide this window across the array.

codeforcescompetitive-programminggreedyimplementation
CF 1341A - Nastya and Rice

We are given several independent scenarios about a bag of rice grains. In each scenario, there are two layers of uncertainty: the weight of each individual grain and the total weight of all grains together.

codeforcescompetitive-programmingmath
CF 1600F - Party Organization

We are given a simple undirected graph where people are vertices and friendships are edges. A valid party is a selection of exactly five distinct vertices such that the induced subgraph on these five vertices is either completely empty of edges or completely full, meaning it…

codeforcescompetitive-programmingbrute-forcemathprobabilities
CF 1600J - Robot Factory

The grid describes a rectangular factory floor where each cell is a tile that may have walls on some of its four sides. Each tile contains a number from 0 to 15, and this number encodes its walls using four bits.

codeforcescompetitive-programmingbitmasksdfs-and-similar
CF 1600E - Array Game

We are given an array of numbers laid out in a line. Two players alternate turns, starting with Alice. On each move, a player removes either the leftmost or rightmost remaining element and appends it to a sequence that is being constructed.

codeforcescompetitive-programminggamesgreedytwo-pointers
CF 2013E - Prefix GCD

We are given a list of positive integers, and we are allowed to permute them in any order before processing. After choosing an order, we build prefix GCDs: the first value is just the first element, the second is the gcd of the first two elements, and so on until the full array.

codeforcescompetitive-programmingbrute-forcedpgreedymathnumber-theory
CF 2013D - Minimize the Difference

We are given a sequence of numbers arranged in a line. In one move, we are allowed to take one unit from some position and push it to the next position on the right. This means mass can only flow to the right, never backwards, and every move preserves the total sum of the array.

codeforcescompetitive-programmingbinary-searchgreedy
CF 1830F - The Third Grace

We are given a line of positions from 1 to m. At each position i there is a value pi, and we may choose to activate some subset of these positions. We are also given n intervals on the same line. For each interval [l, r], we look at the activated positions inside it.

codeforcescompetitive-programmingdata-structuresdp
CF 1830E - Bully Sort

We are given a permutation of size $n$, and we repeatedly apply a very specific “bullying” operation to measure how far the permutation is from being sorted. At any moment, we look at all indices where the value is not already correct.

codeforcescompetitive-programmingdata-structuresmath
CF 1830D - Mex Tree

Each test case gives a tree, and we must assign every vertex a label of either 0 or 1. Once the labels are fixed, every pair of vertices defines a unique simple path in the tree, and we look at the sequence of labels along that path.

codeforcescompetitive-programmingbrute-forcedptrees
CF 1830B - The BOSS Can Count Pairs

We are given two arrays of equal length, and we need to count how many index pairs behave in a very specific “cross condition”.

codeforcescompetitive-programmingbrute-forcemath
CF 1830A - Copil Copac Draws Trees

We are given a tree described by an ordered list of edges. The edges are not just connectivity information, their order matters because the drawing process scans them sequentially again and again. The process starts with only vertex 1 being considered “drawn”.

codeforcescompetitive-programmingdfs-and-similardpgraphstrees
CF 1830C - Hyperregular Bracket Strings

Working

codeforcescompetitive-programmingcombinatoricsgreedyhashingmathnumber-theorysortings
CF 1817F - Entangled Substrings

We are given a single string and we are asked to count how many ordered pairs of non-empty substrings $(a, b)$ satisfy a very rigid structural property: every occurrence of $a$ inside the string must always be followed by the same fixed middle string $c$ and then $b$, and…

codeforcescompetitive-programmingstring-suffix-structuresstrings
CF 1817B - Fish Graph

We are given an undirected simple graph and asked whether we can select a subset of its edges that forms a very specific structure called a Fish Graph. The target structure consists of two parts. First, there must be a simple cycle.

codeforcescompetitive-programmingbrute-forceconstructive-algorithmsdfs-and-similargraphs
CF 1817A - Almost Increasing Subsequence

We are working with an array where we need to answer many independent range queries. Each query gives a segment of the array, and for that segment we want the maximum possible length of a subsequence that avoids a very specific forbidden pattern: three chosen elements that…

codeforcescompetitive-programmingbinary-searchdata-structuresgreedy
CF 1817E - Half-sum

We start with a multiset of real values, initially all integers. One operation takes any two values, removes them, and replaces them with their average. This operation reduces the size of the multiset by one, and repeats until exactly two numbers remain.

codeforcescompetitive-programmingbrute-forcedivide-and-conquergreedy
CF 1808E2 - Minibuses on Venus (medium version)

We are counting sequences of length n, where each position holds a digit in base k. So each ticket is just an array of length n with values from 0 to k-1.

codeforcescompetitive-programmingcombinatoricsdivide-and-conquerdpmatrices
CF 1808E1 - Minibuses on Venus (easy version)

We are counting digit sequences of fixed length in base $k$. Each ticket is just an array of $n$ numbers, each between $0$ and $k-1$. A ticket is considered valid if we can pick one position $i$ such that the digit at $i$ is equal to the sum of all other digits, taken modulo $k$.

codeforcescompetitive-programmingcombinatoricsdivide-and-conquerdp
CF 1808C - Unlucky Numbers

We are given multiple independent queries. Each query describes a contiguous range of integers from $l$ to $r$, and each integer in that range represents a starship identifier.

codeforcescompetitive-programmingbrute-forcedpgreedyimplementation
CF 1808A - Lucky Numbers

We are given multiple queries. Each query describes a range of integers from $l$ to $r$, and each integer represents a candidate “starship number”.

codeforcescompetitive-programmingbrute-forceimplementation
CF 1804H - Code Lock

We are given a circular dial with $k$ positions. Each position is labeled with a distinct letter from the first $k$ letters of the alphabet. We are allowed to permute which letter sits at which position before starting.

codeforcescompetitive-programmingbitmasksdp
CF 1804F - Approximate Diameter

We are given a connected, undirected graph with unit-length edges. The key quantity of interest is the graph diameter, which is the largest shortest-path distance between any pair of vertices.

codeforcescompetitive-programmingbinary-searchdivide-and-conquergraphsshortest-paths
CF 1804E - Routing

We are given an undirected, connected graph with up to 20 vertices. Each vertex represents a server, and edges represent direct bidirectional communication links. For every server $u$, we must choose exactly one adjacent vertex $a(u)$.

codeforcescompetitive-programmingbitmasksbrute-forcedfs-and-similardpgraphs
CF 1773L - Lisa's Sequences

We are given a sequence of integers and a fixed length $k$. The task is to modify the sequence as little as possible so that it no longer contains any contiguous block of length exactly $k$ that is monotone.

codeforcescompetitive-programmingdp
CF 1773J - Jumbled Trees

Each edge in a connected undirected graph carries a value that starts at zero. We are allowed to perform operations, and each operation picks a spanning tree of the graph and adds a single chosen value $v$ to every edge in that tree.

codeforcescompetitive-programmingconstructive-algorithmsmath
CF 1773F - Football

We are given aggregated statistics for a football team over a sequence of matches. Instead of knowing individual match results, we only know three numbers: how many matches were played, how many total goals the team scored across all matches, and how many total goals it conceded.

codeforcescompetitive-programmingconstructive-algorithms
CF 1773I - Interactive Factorial Guessing

We are interacting with a hidden integer $n$, but we are not allowed to see it directly. Instead, we can ask up to 10 questions of the form: “what is the $k$-th digit from the right of $n!$ in decimal representation?”.

codeforcescompetitive-programmingbrute-forcegamesimplementationinteractive
CF 1773H - Hot and Cold

We are playing a coordinate guessing game on a large integer grid. There is a hidden target point somewhere in the square from $(0,0)$ to $(10^6,10^6)$.

codeforcescompetitive-programmingbinary-searchinteractive