brain
tamnd's digital brain — notes, problems, research
43815 notes
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 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 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 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.
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.
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.
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.
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.
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…
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.
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.
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.
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…
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.
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.
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.
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.
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.
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.
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.
We are given two arrays of equal length, and we need to count how many index pairs behave in a very specific “cross condition”.
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”.
Working
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…
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.
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…
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.
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.
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$.
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.
We are given multiple queries. Each query describes a range of integers from $l$ to $r$, and each integer represents a candidate “starship number”.
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.
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.
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)$.
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.
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.
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.
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?”.
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)$.