brain
tamnd's digital brain — notes, problems, research
41650 notes
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.
We are given a binary string and we want to transform it into a string of all ones. Two types of operations are available: we can reverse any contiguous segment for a cost, or we can flip all bits in a contiguous segment for a cost.
We are given several packets, each packet containing a known number of balloons. The task is to split these packets between two people so that each packet goes entirely to exactly one of them. No packet can be broken, and both people must receive at least one packet.
We are given a directed graph where cities are nodes and roads are one-way edges. One city is designated as the capital. The goal is to ensure that every city can be reached by following directed roads starting from the capital.
We are given a list of problems arranged in a fixed order from left to right, where each problem has a difficulty value. Mishka has a skill level k, meaning he can only solve problems whose difficulty does not exceed k.
We are given a string that has already been transformed by a deterministic process involving repeated reversals of prefixes.
We are working on a weighted tree where every vertex has a positive value and every edge has a positive cost. A path is not required to be simple in the usual sense: edges are allowed to be traversed up to two times, and vertices can be visited multiple times.
We are given a static array and many independent queries, each query asking us to inspect a contiguous segment of the array and return any value that appears exactly once inside that segment. If no such value exists in that segment, the answer is zero.
We are given a time interval from 0 to M during which a lamp is initially on. The lamp has a predefined list of switching moments. At each moment in this list, the lamp flips between on and off instantly.
We are given a collection of segments on a very large number line. Each segment covers every integer point between its endpoints, including both ends. Different segments may overlap in arbitrary ways: they can be disjoint, nested, identical, or partially intersecting.
We are given access to a black-box quantum oracle that encodes a boolean function over all $2^N$ binary inputs of length $N$. For any input bitstring $x$, the oracle evaluates $f(x)$ without revealing the function explicitly.
We are given a register of qubits representing an integer in binary form, along with an additional qubit that acts as a target bit.
We are given a very small quantum program interface: an array of qubits x, a single qubit y, and an index k. The task is to implement a reversible transformation that encodes a classical function into a quantum oracle. The function itself is extremely simple.
We are given an array of qubits, but the important promise is simpler than the quantum framing suggests: the system is guaranteed to be in one of two classical computational basis states.
We are given a small register of up to eight qubits, all initially prepared in the all-zero computational basis state.
We are given a single qubit that has been prepared in one of two possible states. These two states are not computational basis states like The task is to interact with this qubit using allowed quantum operations, perform a measurement, and return an integer that identifies…
We are given a pair of qubits that were prepared in one of four specific two-qubit entangled states. These four states form the Bell basis, meaning they are maximally entangled and differ only by relative phase and bit flips, not by local classical information on each qubit.
We are working in a quantum setting with two qubits that initially form the computational basis state corresponding to both being zero. The task is to transform these two qubits in-place into one of four specific entangled states, chosen by an integer index from 0 to 3.
We are working in a quantum programming setting where a single qubit is already in a known initial basis state, and we are asked to transform it into one of two target basis states depending on the value of an integer parameter called sign.
We are given a black-box quantum operation that acts on N input qubits plus one auxiliary qubit. Internally, this operation encodes a hidden binary array of length N.
We are interacting with an oracle that hides a binary string of length $N$. Each position in this hidden string is either 0 or 1. The oracle does not reveal the string directly.
We are working in a quantum setting where three input qubits represent a binary vector of length three, and an additional qubit acts as an output register.
We are given a small quantum circuit setting where the input consists of an $N$-qubit register $x$, a single target qubit $y$, and a classical binary vector $b$ of length $N$.
We are given a single qubit guaranteed to be in one of two possible pure states. One state is the classical basis state $ The output of the operation must be one of three integers.
We are given a very small quantum system consisting of two parts: an input register of N qubits and a single output qubit. Alongside this, we are given a classical binary vector b of length N.
We are given a single qubit that is prepared in one of two possible pure states with equal probability. One of them is the computational basis state $ The task is not to deterministically identify the state, but to implement a quantum procedure that produces a classical bit…
We are given a system of two qubits that is guaranteed to be in one of four mutually orthogonal entangled states. These states form a complete basis for two-qubit space, so exactly one of them is present, and the task is to identify which one.
We are given a 2-qubit system that is guaranteed to be in exactly one of four mutually orthogonal quantum states. Each of these states is a different encoding of a two-bit piece of information, but not in the standard computational basis.
We are working with a register of $N = 2^k$ qubits, where $k le 4$, so $N le 16$. The system starts in the all-zero computational basis state, meaning every qubit is in $ A W state over $N$ qubits is a uniform superposition of all basis states that contain exactly one qubit in…
We are given a small system of qubits, at most eight of them, prepared in one of two highly structured quantum states. One of them is the GHZ state, which behaves like a perfect global correlation between all qubits being simultaneously zero or simultaneously one when measured.
We are given a very small system of qubits, at most eight of them, and the system is guaranteed to be prepared in exactly one of two highly structured quantum states.
We are working in a quantum setting where an initial register of $N le 8$ qubits starts in the all-zero computational basis state. Alongside this register, we are given two classical bitstrings of equal length, each describing a valid basis state on these qubits.
We start with a register of up to eight qubits, all initialized in the all-zero computational basis state. Alongside this, we are given a classical description of another basis state as a boolean array, where each entry indicates whether the corresponding qubit should be in…
We start with a system of N independent two-level quantum bits, all initially in the state corresponding to zero. In computational terms, this is the single basis state where every qubit is 0.
We are asked to build a tree with a fixed number of nodes such that two structural constraints hold simultaneously: the longest simple path in the tree has length exactly d, and every vertex is incident to at most k edges. If no such tree can exist, we must report impossibility.
We are given a multiset of coin values, where every coin is a power of two. Each query asks whether we can form a target sum using a subset of these coins, and if so, what the minimum number of coins needed is.
We are given a document as a sequence of words. The structure is fixed: words are separated by single spaces, so the underlying object is really just an array of strings.
We are asked to construct a binary string made of zeros and ones with two constraints that interact with each other in a nontrivial way. First, the string must contain exactly a zeros and exactly b ones, so the total length is fixed as n = a + b.
We are given a sequence of daily temperatures and asked to evaluate all contiguous time intervals whose length is at least a given threshold. For each such interval, we compute its average temperature, meaning the sum of its values divided by its length.
We are given a multiset of coin values, and we need to place every coin into a collection of “pockets” under a simple restriction: inside any single pocket, no value is allowed to repeat.
We are given an array that changes over time and we must repeatedly answer queries about subarrays inside a given segment. For any segment $[l, r]$, we consider every contiguous subarray $[L, R]$ fully contained inside it.
We are given a weighted tree with up to $10^5$ vertices. Each edge has a positive length, so distances are standard shortest-path distances on the tree. We must choose a set of vertices that forms a single simple path in the tree, containing at most $k$ vertices.
We are given a multiset of integers that is known to come from a very specific geometric construction. Somewhere on an unknown grid of size $n times m$, there is exactly one cell containing a zero. Every other cell is filled with its Manhattan distance to that zero cell.
We are given a row of positions, each of which must be filled with one of two possible types. You can think of this as constructing a binary string of length $n$, where each position is either type A or type B.
We are given a set of existing hotels placed on integer points along an infinite number line. We want to open one additional hotel at some integer coordinate. The requirement is that the closest existing hotel to this new one must be at distance exactly $d$.
We are given an array of integers laid out on a line. Two robots start just outside the array, one at the far left moving rightward and one at the far right moving leftward.
We are given a connected undirected graph of cities where city 1 is the capital. From this graph we must select exactly $n-1$ roads so that the selected edges still connect all cities, meaning they form a spanning tree.
We are given a sequence of integers and a fixed value $m$. The task is to count how many contiguous subarrays have the property that when you sort the subarray, its median equals exactly $m$, where for even-length subarrays the median is defined as the left middle element.
We are given a permutation of the integers from 1 to n, and a distinguished value m that appears exactly once somewhere in the array. The task is to count how many contiguous subarrays have the property that, if we sort that subarray, the median element equals m.
We are given a single sequence of integers that represents what Tanya says while climbing stairs in a building. Each time she starts a new stairway, she always begins counting from 1 and increases by 1 for each step until she reaches the last step of that stairway.
We are given a very long decimal string and we are allowed to insert cuts between adjacent digits, splitting it into contiguous chunks.
We are given a multiset of integers, and we are allowed to delete any subset of them. After deletions, we want the remaining elements to satisfy a pairing condition: every remaining value must be able to find at least one other remaining value such that their sum equals a…
We are given two strings, and we are allowed to repeatedly delete only the leftmost character from either string. Each deletion shortens one of the strings by exactly one character.
We are given a rectangular grid where each cell contains a non-negative integer. A path starts at the top-left cell and moves only right or down until it reaches the bottom-right cell.
We are given a rooted tree of officers where each officer has a unique direct superior except the root officer 1. This creates a hierarchy where every node represents an officer and edges point from superior to subordinate.
We are given two strings of equal length, and we are allowed to manipulate them using a small set of swap operations. Each position forms a vertical pair of characters, one from the first string and one from the second.
We are given a sequence of problem difficulties in a fixed order, and we must split this sequence into exactly k consecutive segments. Each segment corresponds to one day of practice, and every problem must belong to exactly one segment.
We are given a sequence of integers, each lying in a very large range up to $10^9$. Mishka repeatedly applies a global transformation rule that acts independently on each value: every pair of consecutive integers $(1,2)$, $(3,4)$, $(5,6)$, and so on, gets swapped in place, but…
We are given a sequence of numbers arranged in a line, and we want to cut this line into three consecutive segments. The first segment starts at the beginning, the second sits in the middle, and the third ends at the last element.
We are dealing with a linear sequence of subway stations, where each station continuously accumulates passengers over time. Initially, each station already has some number of waiting people.
We are given a tree and a collection of “ants”. Each ant comes with two alternative vertex pairs. For each ant, we must decide which of its two pairs it will use.
We are given an array of numbers and allowed to freely reorder them. After rearranging, we compare the new array against the original array position by position.
We are dealing with a hidden pair of integers, both lying in a very large range up to $10^{18}$. The only way to learn about this pair is by repeatedly asking queries of the form $(x, y)$.
We are given a fixed rectangular box with side lengths $A, B, C$. We want to count how many different triples $(a,b,c)$, ordered so that $a le b le c$, can serve as a building block such that copies of this smaller box can exactly tile the larger one, provided every copy is…
We are given a single lowercase word and asked to verify whether it follows a specific phonetic rule. The rule constrains how consonants and vowels can appear in sequence.
We are given a sequence of rectangular tiles placed in a fixed left-to-right order. Each tile has two possible orientations: we can either keep it as width-by-height or rotate it by 90 degrees, which swaps the two values.