brain
tamnd's digital brain — notes, problems, research
43815 notes
We are given two separate point clouds in the plane. Each cloud contains many points, and both clouds include the same set of “true” points, but mixed with additional noise points.
We are given a complete graph on vertices labeled from 0 to n − 1. Every pair of distinct vertices is connected, and the weight of the edge between u and v is the bitwise XOR of their labels.
We are given a tree with n vertices and asked to construct two different trees on the same number of vertices, each meant to expose the failure or correctness of a specific heuristic for minimum vertex cover. The heuristic is extremely simple.
The game starts with a single integer value, and two players alternately reduce it. On Mahmoud’s turn, he is only allowed to subtract an even positive number that does not exceed the current value.
We are given a permutation of the numbers from 1 to N, and we simulate a simple “record-breaking” process on it. We start with a virtual value 0.
We are given a tree with a value attached to every node. Between any two nodes $u$ and $v$, there is exactly one simple path, and we assign a score to that directed path by taking the node values along the path and alternating their signs, starting with a positive sign at the…
We are working with two integer arrays of equal length. Each position contributes independently to a total “error”, where the error of an index is the square of the difference between the two values at that index.
We are given a string made only of the characters a, b, and c. This string is claimed to have been constructed in a very specific way: it starts with one or more a characters, then some b characters are appended, and finally some c characters are appended at the end.
We are given a string $s$ of length $n$, and we consider all of its suffixes. For each starting position $k$, the corresponding substring is $s[k..n]$. The task is to analyze each of these suffixes independently.
We are given $n$ weighted elements. Each element $i$ has a weight $wi$. We consider all ways to split these $n$ elements into exactly $k$ non-empty groups. Each such grouping is an unordered partition, so only the membership structure matters, not any labeling of groups.
We are given four separate square fragments of a chessboard, each fragment being an $n times n$ grid where every cell is already colored either black or white. The value $n$ is odd, and the goal is to assemble these four pieces into a larger $2n times 2n$ chessboard.
We are simulating a process where squares arrive one by one and stack up in columns. There are n columns, and each incoming square chooses a column and lands on top of whatever is already there, increasing that column’s height by one.
We are given an undirected simple graph and asked to identify which edges are “exclusive” to a single simple cycle.
We are given a simple orthogonal polygon, meaning its edges are horizontal or vertical and it never self-intersects. The interior of this polygon is considered “black”. We also have a fixed axis-aligned rectangular window. The window is static and we look only through it.
We are given a single positive integer written in decimal form. We are allowed to repeatedly remove digits from it, with the only restriction that the remaining number must always stay positive and must not acquire leading zeros.
We are given a sequence of days, and on each day Polycarp solves a fixed number of problems. If we look at the entire training period, there is a total number of problems solved across all days.
We are given a final collection of axis-aligned rectangles that come from cutting an unknown larger rectangle using only straight cuts parallel to its sides. Every cut is either horizontal or vertical, so the original rectangle is partitioned into a grid.
We are given a tree where each vertex has an associated current degree that changes as vertices are removed. A vertex is eligible for removal only when its degree is even at the moment we choose it.
We are working with ways of writing an integer $n$ as a nonincreasing sequence of positive integers. In other words, we break $n$ into parts that never increase as we move to the right, and all parts must be positive.
We are given a sequence of messages that arrive over time. Each message arrives at a known minute and starts with a fixed value.
We are given a collection of distinct lowercase strings, each representing a variable name. For each original name, we must choose a non-empty prefix of that string to act as its new shortened identifier.
We are given an $n times n$ grid where each cell is either forbidden or allowed. Forbidden cells are marked with and can never be part of a ship. Allowed cells are marked with . and may be part of a ship.
We are given a linear stream of $n$ candies and a fixed number of people $k$. A single parameter $x$ determines how the candies are distributed: candies are processed in consecutive blocks of size $x$.
We are given a system of pipe holes, each hole having a fixed size that determines how much water it can drain when water is poured into the system. Arkady pours a fixed amount of water, but only one hole, the first one, is considered useful to him.
We are given a timeline of scheduled landings, each occupying exactly one minute, already sorted in increasing order. We must insert one additional event, a takeoff that also lasts one minute, into this timeline. The key restriction is safety spacing.
We are given a rigid strictly convex polygon with fixed geometry in the plane. Its vertices are labeled in order, and initially the polygon already sits in some stable position.
We are given a circular board with 14 positions. Each position contains some number of stones. One move consists of picking a single position that has stones, removing all stones from it, and then distributing those stones one by one into subsequent positions moving clockwise…
Each word in the input is meant to describe an object, but the language has a normalization rule: two words represent the same object if they contain exactly the same set of distinct letters, ignoring how many times each letter appears and ignoring order.
Each creature starts with a fixed health value and a fixed damage value. We are allowed to improve the army using two global operations. One operation increases a creature’s health by doubling it, and the other operation overwrites a creature’s damage with its current health.
We are given a binary string that is already in a valid canonical form, meaning it represents a non-negative integer in binary without unnecessary leading zeros.
We are given a collection of closed intervals on a number line. Each interval represents a segment with a left endpoint and a right endpoint, and we need to determine whether there exists a pair of distinct segments such that one is fully contained inside the other.
We are given a sequence of integers in the order they appear. From this sequence we want to pick some elements while preserving order, but we are only allowed to keep a subsequence that looks like a run of consecutive integers increasing by exactly one each step, such as $x…
We are given a multiset of integers that originally came from a single starting value that Polycarp repeatedly transformed. Each transformation either doubles the current number or divides it by three when it is divisible.
We are given a list of integers and asked to construct a value $x$ between 1 and $10^9$ such that exactly $k$ elements of the list are less than or equal to $x$. If no such value exists, we must output $-1$.
We are given a string of uppercase English letters, and we are asked to look at every adjacent pair of characters in it. Each such adjacent pair forms a “two-letter pattern”, for example the string “ABAC” contains “AB”, “BA”, and “AC”.
The task describes a very specific way of reducing a positive integer repeatedly. Instead of simply subtracting one in the usual arithmetic sense, the operation depends on the last digit of the number.
We are given a timeline of $n$ days and a set of $m$ exams, each fixed to happen on exactly one specific day. Every exam also comes with a preparation window that starts after its announcement day and ends the day before the exam itself, plus a required number of preparation…
We are given a set of programmers, each with a fixed skill value. For any programmer $i$, we want to count how many other programmers $j$ they can “mentor”.
We are given a sequence of integers, and we are allowed to slightly “tweak” each element independently by choosing to either decrease it by one, increase it by one, or leave it unchanged.
We are given a sequence of recorded changes in the number of passengers on a bus. Each value tells us how the passenger count changes after a stop, so if we denote the starting number of passengers by $x$, then after each stop we repeatedly add the given deltas and obtain a…
We are given a sequence of integers and asked to compress it by removing duplicates, but with a specific rule: for every distinct value, only its last occurrence in the array must remain.
We are given a short string representing a file name. The only constraint that matters is that the substring "xxx" is forbidden anywhere inside the final string.
We are given several dormitories arranged in a line. Each dormitory contains a known number of rooms, and all rooms across all dormitories are conceptually concatenated into one long sequence.
We are given a line of numbered positions from 1 to n. Some positions already have a fixed color, either 0 or 1, while others are uncolored and must be assigned one of these two values.
We are maintaining a dynamic multiset of positive integers. The structure supports insertions, and after each insertion phase we may receive queries asking us to pick one previously inserted value that satisfies three simultaneous constraints with respect to a fixed query triple.
We are given a tree, meaning a connected graph with exactly one simple path between any two towns. Every ordered pair of distinct towns defines a walking route that follows that unique path. Among all possible ordered pairs of towns, some are considered invalid.
We are given three strings of equal length, each representing a ribbon owned by one of three players. In one move, a player can change exactly one character in their string to any other letter.
We are given a number of friends attending a pizza party, and the host must divide a circular pizza into exactly equal slices so that there are one slice per person, including the host. If there are $n$ friends, the pizza must be split into $n + 1$ equal parts.
We are given a connected undirected graph with a special structure: every vertex can belong to at most one simple cycle. This means the graph looks like a tree where some disjoint cycles have been added, and those cycles never intersect at a vertex.
We are given a tree with $n$ nodes. Each node represents a district, and the road system guarantees there is exactly one simple path between any two districts.
We are given a city shaped like a very small grid: it has exactly 4 rows and an odd number of columns. Two pairs of locations matter: the first journey starts at the top-left corner and wants to reach the bottom-right corner, while the second journey starts at the bottom-left…
We are given a circular arrangement made of two kinds of characters: pearls represented by o and links represented by -. Because the structure is a necklace, the string is considered cyclic, meaning the last character is adjacent to the first.
We are given a tree and we choose an ordered list of $k$ simple paths, where each path is defined by two endpoints in the tree. Because paths are on a tree, each pair of vertices determines a unique simple path.
We start with an array of length $n$ filled with zeros. There are $q$ operations, each operation adds a positive value $xi$ to every position in a contiguous segment $[li, ri]$. We are not forced to apply all operations.
We are given an undirected tree, and we must split all its edges into a collection of simple paths so that every edge belongs to exactly one path. The extra requirement is global and restrictive: if we pick any two of these paths, they must share at least one common vertex.
We are given a single short string made of lowercase English letters. From this string, we are allowed to choose any contiguous substring. Among all such substrings, we are interested in those that are not palindromes, meaning they do not read the same forwards and backwards.
We are given a rectangular billiard table with corners at $(0,0)$, $(n,0)$, $(0,m)$, and $(n,m)$. A point-like ball starts from $(x,y)$ and moves in a straight line with direction components restricted to $-1, 0, 1$, meaning it travels horizontally, vertically, or along a…
We are given a tree, meaning a connected graph with no cycles, and every edge is available for us to potentially remove. The operation we are allowed to perform is cutting edges so that the graph splits into smaller connected components.
We are given a line of chairs, each either occupied by a person or empty. The configuration is represented as a binary string where 1 means a person is sitting and 0 means the seat is empty. A seating arrangement is considered valid only if no two people sit next to each other.
The road network forms a tree of cities, so between any two cities there is exactly one simple path. On top of this fixed tree structure, there are additional “bus routes” between pairs of cities.
We are controlling a single elevator in a small building with nine floors, and we must serve a sequence of people in a fixed arrival order. Each person starts on some floor and wants to reach another floor.
We are given an array and many queries over its segments. Each query asks us to look at a contiguous part of the array, consider every possible subsegment inside it, and compute a special function on each subsegment.
We are given a list of integers placed on a board. Two players alternate turns removing exactly one number from the board. After exactly $n-1$ removals, only a single number remains, and that number is the outcome of the game. The players have opposing goals.
We are given a base string and many queries, each query picks two equal-length substrings and asks whether one substring can be transformed into the other by consistently renaming characters, with the restriction that different characters must map to different characters.
We are given a sequence of pencil saturation values, and we need to split all pencils into groups called boxes. Every pencil must be placed in exactly one box. Each box that we use must contain at least k pencils.
We are given a collection of switches, each of which controls a subset of lamps. When a switch is pressed, every lamp connected to it turns on permanently. Once a lamp is on, it never turns off again, even if other switches affecting it are pressed later.
We are given a line of length $n$, where $n$ is even, and each position is either empty or contains exactly one chess piece. The board is colored in an alternating pattern starting with black at position 1, so positions look like B, W, B, W, and so on.
We are asked whether it is possible to design a function on a very large set of positions, up to $10^{18}$, that behaves like a deterministic jump rule applied every second. Each position points to exactly one next position, and every element moves according to this fixed rule.
We are given a connected undirected graph of towns. Each town produces exactly one type of goods, and there are at most 100 distinct types overall. For any pair of towns, moving goods between them costs the shortest-path distance in the graph, where each road has unit length.
We are given a permutation of size $n$, and we are told it was produced by one of two random procedures. Both procedures start from the identity permutation $[1, 2, 3, dots, n]$, then repeatedly pick two distinct positions uniformly at random and swap them.
We are given two positive integers $x$ and $y$, and we are asked to compare the values of two exponentials: $x^y$ and $y^x$.
We are given a sequence of displays arranged along a line. Each display has a fixed position in this order, a font size, and a rental cost.
We are given a line from position 0 to position $a$. Polycarp moves only to the right, one unit at a time. Some disjoint intervals on this line are rainy, and if he traverses an edge fully contained inside any rainy interval, he must carry at least one umbrella during that…
We are given several independent integer arrays. From each array we are allowed to remove exactly one element, and this creates a “modified sum” for that array, meaning the original sum minus the removed element.
We are given a collection of strings, and we are allowed to rearrange them in any order. After rearranging, we want a very specific nesting property: every string must contain all strings that appear before it as substrings.
We are given several “clouds” moving along a line. Each cloud is a segment of fixed length $l$, initially placed at position $xi$, and then moving over time with constant velocity $vi + w$, where $vi$ is either $+1$ or $-1$, and $w$ is a global wind parameter we are allowed…
We are asked to construct a rectangular grid and fill it with four letters, each representing a type of flower. The grid should be designed so that when we look at each letter separately, counting connected components using edge adjacency, the number of components for the four…
We are given a short string representing a row of cells. Each cell is either empty or contains exactly one flower of one of three types, encoded as the letters A, B, and C.
We are given a collection of strings, each consisting only of opening and closing parentheses. Think of each string as a small “building block” of a larger bracket expression.
We are placing lamps along a one-dimensional street that runs from position 0 up to position n. Some positions are forbidden, meaning we are not allowed to place a lamp there, but otherwise we may choose any allowed position as a base.
We are given an initial number of commentary boxes and a required number of delegations. Every delegation must receive exactly the same number of boxes, and all existing boxes must be used so that nothing remains idle.
We are given a board with two rows and $n$ columns, so each cell is either empty or blocked. A blocked cell cannot be used. Our task is to place as many fixed L-shaped pieces as possible on the board, where each piece occupies exactly three cells in one of four orientations.
We are given a single integer $n$ up to $10^{10}$. The task is not to compute anything from it, but to rewrite it as a mathematical expression using only digits, plus, multiplication, and exponentiation.
We are given summary statistics about how students in a group behaved after an exam. Every student belongs to exactly one of four categories: they either visited only BugDonalds, only BeaverKing, both restaurants, or stayed at home because they failed the exam.
We are given an initial pile of candies and a fixed daily rule that transforms this pile over time. Each morning Vasya chooses a constant number k.
We are given a list of integers, and we are allowed to repeatedly apply an operation that changes the array in a very specific way: in one move, we choose an integer value and add it to every element that is currently non-zero. Zeros stay untouched during that operation.
We are given four integers $l, r, x, y$. The task is to count ordered pairs $(a, b)$ such that both numbers lie inside the interval $[l, r]$, and their greatest common divisor is exactly $x$ while their least common multiple is exactly $y$.
We are given a fixed logical circuit built in two layers above a set of binary input features. The first layer contains a small number of gates, each reading exactly two input variables and producing a boolean output using one of four operations: AND, OR, NAND, or NOR.
We are given an array and a threshold value x. For every possible integer k from 0 to n, we need to count how many subarrays have exactly k elements strictly smaller than x.
Two people each receive a secret pair of distinct digits from 1 to 9. The two hidden pairs are linked by a single property: they share exactly one common number. You are not given the hidden pairs directly.
We are given a collection of tasks. Each task has a “power” value and a “processor requirement”. A machine can run at most two tasks, but there is a strict ordering rule if it runs two: the first task assigned to a machine is allowed to be arbitrary, while the second…
We are given two sets of enemy ships, all lying on two vertical lines: one group is fixed at $x=-100$, the other at $x=100$. Each ship has an integer $y$-coordinate, and multiple ships may share the same $y$.
Each knight comes with two attributes, a fighting strength and a stash of coins. A knight is only able to defeat knights with strictly smaller strength, and every victory transfers the defeated knight’s coins to the winner.
The input describes a fixed sequence of digits, like a recorded keypad history, and a separate set of digits that correspond to keys with fingerprints.
We are given a rooted tree of employees where employee 1 is the CEO. Every other employee has exactly one direct superior, forming a hierarchy.
We are given a parking grid with 4 rows and $n le 50$ columns. Each cell either holds a car or is empty. Cars are uniquely labeled from $1$ to $k$, with $k le 2n$. The middle two rows contain the cars in their starting positions.
We are given a lineup of $2n$ people where each integer label from $1$ to $n$ appears exactly twice. Each label represents a couple, so the goal is to rearrange the line so that both occurrences of every number sit next to each other.
We are given a single integer representing the total amount of money Allen wants to withdraw. The bank only dispenses cash using fixed denominations: 1, 5, 10, 20, and 100.
We are given a permutation, meaning every value from 1 to n appears exactly once in an array. For any contiguous segment of this array, we call it good when it has a very strong structural property: if you take the smallest and largest values inside that segment, then every…
We are working with an $n times n$ grid where each cell independently takes one of three colors. A coloring is considered “good” if at least one full row or at least one full column ends up monochromatic, meaning every cell in that row or column shares the same color.