brain
tamnd's digital brain — notes, problems, research
41650 notes
We are given a string made only from the first six lowercase letters. We are allowed to rearrange its characters arbitrarily by swapping any positions any number of times, so effectively we can treat it as a multiset of letters with full permutation freedom.
We are given a road split into $n$ unit segments, and each segment has a “base fatigue cost” $ai$ that applies when Leha starts a fresh driving session.
We are working with a rooted tree where vertex 1 is considered the root. For every vertex $x$, we conceptually look at all nodes in its subtree and group them by their distance from $x$ in terms of edges downward in the tree.
We start with an array of length $n$ that initially contains only zeros. Bob performs $m$ operations. Each operation is defined by a pair $(x, d)$, and Bob is allowed to pick a center position $i$ in the array.
We are asked to build a simple undirected graph on vertices numbered from 1 to n. The graph must have exactly m edges, must be connected, and must avoid both self-loops and repeated edges.
We are given a string made only of digits 0, 1, and 2. We are allowed to repeatedly swap adjacent pairs if they are 0 and 1 in either direction, or 1 and 2 in either direction.
The shop presents a line of games, each with a fixed price, and Maxim walks through them strictly from left to right.
We are given a 3D calendar system where every moment is uniquely identified by a triple consisting of a month, a day inside that month, and a second inside that day.
We are given a rooted tree where the root is fixed at vertex 1 and every vertex has at most two children. After a process of “pruning”, we keep a connected set of vertices that must still contain the root.
We are given a set of banknotes, each with a fixed positive value. Natasha can use any number of each type of banknote, including zero, so in effect she can form any total sum that is a non-negative integer linear combination of the given values.
The structure we are given is a rooted tree where every node behaves like a logic component. Leaves are fixed boolean inputs, while internal nodes compute boolean values from their children using standard gates such as AND, OR, XOR, and NOT.
We are trying to determine an unknown integer $x$ in the range from 1 to $m$, but we are not allowed to see it directly. Instead, we can probe it by asking queries with a chosen number $y$.
We are given a fixed route of space travel that starts at Earth, visits several intermediate planets in order, reaches Mars, and then returns back to Earth.
We are given a multiset of characters, each character representing a rocket stage with an intrinsic cost equal to its position in the alphabet.
We are given a collection of food packages, each labeled by a type. There are also $n$ participants in an expedition, and time is measured in days. Each day, every participant consumes exactly one package.
We are given a small collection of trips, each with a fixed start day and duration, and for each trip a visa process time that determines how long a passport is tied up after an application. Gleb has at most two passports, and each visa must be assigned to one of them.
We are given an array of integers and allowed to rearrange it using a very specific primitive: we can take any set of indices and rotate the values sitting at those positions cyclically.
We are given two binary strings, each consisting only of the characters a and b. The only allowed operation is to choose a prefix of the first string and a prefix of the second string, then swap those prefixes in a single move.
We are given a line of hills, each with a fixed initial height. We are allowed to repeatedly pick any single hill and decrease its height by one unit per operation.
We are given an $n times m$ grid where each cell is a distinct chemical element. Some of these cells are already available in the laboratory. From any three elements forming three corners of an axis-aligned rectangle, the scientists can always synthesize the fourth corner.
We are given a multiset of numbers of size 2n, and we are told that these numbers originally came from n points in the plane, where each point contributes exactly two integers: its x-coordinate and its y-coordinate.
We are given a list of integers and a special integer x. The only allowed transformation is choosing an index and replacing that element with its bitwise AND with x. This operation can only decrease bits, since AND can only turn 1 bits into 0 depending on x.
We are given two snapshots of the same system of stone piles. In the first snapshot, each pile has some number of stones, and in the second snapshot the piles have different counts.
The grid contains two kinds of cells, filled and empty. We are allowed to place geometric objects called stars, where each star consists of one central filled cell and four straight arms extending in the four cardinal directions.
We are asked to build full valid bracket sequences of length 2n, and we want to count how many of those sequences contain a given string s as a contiguous block somewhere inside them. So conceptually, imagine all balanced parentheses strings of fixed size 2n.
We are standing at the leftmost house in a long line of houses numbered from 1 to $n$. We must perform exactly $k$ moves, and each move consists of jumping from our current house to any different house.
We are given a rectangular grid filled with two types of cells, occupied cells marked as and empty cells marked as .. The task is to explain the grid as a superposition of geometric objects called stars.
We are given a collection of songs, each with an original size and a smaller size if we choose to compress it. All songs must be copied onto a flash drive whose total capacity is fixed. The only decision available is which songs to compress.
We are given two strings of equal length, where one string represents a starting arrangement of characters and the other represents a target arrangement. The only allowed operation is swapping two adjacent characters in the starting string.
We are given a one-dimensional number line from 1 to m, and several closed intervals placed on it. Each interval covers every integer point between its endpoints, including both ends.
We are given a list of candidate values, and we want to count how many ordered pairs of candidates can simultaneously support a hidden integer value $v$ under two arithmetic constraints involving gcd and lcm with fixed constants $X$ and $Y$.
We are asked to construct a grid of size n by m where each cell contains a non-negative integer. What we know in advance is not the grid itself, but two sets of constraints derived from it: the XOR of every row is fixed, and the XOR of every column is fixed.
We are given a weighted tree whose nodes are cities and whose edges are existing roads with travel times. The structure guarantees a unique simple path between any two cities, so distances are well-defined tree distances.
The task revolves around a point light source moving horizontally at a fixed negative height, and a set of disjoint segments lying on the x-axis that act as obstacles.
We are given a grid with two rows and $n$ columns. Each cell contains a value that represents how many mushrooms grow per minute in that cell. Vasya starts at the top-left cell and must move every minute to a neighboring cell sharing an edge.
We are given a base string $s$ and a pattern string $t$, both made of lowercase letters. The task is to answer many independent queries, where each query asks: inside a given substring of $s$, how many times does $t$ appear as a contiguous substring?
We are simulating how writing progresses through an infinite notebook where each page can store a fixed number of names.
We are given a shelf containing an ordered sequence of films, where each film has a “type” or ending label from 1 to m. This initial sequence is fixed and indexed from 1 to n.
We are working with a rooted tree where vertex 1 is the root, and every node is initially colored white. Over time, we apply three kinds of operations that either flip colors, reset parts of the tree, or ask for the current color of a node.
We are asked to evaluate a number-theoretic sum over all integers from 1 to $n$, where each integer contributes a value defined through its prime factorization. For a number $x$, we factor it as a product of primes $x = prod pi^{ai}$.
Each engine is a finite set of points in the plane, and we are allowed to rigidly move each set independently before they interact. Rigid motion here means we can translate and rotate a set arbitrarily, but not deform it.
We are given a collection of binary strings, all of the same fixed length $n le 12$. Each string in this collection appears with multiplicity, so duplicates matter. Alongside this, every position $i$ has a non-negative weight $wi$.
We are given two binary strings of equal length. You are allowed to pick any two positions in the first string and swap their bits. The second string stays fixed.
We are given a number $n$, and we must construct a permutation of the integers from $1$ to $n$. Among all such permutations, we are asked to minimize a quantity defined on the permutation. This quantity is the sum of two classical subsequence measures.
We are given a class of students, each identified by a unique integer id starting from 1. Every student has four exam scores corresponding to different subjects. The task is to rank all students by their total score across the four subjects.
We are given a tree where each edge represents a bidirectional road between two houses. Every road has two parameters: a base traversal time and a rate at which it worsens each day. On day $t$, the cost of an edge becomes a linear function $bi + ai cdot t$.
We are given a set of points on a plane, each point representing a city. The task is to select three distinct cities such that the triangle formed by them has a prescribed area $S$. If no such triple exists, we must report failure.
We are given a circle of $n$ students, where $n$ is even. Each student holds an unknown integer, and the only structural guarantee about these values is local: any two neighbors on the circle differ by exactly one in value.
We are given a directed graph with up to one million vertices and one million edges. The task is to choose a subset of vertices $Q$ with two properties that interact in a non-trivial way.
The election has a fixed set of voters, each initially committed to one of several parties. The United Party is party 1, and its goal is not just to get a lot of votes, but to strictly outperform every other party in final vote count.
The building can be thought of as a grid of points arranged in $n$ vertical columns (towers) and $h$ horizontal levels (floors).
We are given a directed structure over students where each student points to exactly one other student. This forms a functional graph: every node has outdegree one, so starting from any node and repeatedly following pointers eventually forces us into a cycle.
We are given a weighted tree where each edge represents a river with a travel time. Fish can move continuously along these edges: traversing an edge of length $l$ takes exactly $l$ days, and fish may also wait arbitrarily at vertices.
We are given a connected graph with two types of edges. One set is already fixed by a competitor, each with a known cost. The second set is ours: these edges form a forest, and we are allowed to assign any integer weights to them.
We are given a final array of length n that was produced by repeatedly painting segments with increasing labels from 1 to q. During the i-th operation, a chosen segment is overwritten entirely with value i, and later operations can overwrite earlier ones.
We are given an unknown $n times n$ grid where each cell is either open or blocked. Movement is only allowed from a cell to its right neighbor or its bottom neighbor, and only if the destination cell is open.
We are given a pattern string s and a target string t. The pattern looks almost like a normal string of lowercase letters, except that it may contain a single special character .
We are given a correctly balanced bracket sequence, meaning every prefix of the string never has more closing brackets than opening ones, and in total the counts match perfectly.
We are given a range of toy prices that is completely regular: there are toys priced from 1 up to n, each integer price appearing exactly once. We want to count how many distinct unordered pairs of different toys have a combined price exactly equal to k.
We are given a system of startups arranged into a structure where some startups are already “active” and others are “acquired” and attached to exactly one active startup.
We are given an $n times n$ grid and $m$ identical-sized cubes, each having a unique color. Each cube starts on a distinct cell, and each also has a target cell where it must eventually be placed.
We are given a set of points in the plane with two strong structural guarantees: no two points coincide and no three are collinear. From these points we can form triangles by choosing any three vertices, and every such triangle is non-degenerate.
We are given a sorted list of distinct integers, and we want to build a binary search tree using exactly these values as node keys.
We are given a binary string made of two symbols, black and white, and we want to extract a long contiguous segment that alternates perfectly between the two colors.
We are given a collection of pairs of integers. From each pair, we are allowed to pick exactly one number. After making one choice per pair, we obtain a multiset of selected values. The task is to find an integer greater than 1 that divides every chosen value.
We are given a string representing the colors of a line of puppies, where each character is a color from 'a' to 'z'. The goal is to determine whether we can transform this string so that all characters become the same, using a very specific operation.
We are given a collection of tasks, each task representing an exam that must be scheduled on exactly one of two possible days. For exam $i$, there are two candidate days $ai$ and $bi$, and we must choose one of them.
We are given a system of rooms labeled from 0 to $m-1$. A token, called the x-mouse, starts in an unknown room and evolves deterministically: if it is in room $i$, after one second it moves to $i cdot x bmod m$.
We are counting binary matrices of size $n times n$, where each cell is either black or white, but with two structural restrictions. The first restriction is a strong symmetry condition called “beauty”.
We can think of the dorm as a directed graph where each room has exactly one outgoing edge. From every room i, the mouse deterministically moves to a[i] after one second.
We are given several independent sets of stick lengths. For each set, we need to pick exactly four sticks such that they form a rectangle, meaning we need two equal pairs of lengths: one pair for the height and one pair for the width.
We are given several independent strings. Each string has even length, and every character is a lowercase English letter. For each character, we are forced to modify it exactly once, and the modification rule is fixed: we can only move one step in the alphabet either down or up.
We are working with an $n times n$ grid whose cells are filled with the numbers from $1$ to $n^2$, but not in a simple linear order. Instead, the grid is split into two disjoint groups of cells based on the parity of the sum of coordinates.
We are given a long array, and we repeatedly answer queries on subsegments of it. For each query range, we are allowed to slightly modify numbers in that segment by multiplying or dividing by primes, where each such operation changes a number by a single prime factor.
We are trying to identify an unknown integer $x$ in a very large range from $1$ to $M = 10004205361450474$. Instead of asking direct yes or no questions, we are allowed to submit up to five queries, where each query is an increasing list of integers.
We are given a cyclic structure of length $n$, where each position in the hidden array $a$ produces an observed value $bi$ through a modulo operation with its next neighbor.
We maintain a dynamic set of points on the integer grid. The set changes over time through insertions and deletions.
We are given a chronological log of events in a trading system where orders are inserted and then later executed. Each order has a unique price and, when it is created, it could be either a buy order or a sell order, but this direction is not recorded in the log.
We are given a collection of axis-aligned rectangles on a 2D integer grid. Each rectangle is described by its bottom-left corner and top-right corner, and it includes its boundary as well as its interior.
We are asked to construct two positive integers, call them $a$ and $b$, such that their digit sums are both large enough, while the digit sum of their sum is kept small.
We are given a grid of size $n times m$ consisting of two types of cells, white and black. Initially the entire grid is white, but at some point a single square region with an odd side length was painted black. That square is axis-aligned and fully filled with black cells.
We are given a tree where vertex 1 plays a special role: it is the root of our concern. The structure is initially fixed, but we are allowed to add new edges between any two previously unconnected vertices.
We are given a list of positive integers and a modulus $k$. For every ordered pair of distinct indices $(i, j)$, we form a new number by writing $ai$ directly followed by $aj$ in decimal representation. We need to count how many such ordered concatenations are divisible by $k$.
We are given two counts, $a$ red tiles and $b$ blue tiles, and we must place them on an infinite grid so that all colored tiles together form a single axis-aligned rectangle of area $a+b$.
We are given a collection of segments on a number line, and we want to understand how much they overlap if we remove exactly one of them.
We are given a sorted list of distinct problem difficulties. From this list, we must choose a subsequence, not necessarily contiguous, that will form a contest.
We are given a pattern string t of length n and a target number k. We need to build a new string s as short as possible such that when we slide a window of length n across s, the pattern t appears exactly k times as a substring.
We are given a fixed line of cells where each box sits at a distinct integer coordinate. Each box also has a weight, and that weight determines how expensive it is to move that box one step left or right.
We are given a system that evolves an $n$-dimensional vector over discrete steps. Each coordinate evolves independently using the same type of rule: a linear transformation modulo a prime.
We are given an array of integers, and we need to count how many contiguous subarrays have a special property. A subarray is considered valid if we can “rearrange bits inside each number independently” by swapping any two bits in its binary representation any number of…
We are working inside an integer grid that forms a rectangle from the origin to the point $(n,m)$. We need to pick three lattice points inside or on the border of this rectangle and form a triangle whose area is exactly $frac{nm}{k}$.
The task is to classify points in a plane relative to a fixed geometric region defined by four boundary points: $(0, d)$, $(d, 0)$, $(n, n-d)$, and $(n-d, n)$.
We are given a sequence of digits written as a single string. The task is to decide whether we can split this sequence into several consecutive parts, at least two parts, such that every part has exactly the same sum of digits.
We are given a small group of people, each giving a binary opinion about a single problem. Each response is either 0, meaning the person considers the problem easy, or 1, meaning the person considers it hard.
Stopped thinking
We are given a binary array and a single operation that flips exactly three positions, but those three positions must form an arithmetic progression.
We are given two arrays of length $n-1$. Each position $i$ describes a relationship between two unknown consecutive values $ti$ and $t{i+1}$, where each $ti$ is an integer in the range $[0, 3]$, meaning we can treat every value as a 2-bit number.
Lesha has two separate time budgets, one for today and one for tomorrow. Each lecture note has a fixed reading cost equal to its index: note 1 takes 1 hour, note 2 takes 2 hours, and so on.
We are given an $n times n$ grid of lowercase letters. We are allowed to modify at most $k$ cells, changing their letters to any lowercase character we want.
We are working with a rectangular grid of size $w times h$, where each cell can be thought of as a unit square on a plate. We repeatedly draw “rings” of gilding on this grid. The first ring covers the outer border of the whole rectangle.