brain
tamnd's digital brain — notes, problems, research
41641 notes
We are given an array of positive integers, and many queries. Each query selects a contiguous segment of this array. For that segment, the two players effectively play a game on a chosen subsequence of its elements.
There are two types of cows and two ways they can choose to receive grass. Each cow can choose option A or option B. If k cows choose A, then every A-cow receives x/k units of grass. If a cow chooses B, it simply receives y units.
We are given a row of students, each with a fixed score. A teacher repeatedly selects a student and checks whether that student can be removed from the row.
We are given a rooted tree with $n$ nodes, each node carrying a positive weight $vi$. Two players, Dawn and Tsuki, alternately “claim” nodes until one of them cannot make a legal move, at which moment the game immediately ends and both are considered to meet.
We start with an initial value $v$, and we are given $n$ operations. Each operation is either an addition by some real number $xi$, or a multiplication by some factor $xi$. We are allowed to reorder these operations arbitrarily.
We are given a strip divided into n consecutive segments. Each segment already has an initial color, but that starting configuration does not really matter for the final goal except as a source of structure.
We start with an $n times n$ grid where every cell initially contains the value 1. Two arrays $a1 dots an$ and $b1 dots bn$ control a random process that repeatedly deletes either a row or a column until all rows and columns are gone.
We are given a tree where every node initially carries one of three colors: red, green, or blue. We are allowed to recolor any subset of nodes into white, and white nodes are treated as “removed” in the sense that they no longer participate as red, green, or blue.
We are given two rows of balls placed along the boundary of a rectangle. The bottom row contains a fixed permutation of numbers from 1 to n.
Each test describes a simple comparison game between three values: Alice’s strength a, Bob’s strength b, and Candy’s strength c. The output is a string chosen by applying a priority rule over these comparisons. The decision process is sequential.
We are given an $n times n$ grid of unit cells. The task is to assign each cell one label from $1$ to $n$, forming exactly $n$ regions, where a region is simply the set of cells with the same label. Regions do not need to be connected.
We are given a circular array of length $n$, where each position holds an integer value representing some bitmask. The array evolves in discrete rounds.
There are $n$ animals placed on distinct positions on an infinite number line. Each animal also has exactly one associated “fan” (we will call them collectors) placed on another set of distinct positions.
We are given several independent rectangles that represent possible shapes of a board. For each board, we need to count how many ways we can place an axis-aligned rectangular “window” inside it such that the window has a fixed area s, and it does not touch any border of…
We are asked to count how many positive integers strictly smaller than a given number n could have appeared on a special pencil during sharpening. The key constraint is that all valid numbers must be prime and must not contain the digit zero.
We are given a rectangular garden with $n$ rows and $m$ columns. Each cell contains an integer describing the type of flower growing there. We observe the garden twice: once before a transformation process and once after it.
We are given an undirected graph with a distinguished starting vertex, which we can think of as vertex 1. Alongside the graph, we are also given a sequence of vertices starting from this root, written as x0 = 1, followed by x1, x2, up to xk.
We are given a binary string of length $N$, where each character describes how the $i$-th item must be paired with values drawn from a fixed set of numbered elements.
We are given a fixed dictionary of words and then a sequence of query strings. For each query, we want to know how many words in the dictionary start with that query as a prefix.
The wall is given as an n by m grid of cells. Each cell is either empty or blocked by a nail. A poster can only be hung on a rectangular region of the wall, and every cell inside that rectangle must be free of nails.
Two players alternate climbing a coconut tree. On the first climb Samuell takes a fixed amount $x$, and on the second climb Lleumas takes $y$.
We are given an undirected weighted graph that models a region. Two special vertices are distinguished: one is the main entrance of a university, and the other is the destination called IC. For every query vertex $x$, we compare two ways of reaching IC.
Each test describes a simple structured battle: there are n waves of enemies, and the i-th wave contains exactly i balloons. Every balloon in a wave has the same power level k, and the cost of destroying a single balloon is i raised to the power k.
The task “Song” is essentially about reconstructing or evaluating a sequence derived from a structured description of a song.
We are given a collection of vectors, each consisting of bits, and we are allowed to choose some of them to form a subset.
Each test case describes the state of a single 7-segment LED digit display, but the display is imperfect and ambiguous.
We are simulating a repeating deck of cards used by Bob in a fight against a monster with health $h$. Each card either increases Bob’s power additively, multiplies it, or deals damage directly. Once the deck is exhausted, it resets and can be reused in the same order again.
We are given a set of points on the surface of a unit sphere in 3D space. Each point is a direction from the origin, so geometrically it can be treated as a unit vector.
We are given a dynamic permutation $P$ of size $K$ and another array $A$. The permutation defines an infinite periodic sequence $P^infty$, formed by repeating $P$ endlessly.
We are given a collection of restaurants, and for each restaurant we can assign it a number of stars from 0 up to 3. Assigning stars has a cost that depends on the restaurant and the chosen number of stars.
We are given a one-dimensional board where each column has a current height. A sequence of operations places pieces that affect contiguous segments of columns.
We are maintaining a long sequence of positions that initially have no restrictions. Over time, the festival organizers place “signs” that enforce height constraints on contiguous ranges.
We are given a tree of stations and a long sequence of operations applied over time. Each operation is either opening a business at a node of the tree or marking a node as sponsored. The key difficulty is that we do not evaluate these operations globally.
We are given a city modeled as an undirected weighted graph where intersections are nodes and roads are edges. Each intersection has a danger value, and each road connects two intersections.
We are given a sequence of daily temperatures and a coat that can be used only in limited stretches. Once you wear it for a number of consecutive days, it becomes dirty and cannot be used again until it is washed.
We are working with a directed graph whose edges are labeled with characters. The task is not to answer reachability in the usual sense, but to discover all pairs of vertices that can be connected by a walk whose sequence of edge labels forms a palindrome.
We are given a small graph with up to 10 vertices, where every ordered pair of vertices has an associated cost for building a directed edge from one to the other.
We are asked to count how many numbers inside a given interval can be expressed in a very specific form: the product of three consecutive integers. Every such number comes from choosing an integer $x$ and forming $x cdot (x+1) cdot (x+2)$.
Each submission in the contest belongs to exactly one contestant, and each contestant has a personal restriction on which verdicts they can possibly receive. For every submission, the system does not produce a deterministic result.
We are given a binary string representing a DNA sequence, where each position is either normal or mutated. A value of 1 indicates a mutation, while 0 indicates a normal gene.
We are given a group of X marathonists who need transportation to a destination. There are N available ride options, and each ride option behaves like a single vehicle that can be used at most once.
We are looking at a building with floors numbered from 1 up to n + 1. Pep lives on the top floor, and he wants to go down using an elevator.
We are given a line of kiosks along a beach avenue, each kiosk offering exactly one drink. A traveler starts at satisfaction value 1 and chooses a single contiguous segment of kiosks to walk through.
We are given a polyline in the plane defined by n points sorted by increasing x-coordinate. The path starts at the first point and proceeds in straight line segments between consecutive points, so the walker moves along a piecewise linear curve.
We are playing a deterministic game on the vertices of a regular n-gon, which is best thought of as positions on a cycle labeled from 0 to n − 1. Your opponent secretly maintains a token on one vertex. You do not know its position, but you interactively influence how it moves.
The problem describes a two-player game played on a binary string. The players alternately transform the string under a fixed rule, and the structure of the string determines whether a player can force a win or avoid losing indefinitely.
We are given two sets of points on an infinite grid. The first set represents positions where cameras can be installed, and the second set represents positions of capybaras that must be observed.
We are given a set of $2n$ students and a list of pairs who cannot be placed in the same study group. The task is to split all students into two groups, each containing exactly $n$ people, so that no forbidden pair ends up inside a single group.
We are given a set of distinct points on a 2D plane, each representing a nail on a wall. Any pair of nails can be connected with a straight string, forming a line segment.
We are given several independent test cases. In each test case there is a set of cards, where each card has two digits written on it. One digit is visible when the card is placed normally, and the other digit appears after the card is flipped over.
We are given a collection of binary strings, all of the same length. Each string is a word in a language, and we are allowed to shorten a word only by deleting characters from its right end.
We are given an $n times n$ grid where every cell contains an integer from $1$ to $k-1$. Two different people extract a score from this same grid using two different aggregation rules.
We are given a row of cells, each containing a lowercase letter. A token starts at the first cell and repeatedly moves according to a deterministic rule.
Let
We are given a railway line with stations numbered from 1 to n. There are m trains. Each train starts at a fixed station li, ends at ri, and has a capacity ci.
We are given a line of $n$ positions. Each position has a fixed weight and an initial color, either black or white. The line is naturally divided into maximal consecutive segments of identical color, which we will call blocks. Time evolves in discrete steps.
We are given a binary string describing a day-by-day plan over $n$ days. On day $i$, the plan prescribes either eating a candy or avoiding it. If the character is 1, the mood increases by $+1$. If it is 0, the mood decreases by $-1$.
We are given a system of $n$ lamps, each currently either on or off, and $m$ switches. Each switch is wired to a subset of lamps. Pressing a switch flips the state of every lamp connected to it.
We are given a fixed sequence of requests, and a small “cache” of size at most $m$, initially empty. As we scan the sequence from left to right, each element we encounter can either already be in the cache or not.
We are given a connected weighted undirected graph representing a city. Some nodes are radiation sources, each source node has a radiation strength that spreads through the graph and decays linearly with shortest-path distance.
We are given a single 9-character string that represents a student ID issued by a university system. The task is to decide whether this ID follows a very specific structural rule. The format is fixed-length and divided into conceptual segments.
We are given a fixed sequence of length n that is already a permutation of the numbers from 1 to n. This means every number appears exactly once, but we do not know their order. For each query, we are asked about a contiguous segment of this array, from index l to r.
We are given a single line describing a battle scenario in a simplified Pokémon-type cycle. The line contains a fixed prefix and then a single Pokémon name among three possibilities: Torterra, Staraptor, or Luxray.
We are given three integers $a$, $b$, and $M$. The task is not to compute a Fibonacci number in the usual sense of “take index and return value”, but instead to evaluate a Fibonacci number whose index is itself a product: we need the value of $f{a cdot b}$, then take it…
The problem describes a grid of size $H times W$, where each cell initially stores two integers $A{0,i,j}$ and $B{0,i,j}$.
Each test case describes a sphere centered at the origin with radius $r$. Three points lie on its surface: your house, the aircraft’s departure point, and its destination.
We are asked to construct two very large positive integers, call them x and y, with a very specific geometric property. The only operation allowed on a pair of integers is to move in the grid by changing one coordinate by plus or minus one, and each such move costs one unit.
A tree is given with $n$ nodes, and every edge starts out colored black. We then perform $n-1$ operations. In the $i$-th operation, a specific edge is recolored from black to red, so the set of black edges gradually shrinks until the tree has no black edges left.
We are given a very small system: three cups with fixed capacities and current amounts of cola. We can move liquid between cups with a simple rule that always pours as much as possible until either the source empties or the destination fills.
We are given a string made of opening and closing brackets. We are allowed to change characters one by one, each change turning a bracket into the opposite type. After performing some number of such changes, we look at every possible non-empty subsequence of the resulting string.
We are given three candidate routes or plans for completing the same task, each associated with a time cost. The goal is simply to choose the fastest option among the three and output its time. Each input consists of exactly three integers.
We are given several points on an infinite grid. Each point represents a pepper placed at a specific coordinate, and each pepper has a fixed type. One type interacts along its column, meaning it “cares” about other peppers sharing the same x-coordinate.
We are given a sequence of days. On each day we choose a nonnegative real number $ri$, interpreted as caloric intake, but it is restricted to lie in a fixed interval $[L, R]$.
We are given three independent events that represent how long Nezha spends causing disturbances in the sea. Each event has a duration measured in hours, and during every hour of disturbance, a fixed number of complaints is generated.
We are given two strings, and we are allowed to build new strings by taking a prefix of the first string and concatenating it with a suffix of the second string.
We are modeling a repeating random process where each “cycle” consists of drawing until we obtain a rare event, then resetting. Each draw has a probability of producing a 6-star result, but this probability is not fixed.
We are given several independent matrices. Each matrix contains a permutation of values, meaning every number from 1 up to n·m appears exactly once.
We are given a simple undirected graph with maximum degree at most three. Initially every vertex is uncolored. Two players interact with this graph in two stages.
We are given a single string of lowercase letters. The task is to look at all ordered pairs of positions where the first position contains the character e, the second position contains the character f, and the e appears earlier in the string than the f.
We are given three independent “moving points”, each controlled by its own polyline path. Each path is a sequence of coordinates, and the corresponding point starts at the first coordinate and moves along straight segments at constant unit speed until it reaches the last…
We are given a directed graph on $n$ labeled cities, but we do not know its edges. Instead, we are told a matrix that describes reachability: for each pair $(i, j)$, we know whether it is possible to travel from $i$ to $j$ using one or more directed roads.
We are working with a simplified analog clock where both the hour hand and minute hand can be controlled independently. The clock uses a 12-hour cycle for hours and a 60-minute cycle for minutes.
We are given a permutation of length n, and we are allowed to apply at most k local operations. Each operation targets a pair of adjacent positions.
We are given a time interval of length $T$, and at every second exactly one sensor must be active. Each sensor produces a value that depends on both the sensor and the time, so activating sensor $i$ at time $j$ contributes $c(i, j)$ to the total score.
We are given a static array of up to a thousand integers, and multiple independent queries. Each query asks for the number of distinct quadruples of indices $(i, j, k, l)$ with strictly increasing order such that the sum of the four corresponding values equals the query target.
We are given a system with two binary pieces of information: whether a box is open or closed, and the actual internal state of a cat inside it. The first value, C, describes observability. If the box is closed, the state of the cat cannot be observed externally.
We are given a string that contains lowercase letters, uppercase letters, digits, and wildcard characters. Each wildcard can be replaced independently by any lowercase letter, uppercase letter, or digit.
We are given an array of length $n$, where every element is one of the values $1, 2, 3$. We are guaranteed that all three values appear at least once somewhere in the array. The array itself is hidden.
We are given several test cases. In each test case there are multiple skewers, and each skewer has a certain number of meat pieces.
We are given a grid where each cell contains an integer value. From the top-left corner we can only move right or down until we reach the bottom-right corner. Any such movement forms a monotone path, and every path collects the values of the cells it passes through.
Codeforces 105986G: 神圣愤怒
The solution depends critically on the two missing elements: the $I$–$U$ characteristic of the bulb (Figure 3) and the circuit configuration (Figure 4).
An atom moves in the laboratory frame with velocity $v$, where
The physical system is the carbon cycle of thermonuclear reactions in a star.
A small heavy ball of mass $m$ enters a hollow smooth spherical shell of radius $R$ and mass $m$.
I cannot write a correct solution to Kvant problem F557 from the text alone, because the problem statement refers to "Figure 3", and the circuit diagram is essential.
Part (a) concerns a light rigid rod of length $l$ hinged at its lower end.
A heavy board of mass $M$ rests horizontally on two thin walled rollers.
We are given up to 20 distinct points on a 2D plane, each point representing a balloon. A single dart is not limited to a segment or ray; it behaves like an infinite straight line. Once a dart is thrown, every balloon lying exactly on that line is popped.
We are given a rooted version tree. Version 1 is the root. Every other version has exactly one parent among earlier versions, and the edge from parent to child carries a character. That character sequence along a root-to-node path defines the “signature string” of a version.