brain
tamnd's digital brain — notes, problems, research
41641 notes
Each student in the class has two separate sets of attributes: one for each semester. For each semester, we care about three scores: intelligence, morality, and sports. The sum of these three defines that semester’s “comprehensive score”.
We are given two permutations of the integers from 1 to n, but they are stored as arrays indexed by positions. Each query selects a contiguous segment of indices in the first permutation and another contiguous segment in the second permutation.
We are given a base string s and we construct a much longer string T by concatenating m copies of s back to back. So T = s + s + ... + s. The task is to compute how many distinct substrings appear anywhere inside T.
We are given a binary string, and we interpret it as a sequence where only the 1 characters matter. Every maximal contiguous block of 1s forms a segment, while 0s act as separators that break the string into independent segments.
We are given an array of non-negative integers. We are allowed to choose a single integer x in the range from 0 to k, and we apply XOR with x to every element of the array. After this transformation, we require the resulting array to be non-decreasing.
We are given a rooted tree on $n$ labeled nodes where every node except the root has exactly one parent, and parents always have smaller indices than children.
We are asked to count how many different Aho-Corasick automata could have produced a certain final shape, under very limited structural information. An Aho-Corasick automaton in this setting is built from two intertwined objects.
We are given a permutation, and we are allowed to split its elements into two subsequences while preserving original order inside each subsequence. One subsequence is called A, the other is B.
We start with a list of integers, and we are allowed to repeatedly expand it by taking any neighboring pair and inserting a value derived from them using bitwise operations: AND, OR, or XOR.
The city can be modeled as a directed complete graph where every location is a node and every ordered pair of nodes has a travel time. Each node also has a non-negative value representing how many tourists stand there.
In triangle $ABC$, we seek a point $D$ on the side $AB$ such that
The corrected argument begins by rechecking the structure of the process itself rather than inheriting any assumption from the flawed solution.
A direct “vertex–angle ≥ 60°” charging argument cannot be repaired by any local bound of the form “at most a fixed fraction of pairs at a point subtend angle ≥ 60°”, since configurations can be made e…
We are given three target order statistics extracted from an unknown multiset of integers: a value that is supposed to act as the median position at 50 percent, another that corresponds to the 95 percent cutoff, and a final one for the 99 percent cutoff.
We are given a collection of distinct integers. You can repeatedly perform an operation where you pick a number larger than 1 from the current collection, remove it, and replace it with one of its proper divisors.
The system is simulating a live competition that produces a stream of server logs while a contest is running. There are several levels, and at any moment only one level is “active”, determined by the most recent log of type 1.
We are given a sequence and we want to understand, for each possible block size $k$, whether a very specific partitioning of the array behaves nicely. The array is cut into consecutive segments of length $k$, except possibly the last segment which may be shorter.
We are given a large integer written in decimal form. For each such number, we consider all ways to cut its decimal representation into two non-empty parts. Each cut produces two strings, which we interpret again as integers by reading them in base 10.
We are given a tree, so every pair of nodes is connected by exactly one simple path. Alongside this structure, we consider many possible connected subgraphs, meaning we choose some set of nodes and edges from the tree such that everything stays connected.
We are given a binary string consisting of two symbols, and -. We start from a blank canvas of the same length filled with , and we are allowed to perform painting operations.
We are given a 10×9 chessboard and a hidden piece that belongs to one of six movement types inspired by Chinese chess. We do not know its type or its position.
We are given a permutation p of size n. The task is to construct another permutation q of the same numbers such that no position keeps its original value, meaning for every index i, the value q[i] must differ from p[i].
We are interacting with a hidden number $x0$, but we never see it directly. Instead, there is a second evolving value $x$ that starts equal to $x0$. We can issue three kinds of interactive commands. One asks whether the current $x$ is divisible by a chosen number $a$.
We are given a rectangular grid with n rows and m columns, and a collection of k bottles of iced tea, each with a fixed price. The task is to place some or all of these bottles into distinct grid cells, with at most one bottle per cell.
The train moves along a fixed horizontal ray that starts at a given point and continues infinitely to the right. Every danger zone is a circle on the plane, and whenever the train’s path passes through a circle, we count only the portion of the train’s path that lies inside…
We are asked to count how many Olympic events happen inside a year interval. The key detail is that there are two independent sequences of events: Summer Olympics and Winter Olympics. Each follows a strict periodic pattern.
We are given a group of contestants in a programming contest. Each contestant has solved a set of problems, and this set is encoded as a string of distinct uppercase letters from A to Z. The length of the string is the number of solved problems.
We are given a sequence of positive integers. In one operation, we pick two different positions i and j, and replace the value at i with the bitwise AND of the two values, ai becomes ai & aj.
We are given a sequence of integers representing heights. In one move, we choose any position and decrease that single value by one. We may repeat this operation up to k times.
The task describes an array purely as a way to motivate indexing from zero. If an array has length $n$, its valid indices run from $0$ up to $n - 1$. The problem then asks us to output the index of the last element of such an array when only the length $n$ is given.
We are simulating a fairly involved single-player process on a fixed 3×3 grid where items are placed one by one from a given sequence. Each grid cell either holds a “turtle” of some color or is empty.
We are looking at a modified calendar where each year is classified as either a training year or a rest year. Starting from the year 2024, the character gains exactly one unit of progress in every training year, while rest years contribute nothing.
Each student has two components in their grade: a fixed exam score and a controllable continuous assessment score. For student $i$, the current total is $xi + yi$, where $xi$ is the coursework score capped at $a$, and $yi$ is the exam score capped at $b$.
We are given a large integer $x$ (up to $10^{18}$). For each such number, we may split its decimal representation into two non-empty parts by choosing a cut position in its digit string.
We are given one or more arrays. For each array, we look at every contiguous subarray and assign it a value based on a simple rule: take the maximum element inside the subarray, count how many times this maximum appears, and if that count is at least k, the subarray…
We are given a set of $n$ distinct points in the plane, revealed one by one in order. At the moment a point appears, it becomes “active”.
We are given a long piece of text that represents a story. The text contains words mixed with spaces and punctuation marks such as commas, periods, exclamation marks, and question marks.
The configuration places strong orthogonality constraints: the projection of $D$ onto the plane $ABC$ is the orthocenter of $\triangle ABC$, and at the same time $\angle BDC$ is a right angle.
We are given several independent scenarios. In each scenario, Baq owns a collection of coins, each coin having a positive integer value. Using any number of these coins, he can form sums by choosing a subset and adding their values.
We are given a set of people connected by two kinds of relationships. Each person must be assigned one of two roles, which we can think of as either being a witch or not being a witch. The relationships impose constraints on these assignments.
We are given several independent scenarios along a street. In each scenario, there are fixed positions where people stand, and a set of streetlights, each placed at some coordinate and each able to illuminate a symmetric interval around itself determined by its radius.
We can model the situation as a directed graph on $N$ nodes, one node per person. Each person $i$ keeps one key for their own room and deposits a second key into the room of person $ci$.
We are given a tree where each vertex is colored either 0 or 1. In one move, we are allowed to choose a set of vertices that forms a connected subgraph in the tree and such that all chosen vertices currently share the same color.
We are given a set of points on a number line, each point initially holding one chicken. Two chickens are considered connected if we can move from one position to the other using a sequence of jumps, where each jump must be strictly shorter than a chosen value $k$.
Something went wrong while generating the response. If this issue persists please contact us through our help center at [help.openai.com](https://help.openai.com/).
The flawed solution failed because it tried to force a “singleton prime contribution” without proving it, and it confused “a prime factor appears once” with “its valuation contributes an unavoidable o…
We are given a sequence of daily temperatures covering a vacation of length $n$. We must choose a continuous block of exactly three consecutive days: the first day is hiking up to a lake, the second day is rest (ignored for heat considerations), and the third day is hiking back.
We are inside an unknown rectangular dungeon made of grid cells. Each cell is either a wall or a walkable space, and the walkable space has a special twist: there can be up to two trapdoors that behave like hidden teleporters.
We are given the last animal name spoken by the previous player and a pool of unused animal names. A valid move for us must satisfy a chaining rule: the new name must begin with the last character of the previous name, and it must not have been used before.
We are given a set of identical units called gnomes, and we must split them into at most a fixed number of groups before the process starts.
We are given a positive integer $n$. We look at all ways to pick two positive integers $p$ and $q$ such that their product divides $n$, and additionally $p le q$. For each valid pair, we compute a value $r = frac{p}{q}$.
We are given a string indexed from 1 to n. We look at pairs of indices $(l, r)$ with $l le r$. Each such pair defines a substring $s[l..r]$, but we only accept it if the endpoints are coprime, meaning $gcd(l, r) = 1$.
We start with an array of integers. In one move, we are allowed to pick a contiguous segment and add the same value to every element in that segment. We may also choose not to perform any move at all.
We are given an array consisting only of 1 and -1. We must split the indices of this array into k groups. Each group is treated as a subsequence in the original order, meaning we keep relative order but do not require contiguity.
We are given an array of length 2n. We repeatedly pick two adjacent elements in the current array, remove them, and gain a score equal to the absolute difference of those two values. After doing this exactly n times, the array becomes empty.
We are working with a connected, unweighted, undirected graph. Every vertex has two values attached to it, $au$ and $bu$. The task only cares about vertices that are directly connected to vertex $1$.
We are given a collection of $n$ cubes, each cube having six visible digits. Each cube can be oriented so that any one of its six faces becomes the top face, which means that for every cube we can choose any one of its six digits as the digit it contributes.
We are given a permutation of all integers from 0 to n − 1, where n is a power of two. The goal is to transform this permutation into sorted order using two types of operations.
We are given two sequences, each acting like a stack where only the last element is accessible. Every value from 1 to k appears exactly twice across both sequences, so each number forms exactly one pair of occurrences scattered between the two stacks. Two players alternate moves.
We are given an array of integers and asked to construct a permutation π of indices from 1 to n such that pairing each position i with π[i] makes all sums ai + aπ[i] identical across every index i.
We are given two finite point sets in the plane. One set represents the stars in a new photograph, the other represents stars in an old photograph. We are allowed to translate the new photo by a vector $(tx, ty)$, without rotating or scaling it.
We are given a set of students where some pairs are known to have exchanged homework. Each report is an undirected edge between two students, meaning those two are connected in a “cheating interaction” graph.
The network of Zurich stations forms a tree, so between any two stations there is exactly one simple path. On top of this static structure, there are several trams.
We are dealing with a hidden permutation of positions from 1 to n. Whenever we send a word of length n, the system rearranges the letters according to this fixed permutation and returns the result.
We are dealing with a hidden integer-coefficient polynomial $P(x)$, but we never evaluate it directly. Instead, we interactively query an index $k$, and the judge tells us how many values among $P(1), P(2), dots, P(k)$ are divisible by $k$.
We are given a straight street represented as a continuous segment from 0 to L. There are n fixed lamp posts placed at integer coordinates along this segment. We are not allowed to choose their positions, only the type of bulb installed in each lamp post.
We are given a number $n$, and we consider every integer $x$ from 1 up to $n$. For each number $x$, we compute a value formed by multiplying all its decimal digits. If a number contains a zero digit, its digit product becomes zero.
We are given a system that allows us to construct new bitsets from an initial bitset $B0$. Each bitset has length $n$, and we can generate new ones using only a small set of operations: shifting left or right, XOR, and OR between previously constructed bitsets.
We are given a tree with $n$ nodes. A “move” in this problem is not about edges or nodes directly, but about choosing a simple path between any two nodes in the tree.
We are deciding how to distribute a fixed working day of length $m$ across $n$ crop types. Each crop $i$ gives a linear profit: every unit of time spent on it contributes $wi$ profit.
We are given a vehicle that can consume energy from multiple batteries while moving forward on a number line. Each battery starts fully charged and contributes a fixed amount of usable distance, one unit of charge equals one kilometer.
We are given a long sequence that is not stored explicitly as an array, but described as runs of equal values. Each run contributes a block of identical elements, so the original sequence can be seen as a compressed array of length $L$, where $L$ can be extremely large.
The expression for $b_n$ involves weighted increments of the nondecreasing sequence $(a_k)$, with each term having the structure
We are given an undirected graph where vertices represent participants and edges represent mutual acquaintance. The goal is to “activate” all participants in an online meeting that starts with exactly one creator and then grows by invitations along acquaintance edges.
We are given a set of particles on a line. Each particle starts at a coordinate and has a fixed weight, which can be positive or negative.
We are working with a very thin grid, only two rows and many columns. From any cell, movement is constrained: you can always move to the cell immediately to the right in the same row, and from a cell in the top row you may also drop vertically into the cell directly below it…
We are given a set of points in the plane, with the promise that no three lie on a straight line. From these points we may choose any subset and arrange the chosen points in some cyclic order to form a simple polygon.
We are given a sequence of movement instructions on an infinite grid. Each instruction tells us to move in one of the four absolute directions, north, south, west, or east, and to go a certain number of intersections in that direction.
We are given several independent typing sessions. In each session, Professor Oak produces a long text using a very specific two-finger typing model on a fixed keyboard.
We are given a collection of license plates belonging to cars purchased over time by a single owner. Each plate is a fixed-format string: four digits followed by three uppercase letters.
Each test case describes Juan’s attempt to choose a single store from which he will buy three required components for a flying car: an engine, a steering wheel, and a spare tire. Every store offers all three items, but each store has different prices for them.
We are working on an infinite grid where each cell is a unit square. A 1×1×2 cuboid starts in a fixed initial configuration at the origin, and it moves by rolling over one of its edges, like a domino flipping from one face to another. Each such roll counts as one move.
We are given a line of land split into $n$ consecutive segments, each with a fixed height. Over time, the sea level rises in steps, and after each rise we must determine how many connected groups of dry land remain.
We are given a list of class schedules, each represented by a start time and an end time on a single circular day that has m discrete hours.
We are working in a k-dimensional integer lattice. A state is a point with k integer coordinates, and each move changes exactly one coordinate by either +1 or −1. After 2n moves, we want to count how many different sequences of moves bring us back to the origin.
We are given counts of three characters, namely how many times we must use the letters A, B, and C. For each test case, the task is to construct a string using exactly those characters such that the string reads the same forwards and backwards, and among all valid such strings…
Let the common digit string be interpreted in two positional systems with bases $a$ and $b$.
We are given a set of players and a list of pairwise “hate relations”, each with a numerical strength. We need to split all players into two teams. A pair of players placed in the same team is only acceptable if their mutual hate is not “too large”.
We are given a number of points on a line representing mailboxes that must all be “visited” and cleaned, and another set of points representing people who can move along the same line. Each person starts at a fixed coordinate and can move one unit per second left or right.
Two players alternate taking turns from a pile of $N$ candies. The first player starts, and on each move a player removes some number of candies, but only amounts that are powers of two, meaning the move set is $1, 2, 4, 8, 16, dots$.
We are given a set of dishes, each with four nutritional values: proteins, fats, carbohydrates, and calories. Separately, we are given acceptable ranges for each of these four quantities.
We are given a sorted set of objects on a number line: some positions contain zombies moving left, and some contain mushrooms that can reverse a zombie’s direction. A zombie starts in a normal state moving toward decreasing coordinates at speed 1.
We are given an alphabet that is cyclic, numbered from 1 to $C$. A word is just a sequence of these numbers, and we are interested in finding occurrences of a pattern word $W$ inside multiple texts.
The game can be viewed as a directed graph on $n$ vertices, where each vertex $i$ has exactly one outgoing edge to $ai$. Every participant initially sits on a distinct vertex (chair), and during a round they all try to move along the outgoing edge of their current vertex.
We are working in a plane with a vertex that defines an angle and two rays forming its sides. One ray is determined by the vertex and a second point, and the other ray is determined similarly.
We are given a group of $n$ people and want to form teams of exactly three distinct members. However, not every triple is allowed because there are $m$ forbidden pairs of people who cannot appear together in the same team.
We are given a forest represented as an undirected graph with up to one million nodes and edges. Some nodes are initially marked as special, and these special nodes define what it means for a node to be “magical”.
We are given a sequence of flights sorted by their scheduled departure times. Each flight has a time when it ideally wants to use the runway, a payment it offers if it is allowed to depart exactly at that time, and a penalty it imposes if it is not.
The earlier algebraic model failed because it used incorrect expressions for $\frac{r_1}{q_1}$ and $\frac{r_2}{q_2}$ and then attempted to repair the resulting identity through polynomial manipulation…
We are given a fully specified network of islands where every island can either be powered by building a generator on it or by being connected through transmission lines to some other island that eventually has a generator.