brain
tamnd's digital brain — notes, problems, research
41641 notes
We are given an array of integers. From this array, we conceptually form all pairwise differences between every ordered pair of distinct indices.
We are given a square grid of size $n times n$ and a multiset of exactly $k$ ones and $n^2 - k$ zeros. The task is to place all values into the grid. Once the grid is built, we read every row as a binary string and every column as a binary string.
We are maintaining a vertical structure of layers indexed from 0 at the top down to n at the bottom. Some layers may contain a “vine”, and each vine has a current integer length.
We are given a set of points inside an $n times n$ grid, and we need to connect all of them using a very unusual construction process that produces axis-aligned roads. Every road starts from the outer boundary of the grid and is drawn straight inward along a grid line.
We are given an undirected tree and a target permutation of its nodes. The goal is to transform the tree, through a special repeated “shuffle” operation, into a final rooted tree that is a simple path and whose depth-first traversal from the root visits nodes exactly in…
We are given an array $a$ of length $n$, but it is not independent. There is another hidden array $b$ of the same length, and every value of $a$ is defined as a sum over certain multiples in $b$.
Let
We are asked to construct an $n times n$ binary grid containing exactly $k$ ones and the remaining cells zeros. The grid is judged by a quantity called Super Rank, which counts how many distinct row strings and column strings appear in the final matrix when you read rows left…
We are given two strings of equal length, and we want to transform the first string into the second using range operations.
We are given a circle of n red pandas, numbered in clockwise order. Some pairs of pandas are already connected by non-crossing chords.
We are given two strings of equal length, and we are allowed to modify the first string using operations that act on contiguous segments. Each operation chooses a segment and applies one of two fixed transformations to every character in that segment.
We are given an unrooted tree on $n$ nodes and a target permutation of its nodes. The final goal is to transform the tree, through a sequence of global “re-rooting shuffles”, into a rooted line-shaped tree such that a DFS starting from the root visits nodes exactly in the…
We are given a circle of pancake stores. Each store holds some number of pancakes, and all stores are arranged in a cycle so that moving past the last store wraps back to the first. Two players interact with this circle.
We are given several test cases. In each test case, there are $n$ red pandas arranged in a circle and $k$ initial pairs of pandas already connected by non-intersecting chords.
We are given a permutation of length $n$, meaning every value from $1$ to $n$ appears exactly once in the array. Each index $i$ has a value $ai$, and we can think of the permutation as defining a one-to-one mapping between positions and values.
We are given an array where every element is either 0, 1, or 2. We are allowed to independently flip the sign of any elements. After choosing signs, we want to know whether it is possible to make the total sum of the array equal to zero.
The grid can be seen as a board of binary tiles. Each cell contains either a 0 or a 1, and we are allowed to flip a cell, turning 0 into 1 or 1 into 0. The goal is to modify the grid so that no two neighboring cells, horizontally or vertically, share the same value.
We are asked to construct an $n times n$ binary grid using exactly $k$ ones and $n^2 - k$ zeros. The only requirement on the grid is structural: when we look at all rows as binary strings and all columns as binary strings, the number of distinct rows plus the number of…
Each potion in this problem can be viewed as a subset of stat types among at most 14 possible stats. Buying a potion gives you all of its covered stats, and because the protagonist is “lucky”, every potion is guaranteed to succeed, so each chosen potion deterministically…
We are maintaining a dynamic set of pawns on a very large chessboard. The board itself is too large to store explicitly, so the only meaningful information is which cells currently contain pawns.
The identity resembles a telescoping sum.
We are given an array of hidden integers. We cannot directly read the values, but we are allowed to query any pair of indices and receive the bitwise XOR of those two elements.
We are given a sequence of grasshoppers positioned along a straight path. Each grasshopper appears at a specific distance from the start, and when the elephant reaches that position, the grasshopper is at some vertical height.
We are given a connected system of planets linked by a tree of portals. Every portal connects two planets and has a cost that is paid whenever Isaac travels through it while his jammer is active.
We are given a sequence of days from 1 to N. On each day, you normally earn a fixed income of a baht value a. However, you are allowed to optionally run special projects, and each project replaces your normal income during its active days.
We are given several animal types, each type having a certain number of animals. On each day, one type is updated by adding or subtracting animals.
We are given a large set of distinct positive integers representing “cuteness levels”. From these numbers, Emma first selects exactly $N$ elements.
We are given a collection of identical “pairs” of chopsticks, where each pair is characterized by a single integer length. From each pair we can treat the two chopsticks as two equal sides of a rectangle.
We are maintaining a dynamic set of points on the plane. Initially we are given a collection of stars, each represented by integer coordinates. After that, we repeatedly add or remove stars.
We are given a list of potential customers, where each customer has a maximum price they are willing to pay for a product. If we set a price $P$, then exactly those customers with $pi ge P$ will buy the product, and each of them contributes $P$ to the revenue.
We are given an array of non-negative integers, where each value represents the height of a mountain. The goal is to reduce every value to zero using as few operations as possible. Two operations are available, and both can be applied to any chosen subset of indices.
The problem concerns a regular tetrahedron with vertices $A,B,C,D$ and circumcenter $O$.
The task is to compute the earliest possible arrival time at a destination node in a graph where each edge behaves like a traffic-controlled corridor.
We are given a connected undirected graph where nodes represent power plants and edges represent possible transmission routes. Each route has a cost that changes over time according to a quadratic function in time $t$, specifically $a t^2 + b t + c$.
We are given a sequence of points on a number line that must be visited in a fixed order. We start at position 0. At each step we move to the next required position in the list, but we are allowed to choose between two movement modes.
We are choosing a set of $M$ distinct integer positions from the range $[1, N]$. Each chosen position contains a tree of fixed height $H$.
We are given a rectangular 3D box aligned with the coordinate axes, stretching from the origin to $(x, y, z)$. Inside this box, there is already one spherical apple placed somewhere in space. Its center is given as $(tx, ty, tz)$, and it has radius $r$.
We are given a circular route with $n$ cycling stations. Each station has two values: the amount of energy you gain when stopping there, and the amount of energy required to travel from it to the next station in the cycle. A cyclist starts at a chosen station with zero energy.
We are given a hidden permutation $p$ of length $n$, where $n equiv 2 pmod 4$. We never see the permutation directly. Instead, we can query any set of exactly $n/2$ distinct indices, and the judge returns the median value among the corresponding $p$-values.
We are given a circular array of constraints, and we want to construct another array of nonnegative integers that satisfies them while minimizing the total sum.
We are given a row of monsters, each with a positive health value. A spell is an operation where we choose a number x, then scan monsters from left to right. The first monster whose current health is at least x gets reduced by x, and the spell stops immediately.
We are given an array of integers. The goal is to repeatedly apply an operation so that, at the end, every element in the array is non-positive. One operation works like this. We pick an index $i$.
We start with a multiset containing the numbers from 1 to n. Each operation picks two currently present values x and y, removes both, and inserts their difference x − y. After exactly n − 1 such operations, only one number remains.
The condition mixes side lengths and tangents of angles.
We are given a grid of upper bounds, and we consider all integer grids of the same size where each cell is chosen independently within its allowed range. For each such choice of grid values, we compute a score formed from row sums and column sums.
We are given a one-dimensional universe made of segments arranged in a line. Each segment has a value, initially either +1 or -1 depending on whether it lies in the left half or the right half of the array.
We are simulating a character that moves strictly from left to right on an infinite grid. Time advances in discrete steps, and at every step the x-coordinate increases by one, while the y-coordinate can change by at most one unit up or down.
Let
We are given a tree with $n$ nodes. Each of $m$ colors corresponds to a fixed simple path in this tree, defined by two endpoints $si$ and $ti$. Think of each color as a group of tokens that would occupy every node on that path when active.
We start with a single integer value and process a sequence of operations. Each element in the permutation gives us a binary choice: either we add that number to the current value, or we flip a single bit of the current value using XOR with a power of two determined by the…
Jason starts from an empty text and wants to end up with a text consisting of the string "orz" repeated at least $N$ times.
We are given a fixed external database that can be thought of as a long ordered list of anime titles, each sitting on a specific line number starting from 1.
We are given an array and three distinguished values, $X$, $Y$, and $K$, with the ordering $Y < K < X$. For each test case, we need to count subarrays where two extremal conditions hold simultaneously: within the subarray, the maximum value must be exactly $X$, the minimum…
We are given a path graph with nodes numbered from 1 to n, where each node is connected to its immediate neighbors. Then each node i is independently kept with probability 1/i and removed with probability 1 − 1/i.
We are building a text consisting of repeated copies of the string “orz”. The goal is to produce at least $N$ copies of this string in minimum time. At any moment, Jason has a current amount of text, and he can perform three actions.
We are given a fixed external text file that lists anime titles, one per line. Each title is unique and appears exactly once in that file.
We are given a path graph with nodes numbered from 1 to n, where each node i is independently kept with probability 1/i and removed otherwise.
We are given an array and three special values, with a strict ordering $Y < K < X$. For each test case, the task is to count how many contiguous subarrays satisfy three simultaneous conditions: the maximum element in the subarray is exactly $X$, the minimum element is exactly…
We are given a binary grid and we want to travel from the top-left cell to the bottom-right cell, only moving right or down. The restriction is that every visited cell must contain a 1.
We are given an array of integers. One operation is allowed: pick any two elements, remove both, compute their bitwise XOR, and insert that result back into the array. This changes the array size by exactly minus one, since two elements are replaced by one.
We are given an array, and each query asks about all ordered pairs of indices inside a segment. For a query segment $[l, r]$, we take every pair $(i, j)$ in that range, compute $ai + aj$, and then XOR all of those results together.
We are given the numbers from 1 to 2n, and we must split them into two ordered lists a and b, each of length n, using every number exactly once.
We are given a rectangular grid where each cell is one of three types. Some cells are valid high ground positions where we can place a unit, some are low ground cells where enemies stand, and some cells are blocked and irrelevant for placement.
The problem asks for an upper bound on the number of segments of maximal length among $n$ points in the plane.
We are given a tree with up to one million nodes. A token starts on some node, and two players alternately move it.
We are given a single number written in hexadecimal, using digits 0 to 9 and letters A, b, C, d, E, F. The task is to modify this string into a strobogrammatic number, meaning that if we rotate the representation by 180 degrees, it should look identical again.
We are given a line of integers. In one move we pick two neighboring positions and transfer any amount of value between them: we add some integer $k$ to one side and subtract the same $k$ from the other side.
We are given a circular arrangement of voters, each voting for either J or L. We must cut this circle into exactly K consecutive segments, where the last segment wraps around to the beginning.
We are given a sequence of buildings, each with a distinct height. For any interval of buildings from index i to j, we consider two traversals: moving from left to right and moving from right to left.
We are given a polygonal “cake” whose upper boundary is defined by a polyline through $n$ points whose x-coordinates are strictly increasing.
The grid represents a maze where two agents move over discrete time steps: Pacman and a ghost. Pacman starts at a fixed cell and then follows a predetermined sequence of moves consisting of up, down, left, and right commands.
We are given a permutation of length $N$, meaning all values are distinct. From this array we consider every contiguous subarray, and we want to count how many of those subarrays are “valid” according to a stack simulation rule.
We are given a list of money transfers between people, where each record says that one person paid on behalf of another, creating an implicit debt relationship. From these transactions we can compute how much each person ultimately owes or is owed.
We are given a person’s full name split into three or four words. The last two words are fixed surnames, while everything before them forms the given names. From this name, we must reconstruct a very specific sequence of candidate login identifiers called LDAPs.
We are simulating a short sequence of moves on a toroidal 15 by 15 grid, where Pacman follows a fixed deterministic path while a hidden ghost moves randomly. Both start from the same uniformly random cell.
The previous attempt failed because it incorrectly assumed a simple affine relation between $M$ and the orthocenter $H$ of $\triangle OPQ$.
We are given three rectangular sheets, each with a fixed width and height, and we are allowed to place them on a plane without rotating them. The task is to arrange all three so that the total area of the region they occupy is as small as possible.
There are $N$ lifts and $N$ special floors called waiting floors. The $i$-th waiting floor is fixed at height $10i - 5$, so these floors are evenly spaced and strictly ordered. Each lift initially sits on its own waiting floor: lift $i$ starts at floor $10i - 5$.
We are given a convex polygon described by its vertices in counterclockwise order. The task is to cut this polygon into triangles using non-intersecting diagonals between vertices, exactly forming a triangulation.
We are given a triangular board of side length $N$. The board is not a rectangle but a triangle where row $k$ contains $k$ cells, aligned to the left, forming the familiar triangular grid structure.
Each published paper is constructed incrementally. Some papers are independent strings, while others are formed by taking an earlier paper and appending an extra string to its end.
We are given a program as plain text, split into several lines. The task is to determine whether this program is “suspected to be written by GPT and exceeds its output limit.
We are given several categories of algorithms, where each category contains a certain number of distinct algorithms. Over the next $K$ days, Bob will study exactly one category per day, and on that day he must learn exactly $M$ algorithms from that chosen category.
The grid can be thought of as a set of concentric square rings around the center cell. Because the size is odd, there is a single center and every other cell belongs to exactly one ring.
We are given a binary string where each character represents the outcome of a point in a badminton match simulation. A substring corresponds to a single match, and we scan it from left to right, updating a running score: 1 adds a point to David, 0 adds a point to the opponent.
We are working on a grid maze where each cell is either a wall or a free space, and exactly one cell is marked as a start and one as an exit. The movement rules are not the usual four-directional steps.
We are given positions of occupied cells arranged around a circular prison with labels from 1 to 360. Because the structure is circular, cell 360 is adjacent to cell 1, so any contiguous surveillance interval may wrap around this boundary.
Let
We are given a sequence of requests arranged in a line, where each position corresponds to a person who ordered a specific type of dish.
We are given a linear sequence of asteroids, each colored either a or b. We are allowed to choose any contiguous segment of this sequence, remove it, and then glue its ends together to form a cycle.
We are looking at a population that evolves in perfectly rigid generations. The first generation starts with some number of individuals, call it $a$.
The horizon of Mercury is described as a line of mountains, each position having a given height. We are allowed to perform only one type of operation: reduce the height of any mountain by removing material.
The plane $\varepsilon$ is parallel to both skew edges $AB$ and $CD$.
We are given a group of $n$ people, where $n$ is divisible by 3, and these people are already partitioned into teams of exactly 3 members each. Each team will only agree to participate in a competition if at least two of its three members are convinced to go.
We are given an even number of friends, say 2n, and each friend has a single integer value representing a pizza flavor preference. The group wants to order exactly n pizzas, and each pizza must be made from two different friends’ preferences.
We are given a tree with vertices labeled from 1 to n. Each vertex acts like a train station, and moving along any edge between two stations costs exactly one ticket. The twist is that tickets are not globally fixed in price.
The coefficient matrix has positive diagonal entries and negative off-diagonal entries.
The expression involves $\sin 2x$ inside two square roots of complementary forms, suggesting the standard algebraic identity
The configuration is affine, involving a tetrahedron and three lines through the vertices of one face parallel to a fixed direction $DD_0$, where $D_0$ lies in the plane $ABC$.
Five given points determine ten straight lines joining them.