brain
tamnd's digital brain — notes, problems, research
41650 notes
We are working in a very unusual computational model: instead of directly manipulating variables, we interact with an array of hidden memory cells. Only two of them initially contain unknown values, while all others are initialized to one.
We start with a tree of subway stations. Every station is a node, and every tunnel is an edge, so there is exactly one simple path between any two stations.
We are given a single large integer $n$, and we want to split it into two non-negative integers $a$ and $b$ such that their sum stays exactly $n$.
We are given several guests, and each guest has a personal requirement about how they sit in a circular arrangement.
The matrix in this problem is not given explicitly. Instead, every cell is formed by multiplying an element from array a with an element from array b. This creates a grid where each row is a scaled version of b, and each column is a scaled version of a.
We are given a multiset of digit cards, each card containing a single character from 0 to 9. From these cards, we want to assemble as many valid phone numbers as possible.
We are given a tree that is known to be a perfect $k$-ary tree, meaning it has a root, every internal node has exactly $k$ children, and all leaves are at the same depth.
We are given two different spanning trees over the same set of cities. Each tree represents how one candidate organizes the country, with a chosen root city acting as their capital.
We are given a collection of time intervals, each representing a TV show that occupies a continuous range of minutes. The key constraint is that a single TV cannot be used to watch two shows whose intervals overlap in time.
We are given several vertical stacks of blocks placed side by side. Each position $i$ has a stack of height $ai$. From above, the camera only cares whether a position is occupied or empty, so every column contributes exactly one visible cell as long as it has at least one block.
We are asked to count how many subsequences of a given array are “valid” under a position-based divisibility rule.
We are given a collection of coin denominations that includes every integer value from 1 up to n, and we are allowed to use any number of coins of any of these values.
We are given a directed acyclic graph of cities connected by one-way roads. From the constraints, the graph has no directed cycles, so it behaves like a partial order: some cities are comparable through reachability, and others are incomparable.
We are given a single integer as a starting point, and we are allowed to transform it using two operations. One operation multiplies the current number by any positive integer we choose, effectively letting us inflate the number arbitrarily.
The company hierarchy forms a rooted tree where employee 1 is the root, and every other employee has exactly one direct boss. This defines a parent relationship and also induces depths from the root, where depth is the number of edges from employee 1.
We are given a set of integers from the range of absolute values 2 up to n, and each number also has its negative counterpart available. Think of every integer i in this range as a node in a graph, including both i and -i.
We are given a binary array where each position has a value of either zero or one. We repeatedly remove elements from a chosen segment, and every time we remove an element, two things happen: we gain its value immediately, and all remaining elements in that segment get…
We are given a strictly increasing array of integers, all between 1 and 1000. Someone is allowed to erase exactly one contiguous block of elements, leaving a gap in the sequence. The remaining elements stay in their original positions.
We are given a single string and we want to decompose it into a sequence of progressively shorter substrings, where each substring in the sequence must appear inside the previous one.
We are simulating a deterministic passing process on a circular arrangement of $n$ children. A box starts at position $l$ and is passed clockwise.
The maze is an $n times n$ grid where each cell can either be empty or contain a fixed type of mirror that behaves like a 45-degree reflector. A laser starts from each column on the southern boundary and travels northward into the grid.
We are interacting with an unknown assignment of colors to points, where the opponent can choose each point’s color after seeing where we place it. We must output a sequence of distinct integer-coordinate points.
We are given a multiset of lowercase letters. We are allowed to rearrange these letters into any order we want, forming a new string of the same length. For any resulting string, we look at every contiguous substring and check whether it is a palindrome.
The task places us on a grid maze where each cell is either open or blocked. We start from a given cell and can move in the four cardinal directions as long as we stay inside the grid and avoid obstacles.
We are given three positive integers representing the current lengths of three sticks. In one move, we are allowed to pick exactly one stick and increase its length by one unit.
The equation links a number a with a variable x using two operations: subtraction and bitwise XOR. For each given value of a, we are asked to count how many non-negative integers x satisfy the identity a - (a XOR x) - x = 0. The input consists of several independent values of a.
We are given a rooted tree with vertex 1 as the root, and every vertex except the root has exactly one parent defined by the input. Some vertices are leaves in the usual sense of the tree structure.
We are working with a family of binary strings built in the same recursive way as Fibonacci numbers, except instead of addition we concatenate strings.
We are given strings of length n over an alphabet of size Instead of tracking how a single string evolves, the real question is to understand which positions in the string are fundamentally indistinguishable under repeated application of these operations.
We are given an $N times N$ grid where every cell contains a unique number from $1$ to $N^2$. These numbers define a forced visiting order: we must start at the cell containing 1, then eventually reach the cell containing 2, then 3, and continue in increasing order until $N^2$.
We are given a simple undirected graph with a fixed number of vertices and edges. The graph has no self-loops and no duplicate edges.
Vasya has a fixed amount of money and wants to maximize how many chocolate bars he ends up with under a repeating promotion. Every bar has a fixed price, so his initial purchasing power is simply how many bars he can buy directly.
We are given a collection of vertical towers, each represented by a positive integer height. In one operation we choose a target height $H$, and then every tower that is taller than $H$ is cut down to exactly $H$, while shorter towers remain unchanged.
We are given a set of points in the first quadrant of the grid, and Maksim starts at the origin. In one move he can step to any of the four neighboring lattice points, so every move costs one unit of Manhattan distance. The key restriction is not geometric but structural.
We are given a one-dimensional house represented as a binary array. Some positions contain heaters, marked with 1, while empty positions are 0. Every heater, if activated, warms a continuous interval around its position.
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.
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}$.
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.
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$.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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…
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.
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.
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.
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.
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$.
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.
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.
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.
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.
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.
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.
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.
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.
Stopped thinking
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$.
We are given a connected weighted undirected graph where edges have costs, and a subset of vertices is marked as special.
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.
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.
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.
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.
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.
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.
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.
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.
Each candidate belongs to exactly one subject and brings a numeric contribution, which may be positive or negative.
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.
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.
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.
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.
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.
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.
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'.
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.
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”.
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.
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.
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.
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.
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.
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.
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…
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.
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$.
We are given a sequence of integers and allowed to repeatedly apply operations that affect prefixes of the array.
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.
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.
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.
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.
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.
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.
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.