brain
tamnd's digital brain — notes, problems, research
43815 notes
We are given a tree, and we must assign a nonzero integer to every vertex. The constraint is not about the whole tree sum, but about what happens when a vertex is removed. If we delete any vertex $v$, the tree splits into several connected components.
We are given a set of ingredients, each of which must appear in some positive integer quantity in a final mixture. The professor does not provide absolute amounts, but instead gives exactly $n-1$ constraints.
We are asked to count permutations of the numbers from 1 to n that satisfy two independent kinds of restrictions. The first restriction is positional and local. We are given a short comparison string s of length m.
We are given a tree where some vertices are marked as “base lodges”. Every vertex inherits a height equal to its distance from the nearest lodge.
We are repeatedly trimming a string from the front based on a self-referential property of its prefixes. At any moment, we look at the current string and examine all its prefixes starting from the empty one.
We are given a string whose length is a power of two, indexed from 0 to $2^n - 1$. The key operation allowed is a global reindexing of the string using bitwise XOR with a fixed mask $j$.
We are given a circular arrangement of $n$ players, each holding exactly $n$ cards. Every card carries a label from $1$ to $n$, and each label appears exactly $n$ times across the whole system.
We are looking at a grid where each position is completely deterministic: the cell in row $i$ and column $j$ contains the value $i^j$.
We are given a tree, and we must assign a positive integer weight to every vertex. A vertex is called good if its weight equals the sum of the weights of all vertices adjacent to it. The goal is not just to satisfy this condition arbitrarily.
We are given a number written in decimal form, and we are allowed to delete digits one by one from anywhere in the number. After each deletion, the remaining digits close up, and any leading zeros disappear automatically.
We are given a string made of four types of brackets: round (, ) and square [ , ]. Each query gives a substring, and for that substring we want to know the cheapest way to turn it into a valid bracket sequence. We are allowed to perform two kinds of transformations.
We are given a line segment with three types of entities: a cat starting at position 0, a hole at position n, and several mice positioned strictly between them. Time advances in discrete seconds.
We are given a tree of cities. Each city has a fixed value called enjoyment. Each road connects two cities and has two properties: a capacity and a toll. A group query gives a starting city and a number of vehicles.
We are given a connected undirected graph where every edge initially has weight 0. We then receive a sequence of queries, each query specifying two vertices. For each query, we must choose a simple path between its endpoints and add 1 to every edge along that path.
Each task has two special moments: the moment Okabe learns about it, and the earlier time at which it should actually be completed. When he learns about a task, he either confirms it is already done correctly, or he is forced to jump back in time to fix it immediately.
We are given a complete directed acyclic graph on the vertices from 1 to n, where every pair (i, j) with i < j has a directed edge from i to j.
We are asked to construct a tree on $n$ labeled nodes, where a tree means a connected graph with exactly $n-1$ edges and a unique simple path between every pair of nodes. Alongside this, we are given $m$ constraints.
We are trying to recover an unknown permutation of the numbers from 1 to n. We never see this permutation directly. Instead, we can probe it using a query mechanism that mixes our chosen array with the hidden permutation in a very specific way.
We are given several independent test cases. In each test case there is an array of distinct positive integers, and the task is to choose as many elements as possible such that the sum of the chosen elements is not prime.
We are given a sequence of numbers and a sequence of operations placed between them. We start each segment with value 1, then apply the operations from left to right. Each position either multiplies the current value by the given number or divides it by that number.
We are given several test cases. In each one, we start with an array of nonzero integers $a$. Our task is to construct another array $b$ of the same length such that two conditions hold simultaneously. First, no element of $b$ is allowed to be zero.
We are given an array of positive integers and asked to construct a sequence of non-overlapping subarrays. These subarrays must be chosen in order from left to right, and their lengths are fixed to form a decreasing sequence starting from some value $k$ down to $1$.
We are given a string made of lowercase letters. We are allowed to pick exactly one letter of the alphabet, and then delete any occurrences of that chosen letter from the string, possibly none or all of them.
We are given a collection of songs split into three types: some last 1 minute, some last 2 minutes, and some last 3 minutes. For each test case, we must assign every song to one of two concerts.
Each test gives us a hand of five distinct numbers between 1 and 100. Two players independently receive such hands, and each player only sees their own five numbers.
The labyrinth can be seen as a connected weighted graph where rooms are nodes and passages are undirected edges with capacities. Each room also has a one-time “growth value” that increases Lucy’s width if she chooses to eat that room’s candy.
We are given a set of jarls, each belonging to exactly one island. The default rule of conflict is simple: jarls from different islands are in conflict, while jarls from the same island are peaceful.
We are given a rooted hierarchy with a single root, the king, and up to $n$ lords forming a tree where each lord has exactly one parent. Each lord $i$ has a required amount of money $mi$.
We are given a convex polygon in the plane, and this polygon represents the silhouette of an object. We imagine rotating the viewing direction uniformly at random, and for each orientation we project the polygon onto axes aligned with that view.
We are given a line of participants, each assigned a positive “luckiness” value. These participants enter a knockout tournament with a very rigid pairing structure.
We are given a circular arrangement of villages, labeled from 1 to n in clockwise order. Initially there are no connections between any pair of villages.
We are given a final board configuration of a grid-based stacking process where multiple small polyomino-like pieces were dropped one after another. Each piece is connected in four directions, has at most seven cells, and is identified by a letter.
We are given a permutation, meaning an array containing every integer from 1 to n exactly once. The process repeatedly applies a deterministic “strange bubble pass” operation, but with a twist: odd-numbered rounds compare adjacent pairs starting from index 1, 3, 5, and…
We are given a starting number and a restriction on how many distinct digits we are allowed to use. For each query, we must find the smallest integer that is not smaller than the given number and whose decimal representation uses at most k different digits.
We are given a number written as a string of digits. In one operation, we are allowed to either remove any single digit from anywhere in the current string, or append a single digit to the right end of the string. These operations can be repeated in any order.
We are counting how many arrays of length n can be formed when each element is an integer in the range [0, 2^k - 1], with the additional constraint that a certain bitwise inequality holds.
We are given a complete weighted undirected graph on $n$ vertices, so every pair of vertices is connected and every edge has a known cost.
We are working on a graph whose vertices are all integers from $0$ to $2^n - 1$. Each vertex represents an $n$-bit binary string, and there is an undirected edge between two vertices if their binary representations differ in exactly one bit.
We are given a hidden array of integers, and we cannot access its elements directly. The only way to learn anything about the array is by asking queries on pairs of indices. Each query returns either the bitwise AND or bitwise OR of two elements.
We are given two arrays of the same length and a set of queries, each query picking a contiguous segment. Inside a segment, we are allowed to perform a special operation multiple times. Each operation selects an even number of distinct positions inside the segment.
We are given a complete tournament where every pair of teams plays exactly one match. The result of each match is random, but biased: team $i$ beats team $j$ with probability proportional to its strength, specifically $frac{ai}{ai + aj}$. Each match outcome is independent.
We are given a bracket string, but it is not written explicitly character by character. Instead, it is compressed into blocks.
We start with two integers, both initialized to zero. We are allowed to repeatedly apply operations that modify them using a freely chosen positive step size each time.
We are given an array of integers, and we are allowed to swap adjacent elements. The goal is to rearrange the array so that no two neighboring elements share the same parity, meaning we want an alternating pattern of even and odd numbers.
We are given a rectangular room and inside it a fixed axis-aligned rectangular table. The table currently occupies a block inside the room, but we are allowed to slide this table anywhere inside the room as long as it stays fully inside the boundary.
We are given a set of weighted intervals on a number line from 1 to m. Each interval allows free movement between any two integer points inside it, which effectively means that once we pick a set of intervals, all points covered by overlapping intervals become connected…
We are asked to build an order of pizzas where each pizza contributes both a fixed number of slices and a fixed baking time.
We are given a string made only of three possible letters. For any substring, we are allowed to change characters, and each change replaces a character with any of the three letters.
We are given an array of values indexed from one, and we want to choose two different positions in this array. For any chosen pair of indices, we compute a score made of two competing parts: a positive term that grows with the product of the indices, and a penalty term that…
We are given an array a of length n. It is not a permutation itself but a derived “stability profile” of an unknown permutation of 1..n. For each position i in that hidden permutation, we look at all subarrays that contain i.
We are given several independent queries. Each query provides a positive integer $n$, and we must count how many integers $x$ in the range from 1 to $n$ have a special property. For a number $x$, we compare the sum of its digits before and after adding one.
We are simulating a point moving on a number line. The point starts at position 0 and moves strictly to the right at unit speed, so without any interruptions it would simply take $t$ seconds to reach position $t$.
We are given a string made of lowercase letters. In one move, we are allowed to pick exactly one subset of positions, take the characters at those positions, and rearrange only those chosen characters arbitrarily while keeping all other characters fixed in their original places.
The task is about selecting a subset of vertices in a tree such that every pair of chosen vertices is equally far apart.
We are given a rectangular grid with $n$ rows and $m$ columns, and we must tile it completely using dominoes, each covering exactly two adjacent cells. Every cell must belong to exactly one domino, so the grid is fully partitioned into pairs of neighbors.
We are given several test cases. In each case there is a sequence of integers and a number of colors. We want to “paint” some occurrences of these integers using up to $k$ colors, with the option to leave elements unpainted. The constraints inside the coloring are subtle.
We are given several independent test cases. In each test case, we receive a list of words, and we want to select as many of these words as possible so that the selected subset satisfies a specific imbalance condition.
We are given an array where each element represents a point on a vertical line at its index. More precisely, the i-th element forms a point $(ai, i)$ in a 2D plane. The distance between two points is measured using Manhattan distance.
We are given a string made of lowercase letters from a small alphabet of size $k$, plus wildcard characters that can be replaced freely.
We are given a sorted set of points on a number line, which we can think of as rocks placed at distinct integer coordinates. A frog starts on one designated rock and can repeatedly jump to other rocks.
We are given an array of length $n$, and each position $i$ must store an integer $ai$ within a fixed interval $[l, r]$. Two constraints define what makes a valid configuration interesting.
We are asked to construct an array of positive integers whose elements sum to a fixed value, while keeping the array as small as possible in length.
We are given a square board of size $n times n$, but only the first and last rows matter. The bottom row contains Gregor’s pawns, and the top row contains enemy pawns. Every column is either empty or occupied independently in those two rows.
We are given a prime number $P$, and for each test case we must output two integers $a$ and $b$ such that both lie between 2 and $P$, with $a < b$, and the remainders when dividing $P$ by $a$ and by $b$ are equal.
The ceiling is split into a grid where each row contributes a fixed amount of paint and each column contributes another fixed amount. This makes every cell’s paint level completely determined by two arrays: one attached to rows and one attached to columns.
We are given a set of points on the plane that act as fixed vertices. From these points, we choose any three distinct points to form a triangle. Inside this triangle lies an infinite integer grid of “cows”, one at every lattice point.
We are given a set of points on a plane that serve as possible vertices of a triangle. Every point has even integer coordinates, and no three points are collinear. From these points we choose any triple and form a triangle.
We are looking at a process that lasts for $n$ minutes. Each minute, exactly three new items are added, so after minute $t$, there are $3t$ items available.
We are working with a graph whose vertices are fixed nobles numbered from 1 to n, where the label also represents their strength. Edges represent mutual friendships, and these edges change over time through insertions and deletions.
We are given a directed graph where we start from node 1 and consider all possible directed walks that end at each vertex. A walk can revisit nodes and edges arbitrarily many times.
We are given a one-dimensional strip of length $n$. Some positions on this strip contain air conditioners, each fixed at a known coordinate and each producing its own base temperature.
We are given a sequence $x1, x2, dots, xn$. Our task is to construct another sequence $y1, y2, dots, yn$ such that when we XOR them elementwise, the resulting sequence $$ai = xi oplus yi$$ has a monotone bit-structure: every bit that is set in $ai$ must also be set in $a{i+1}$.
Two programmers are contributing edits to the same file, but their work histories are interleaved in time. We are given two ordered sequences of actions, one for each person. Each action is either an insertion at the end of the file or an edit of an existing line.
We are given a string and we need to decide whether it could have been constructed by a very specific process that builds strings from left to right choices.
We are working on an infinite grid where movement is allowed in four directions: up, down, left, and right, each costing one step. We are given three special cells: a start cell, a target cell, and a forbidden cell that cannot be stepped on.
We are given a multiset of original strings and a second multiset formed after a disturbance process. The disturbance worked in two stages. First, all strings were paired except one special string that stayed unpaired.
Two players give us two arrays of equal length. One array can be modified by repeatedly moving a single unit from one position to another position. Each move removes one from index i and adds one to index j, and the array must remain non-negative after every move.
A single person moves deterministically along a number line: starting from position $x$ at time $0$, his position at time $t$ is exactly $x+t$.
We are given a person who moves deterministically along a number line: starting at position $x$ at time $0$, and then increasing position by exactly one unit per second. So at time $t$, the person is at $x+t$.
We are given $2n$ permutations of size $n$. Each row is a rearrangement of numbers $1$ to $n$. We are promised that there exists a hidden structure behind these rows: they originally came from two intertwined Latin squares of size $n$, but then the rows were shuffled.
We are given a binary string of length $n$, where each position either contains a pawn or is empty. The board is a line, and pawns can move only in a very constrained way: a pawn can “jump” two cells left or right, but only if the intermediate cell is occupied and the…
The input describes a graph that is guaranteed to be a permuted hypercube. This means the graph has exactly $2^n$ vertices, every vertex has degree exactly $n$, and the structure is isomorphic to the standard $n$-dimensional hypercube, but the vertex labels have been…
We are repeatedly running a stochastic process that evolves a small probability distribution over three outcomes. At any moment there are up to three “active” slips, one of which is a terminal success state (the pink slip) and the other two are transient states.
We are given a list of non-negative integers where each value represents how many cars sit on a segment of a road. The “cost” of the whole configuration is defined by comparing every pair of segments and summing the absolute difference of their car counts.
We are given many queries. Each query provides a very large integer $n$, and we consider every integer $i$ from 1 to $n$. For each $i$, we define a function $f(i)$ as the smallest positive integer that fails to divide $i$.
We are effectively watching a number grow from l to r by repeatedly adding one, and we want to measure how “violent” each increment is in terms of decimal digit changes.
We are given a row of stones, each stone having a distinct strength value. In one move, we are allowed to remove only one of the two boundary stones, either the leftmost or the rightmost remaining stone.
We are given a grid where some cells are forced to be zero and the rest are flexible cells that may take any non-negative integer value.
We are given a sequence b which is claimed to come from a hidden process involving another array a. The process builds a step by step in odd lengths: at step i, we look at the first 2i-1 elements of a, compute their median, and store it as b[i].
We are given a binary string made only of the characters D and K. For every prefix of this string, we want to determine how finely we can split that prefix into contiguous pieces such that every piece has the same internal balance between D and K.
We are given a short lowercase string and asked to find a very specific “missing pattern” inside it. The task is to identify the shortest possible string over lowercase letters that does not appear anywhere as a contiguous substring of the given input.
We are given a small set of distinct integers and are allowed to add new distinct integers to it. The goal is to build a final set such that it satisfies a very strong closure property: whenever we pick any two numbers from the set, the absolute difference between them must…
We can view the situation as a two-layer directed routing process between two bipartite sets of nodes. One set corresponds to sights in Saratov, the other to sights in Engels.
We are given a small grid of biome “types”, where each type is identified by a pair of parameters coming from a fixed $n times m$ table. Some of these pairs exist and are assigned a unique integer identifier, while others are unavailable.
We are working with a grid of uppercase letters, but the alphabet is extremely small: only the first five letters appear.
We are given a fixed collection of strings, all of the same length, and we are asked to answer many queries about a slightly longer string. Each stored string has length $m$. Each query string has length $m+1$.
We are given a circular arrangement of sweets labeled from 1 to n. Each sweet is either “liked” or “not liked”. Anya performs a deterministic process that removes sweets one by one from the circle. The process has two phases in every test case.
Vika arrives in Bertown on a fixed day $k$. She has several friends, and each friend offers a single continuous interval of days during which she can stay at their home.
We are given several test cases, each consisting of a sorted array of distinct integers. Think of these numbers as fixed points on a number line. A query point $y$ is chosen, and a function returns the closest point in the array to $y$ based on absolute distance.
We are given a multiset of strings that all come from a single unknown string of length $n$. For every length $k$ from $1$ to $n-1$, we are given exactly two strings of that length, and each of those two strings is either a prefix or a suffix of the hidden string.