brain
tamnd's digital brain — notes, problems, research
41650 notes
We are given a small set of points on a grid, where almost all points lie exactly on the border of an axis-aligned square. Only one point is an exception and lies strictly inside the square. The task is to identify that single interior point. The square is not given explicitly.
Each spaceship has an attack power. Each empire base has a defense value and a gold amount. A spaceship can destroy every base whose defense is not greater than the spaceship's attack power.
We are working on a weighted selection problem over two interacting layers. First, there is a small fixed graph of planets, where distances are measured as the shortest number of wormholes between nodes. Then there is a large set of spaceships and bases placed on these planets.
We are given a string and we want to construct a collection of distinct strings, where each string must be a subsequence of the original.
Each candy belongs to a type. For every type, we know how many candies of that type exist, and among those candies how many have f = 1. We want to build a gift by selecting some candies.
We are given several independent scenarios. In each one, there is a list of product prices, and we are allowed to adjust each price by at most k in either direction, but we are not allowed to adjust it more than once.
We are simulating a sequence of exactly $n$ game turns. At any moment Vova has a battery charge $k$, and each turn he must choose one of two actions that reduce the charge. One action is cheaper in terms of battery loss but can only be used when the battery is sufficiently high.
We are given several independent datasets. In each dataset there is a multiset of positive integers, where each integer represents the “value” of a problem.
We are given several independent candy collections. Each collection is just a multiset of integers, where each integer represents a candy type. From each collection, we want to build a single “gift” by selecting some candies.
We are given a grid of characters representing a picture, where each cell is either empty or filled. The task is to decide whether the filled cells form exactly one plus-shaped figure. A valid plus shape has a single central filled cell.
We are given a function over integers that depends on a scaled angle of a sine wave. For any integer position $x$, we compute an angle proportional to $x$, specifically $frac{p}{q}pi x$, and evaluate the absolute value of its sine.
We are given a sequence defined by a multiplicative recurrence. The first three values are known, and every later value is built from the previous three by multiplying them together and then scaling by a power of a constant.
We are given a collection of words, and we want to group them into as many valid “lyrics” as possible. Each lyric uses four words arranged as two lines of two words each.
Two people hold some amounts of a currency and can optionally transfer integer amounts between each other before spending. Each unit of currency buys one item in chunks of size z, meaning each person independently converts their money into floor(money / z) items.
We are given a set of axis-aligned rectangles that represent “castles”. These rectangles do not overlap in area, although they may share boundaries or corners.
We are given a sequence of past assignments where each of $m$ cities has hosted an event some number of times. After these first $n$ years, a deterministic rule takes over: in every future year, the city that has hosted the fewest events so far is chosen, and if multiple…
We are given a rectangular grid with n rows and m columns, where each cell already has one of three colors. The goal is to repaint some cells so that the final grid looks like a “flag” pattern composed of three horizontal stripes.
We are given an array of integers, and for each position we are allowed to repeatedly apply a transformation that replaces a value $x$ with $-x-1$.
We are dealing with several functions that behave like monotone step counters on a huge integer line. Each function starts at value zero at position zero, ends at a fixed value L at position 10^18, and can only change in a very restricted way: as we move from x−1 to x, the…
We are given a tree with $n$ vertices. Every pair of vertices has exactly one simple path between them. We are allowed to add exactly one extra edge between any two distinct vertices, turning the structure into a graph with one cycle.
We are given an $n times m$ grid, and we start from the top-left cell $(1,1)$. The goal is to produce a complete ordering of all grid cells such that we visit every cell exactly once, starting from $(1,1)$.
We are given a collection of $2n$ stocks. Each stock $i$ has a price that evolves over time in a very simple deterministic way: at integer time $t$, its price is $ai cdot t + bi$. Time starts at $t = 0$, and prices only change at integer moments.
We are working with a rooted tree where every node contributes two values, ai and bi. For any node v, consider the path from the root down to v. Along this path we accumulate the sums of a values and b values separately.
We are given a long strip of length $m$, initially all painted with color $0$. Then colors $1$ through $n$ are applied one by one. Each color $i$ is applied by choosing a segment $[ai, bi)$ that is currently monochromatic, and repainting it with color $i$.
We are tiling a rectangular grid of size $w times h$, where each cell must contain one square tile. Each tile is a square split along a diagonal into a black and a white triangular half.
We are asked to construct a simple undirected graph on exactly $n$ vertices. We are free to choose any edges as long as we avoid self-loops and duplicate edges. The graph must satisfy two number-theoretic constraints at the same time.
We are given a long string formed only from the letters a, b, and c, with the restriction that no two adjacent characters are equal.
We are given a single positive integer $k$, and we imagine writing all positive integers in order, starting from 1, directly next to each other without spaces or separators. This produces one continuous digit stream like 12345678910111213... and so on.
We are given an undirected connected graph for each query, and we must select a subset of vertices such that every vertex we do not select has at least one selected neighbor. In other words, every unchosen vertex must be “covered” by an adjacent chosen vertex.
We are given an unknown array of integers. Each original value is between 2 and 200000. From this hidden array, a second array is produced by expanding every element into two values and then shuffling everything.
We are given a long sequence where every element is guaranteed to be one of six fixed values: 4, 8, 15, 16, 23, 42. The task is not to reorder or modify values, only to delete elements so that what remains can be partitioned into complete ordered chains of length six.
We are given several independent arrays. In each array, we are allowed to repeatedly take any two elements, remove them, and insert their sum back into the array. Each operation reduces the number of elements by one while preserving the total sum.
We are given a sequence of numbers and we must cut it into exactly $k$ consecutive parts, where each element belongs to exactly one part and parts preserve order. Once the partition is fixed, every element gets a label equal to the index of the segment it lands in.
We are given a tree with nodes numbered from 1 to n, rooted at node 1. Inside this tree, there is a hidden node x.
We are asked to build a sequence of integers, each lying in the range from 1 up to $2^n - 1$, with a very specific restriction on its contiguous segments.
We are given a multiset of integers of size exactly twice some number n. The task is to rearrange these values into a new order such that if we split the reordered array into two consecutive halves of length n, the sum of the left half is different from the sum of the right half.
We are asked to assign a label to every integer from 2 up to n. These labels are positive integers, and they must satisfy a strong interaction rule: whenever two numbers share no common divisor greater than 1, meaning they are coprime, their assigned labels must be different.
We are asked to place numbered pieces from 1 to n onto an m by m grid. Each piece i is placed at a cell with integer coordinates.
We are working with a system of pictures where each picture has a weight that controls how likely it is to be shown when we visit a website. At any moment, the probability of seeing picture $i$ is its weight divided by the total weight of all pictures.
Two trains move on a circular line with stations labeled from 1 to n. One train moves clockwise, increasing station numbers modulo n, while the other moves counterclockwise, decreasing station numbers modulo n.
We are given a multiset-like array of length $2^k$, where every value lies in the same range as indices of permutations of size $2^k$.
We are given a binary string and we look at all possible contiguous substrings. For each substring, we want to know whether it contains a pattern of three equally spaced positions where all three characters are identical.
We are given a circular-valued array where each element lies in the range from zero up to some fixed modulus minus one. One operation consists of choosing any subset of positions, and incrementing all chosen values by one with wraparound at the modulus boundary.
We are given a valid parentheses string. Think of it as a walk that starts at height 0, where every opening bracket increases the height by 1 and every closing bracket decreases it by 1, and the walk never goes negative and ends at 0.
We are given a string of digits and we are allowed to delete characters freely, without changing the relative order of the remaining digits. The task is to decide whether we can extract a subsequence of length exactly 11 that forms a valid telephone number.
The task describes a growing undirected graph where each edge also carries a color. Edges only ever get added, never removed. Interleaved with these updates are connectivity queries, but connectivity is not defined in the usual sense of arbitrary walks.
We are given a starting value a, an ending value b, and a parameter m. We need to decide whether we can construct a sequence of positive integers that begins at a, ends at b, and grows in a very specific cumulative way.
We are given a list of student names and we are allowed to split these students into two classrooms. Every student must go to exactly one of the two rooms, and either room may end up empty.
Ivan needs to buy a fixed multiset of items, split into types, where each type requires a certain number of copies. Each day he earns exactly one unit of currency, and he can spend it immediately to buy items in the evening of the same day or save it for later.
We are given a multiset that is supposed to represent almost all divisors of some unknown integer $x$. “Almost all” here has a precise meaning: the list contains every divisor of $x$ except $1$ and $x$ itself.
Ivan needs to acquire a collection of items, where each item belongs to one of several types. For each type, he must buy an exact required quantity.
We are given a list of contests, each with a certain number of problems. Polycarp trains day by day, and on day $k$, he must pick exactly one unused contest and solve exactly $k$ problems from it.
We are given a weighted undirected graph with up to 200,000 vertices and edges. Each edge has a fixed weight, and we care about the shortest path from node 1 to node n using the sum of edge weights. The twist is that we are not solving just one shortest path problem.
We start with a circle of $n$ cats sitting in order, forming a single continuous ring of occupied positions. Then $m$ of these cats leave. After each departure, the circle is no longer fully connected, because empty positions break adjacency.
We are given a set of points on a 2D plane. Each point represents a power pole, and every pair of poles defines a straight infinite line, which we interpret as a “wire”.
We are given two grids of the same size. Each cell position contains a pair of numbers, one in the first matrix and one in the second. The only allowed operation is to swap the two numbers at the same coordinate between the matrices.
We are given a sequence of operations applied to a single pile of stones. Each operation is either adding one stone or removing one stone.
We are given an undirected connected graph with $n$ nodes. Bob starts at node 1 and performs a walk along edges. Every time he enters a node that has never been seen before, he writes it down.
We are given a square grid filled with two possible characters, X and .. The task is to scan every interior cell of this grid and decide whether it is the center of a “cross” pattern formed by diagonals.
We are given a string and a fixed window size $k$. The task is to repeatedly carve out several disjoint blocks of length $k$ from the string. Each chosen block must consist of the same character repeated $k$ times, and all chosen blocks must use the same character.
We are given a rectangular grid where each cell is either blocked, empty, or already owned by one of up to nine players.
We are working on a fixed 4 by 4 board that starts empty. A stream of dominoes arrives one by one, and each domino must be placed immediately when it comes. Each domino is either vertical, covering two cells in the same column, or horizontal, covering two cells in the same row.
We are given a sequence of integers, and we want to assign another sequence of integers of the same length, starting from zero, with very specific structure rules.
We are given a sequence of integers and asked to assign each position one of k labels, which we will call colors. Every position must receive exactly one color. At the same time, every color from 1 to k must appear at least once among all positions.
We are given a string of length $n$, where each position holds one of three symbols: 0, 1, or 2. We are allowed to modify characters, but each modification counts as a replacement cost of 1 per position changed.
We are given a collection of doors, each with an initial durability value. You and an opponent alternate moves for an extremely large number of turns, so the process effectively runs until both players’ optimal strategies stabilize.
We are given a sequence of integers, and we want to cut it into consecutive chunks. Every element must belong to exactly one chunk, and every chunk must be non-empty. After splitting, we look at all possible non-empty collections of these chunks.
We are processing a growing collection of rectangular banknotes. Each time a note is added, it stays forever. Later we receive queries asking whether all notes seen so far can be placed inside a given rectangular wallet.
We are given several independent test cases. Each test case provides a collection of closed segments on a number line. The task is to assign every segment to one of two groups such that no segment in one group overlaps with any segment in the other group.
Each query describes a forbidden interval on the number line and a fixed step size. We are asked to find the smallest positive integer that is a multiple of a given number $d$, but lies strictly outside the interval $[l, r]$.
We are given a tree where each node carries an integer label. For any two vertices, consider the unique simple path between them. Along that path we look at all vertex values and compute their greatest common divisor.
We are given a row of browser tabs indexed from 1 to n. Each tab is either useful for an exam or represents a social media site. This is encoded as an array of length n where each value is either 1 or -1. Roman chooses a step size k. After that, he selects a starting tab b.
We are given an array of values on a line, where each position represents a burger shop and the value at that position is the cost of the most expensive burger available there.
We start with a single integer placed on a board. At each step, this number is replaced by one of its divisors, chosen uniformly at random.
We are given a circular lock that behaves like a 360-degree dial. Starting from zero, we perform a sequence of rotations, each rotation having a fixed magnitude, but we are free to choose its direction: clockwise or counterclockwise.
We are building digit strings of fixed even length using a restricted alphabet of digits. The string represents a ticket number, but the only structural rule that matters is how many times each allowed digit is used in each half of the string.
We are given a final score distribution across $p$ players whose scores are non-negative integers summing to $s$. Hasan is player 1, and his score is only partially constrained: it must be at least $r$, but otherwise unknown.
We are given a string and an integer weight attached to every character position. We are allowed to delete characters, and each deletion costs the weight of the deleted position as it originally appears in the string.
We are working with a regular polygon, meaning all sides and angles are symmetric. The input gives an angle value, and we must decide whether there exists some regular n-gon such that we can pick three vertices $a, b, c$ (not necessarily consecutive) and the angle formed at…
We are given a string that was produced by a very specific “stretched repetition” rule applied to some hidden original string. The original string is short, with length at most 10, but we do not know it.
We are given a binary string of parentheses. Each character is either an opening bracket or a closing bracket. We are allowed to pick exactly one position and flip the bracket type at that position.
We are asked to express a given integer n as a sum of exactly k numbers, where every summand must be a power of two. Each chosen number is therefore of the form 1, 2, 4, 8, ..., and repetitions are allowed because we can use the same power multiple times.
We are given a hidden circular ordering of the numbers from 1 to n. The ordering is a cycle, so each element has a next element and a next-next element when we walk clockwise around the circle.
We are given a partially specified array of length $n$. Each position either already contains a fixed value between $1$ and $k$, or is unknown and marked as $-1$. We must replace every unknown position with a value from $1$ to $k$, producing a fully filled array.
We are given an undirected graph and asked to assign each vertex one value from the set {1, 2, 3}. The assignment is valid only if every edge connects two vertices whose values sum to an odd number. The task is to count how many such assignments exist, taken modulo 998244353.
We are given a weighted tree, where each node carries a positive value. We are allowed to choose any node as a reference point, and for that choice we compute a score defined as the sum over all nodes of their value multiplied by their distance to the chosen node.
We are given a graph that is already a forest, meaning it consists of several disconnected trees. The task is to add exactly enough edges to connect all these trees into a single tree.
We are asked to construct a string for each query such that the string has a fixed length n and uses only the first k lowercase Latin letters, from 'a' up to the k-th letter. Every one of these k letters must appear at least once in the final string.