brain
tamnd's digital brain — notes, problems, research
43815 notes
The construction in this problem generates a sequence of strings where each level wraps the previous one inside a fixed template. The base string, call it $f0$, is a fixed sentence.
We are asked to list special numbers in increasing order and take a prefix sum. A number is considered valid if it reads the same forward and backward in decimal notation and its length is even.
We are given a single long string consisting only of digits. This string is known to come from a correct arithmetic identity of the form a + b = c, but the symbols + and = were removed and the digits were concatenated.
We are given a single non-negative integer, and we are asked to transform it into a nearby number whose last digit is zero.
We are given a string whose characters are indexed from left to right, and a sequence of operations that repeatedly remove certain characters from specified segments of the current string.
We are given several groups of students. Each group has either one student or two students, and these groups are indivisible. The coach wants to form as many teams as possible, where each team must contain exactly three students.
We are given a rational number formed by dividing two integers, and we are interested in its decimal representation after the decimal point. The task is to determine the earliest position where a specific digit appears in that infinite (or terminating) decimal expansion.
We are asked to build a subset of the numbers from 1 to n such that a very specific quantity computed on this subset equals k exactly. The quantity counts ordered pairs of distinct elements (a, b) where a appears earlier in value than b and a divides b evenly.
We start with a single original plush toy and no copies. A machine can be applied repeatedly, and each application changes the inventory depending on what type of toy it is applied to.
We are given two different trees on the same number of cities. One tree describes bus connections between cities labeled from 1 to N. The other tree describes train connections between cities labeled from N+1 to 2N.
We are given the value of the game after two moves, call it $X2$. The game starts from some unknown integer $X0 ge 3$, and two players alternately modify this value.
We are given a sequence of observations over consecutive days. Each day corresponds to a water level, and over time Arkady leaves marks at the distinct water levels he has seen so far. If a water level repeats, no new mark is added.
We are given a pool of servers, each with a fixed capacity measured in resource units. Two independent services must be deployed, and each service can use several servers at the same time.
We are simulating a bank account over a sequence of days. Each day starts with a fixed charge of $p$ rubles applied to the account. On some specific days, before this charge happens, Arkady deposits money into the account.
We are asked to count how many integers in a closed interval $[l, r]$ can be written using only the prime factors 2 and 3. Any valid number must have the form $2^x cdot 3^y$, where both exponents are non-negative integers.
The system simulates a fleet of taxis moving on a large rectangular grid where distance is measured in Manhattan terms, but movement has an additional constraint: whenever a car is instructed to go to a point, it first adjusts its x-coordinate fully and only then adjusts its…
We are given a proposed username and a collection of already-registered usernames. The task is to decide whether the new one is “safe” to use, meaning it is not considered equivalent to any existing username under a set of transformation rules.
We are given a sequence of positions along a straight line where bike stations are located. The first station coincides with Arkady’s starting point (school), and the last station coincides with his destination (home).
We are given a line of $k$ coins, each independently oriented either “obverse” (call it O) or “reverse” (call it R). A full configuration is simply a binary string of length $k$, but $k$ can be extremely large, so we cannot enumerate configurations.
We are given a collection of integer segments on the line from 1 to m. Each segment contributes coverage to every integer point inside it, including endpoints. For every integer position x, we can compute how many segments cover it; call this value cnt(x).
We are given a rooted tree with vertices numbered from 1 to n, where vertex 1 is the root. Every vertex i greater than 1 has exactly one parent p[i], and that parent always has a smaller index, which implicitly guarantees that the structure is a rooted tree without cycles and…
We are given a single-elimination tournament with $n$ teams labeled from 1 to $n$. The structure of the tournament is fixed and mechanical: in every round, the remaining teams are sorted by their original labels, then paired consecutively, so team 1 plays 2, 3 plays 4, and so on.
Two people stand on a number line at integer coordinates $a$ and $b$. They want to end up at the same integer position, and each of them can move one step left or right any number of times. The twist is that movement cost is not linear.
We are asked to construct a permutation of the numbers from 1 to N such that every position behaves in a very specific cyclic way.
We are working on a rooted tree where each node carries two numerical attributes, one acting like a “multiplier when leaving a node” and the other acting like a “weight when entering a node”.
We are given a single lowercase string $A$. The task is to construct another string $B$ such that two conditions hold at the same time: $B$ must read the same forward and backward, and the string $A$ must appear inside $B$ as a subsequence, meaning we can delete some…
We are given a sequence of non-negative integers. The only allowed operation is to pick a pair of adjacent positions where both values are still positive, subtract the smaller value from both, and pay a cost equal to that smaller value.
We are given a sequence made only of two values, 1 and 2, arranged in a line. We are allowed to choose a single contiguous segment of this sequence, reverse it, and then we want to measure how long a non-decreasing subsequence becomes after this operation.
We are asked to construct a polynomial whose coefficients are non-negative integers strictly less than a given base $k$, such that when this polynomial is divided by $x + k$, the remainder is exactly the constant polynomial $p$.
We are asked to construct a positive integer not exceeding $10^{18}$ such that when it is written in base 10, the total number of “loops” formed by its digits is exactly $k$.
Two players are interacting with two arrays of integers. One player owns an array of length n, the other owns an array of length m. Each number represents a lantern’s brightness, and brightness can be positive, negative, or zero. The interaction is adversarial.
We are given a string of length $n$, and we are allowed to transform it using a single operation that cuts the string into a suffix and a prefix. The suffix is reversed and moved to the front, and the prefix is appended after it.
We are given a directed graph where each vertex represents a state of a game token. A token starts at a fixed vertex, and two players alternate moving it along outgoing edges. A player loses immediately if they are to move from a vertex that has no outgoing edges.
We are given two integers that describe a vertical structure of branches on a tree. The branches are numbered in increasing order, starting from a low level up to some maximum height.
We are given a list of participant scores, and we need to count how many different ways we can choose a group of participants to receive diplomas under a very specific rule. A valid group is determined by picking a score threshold.
We start with a single string of lowercase letters and repeatedly perform a sequence of destructive operations. In the i-th operation, we are forced to delete a contiguous block whose length is fixed to be $2i - 1$, but we are free to choose where that block lies in the…
We are given a multiset of values, where each value is attached to a distinct position. The task is not to process a single ordering of these values, but to consider every possible permutation of indices, treating identical values at different positions as distinct.
The task describes a transformation on a string where certain characters are removed according to a local rule involving vowels. We are given a word and repeatedly modify it until no two adjacent vowels remain.
We are given a set of distinct points on a number line representing prizes. Two people start from fixed positions, one from the left side at position 1 and the other far to the right at position 106.
Arkady cooks a cutlet for a total of $2n$ seconds, and the physics is simple: at every moment it is on exactly one side, and whenever he flips it, the side changes instantly.
We are maintaining a growing collection of positive integers. The collection starts empty, and we process two types of operations: we either insert a new number, or we ask a question about the current collection.
We are given a directed structure over $n$ nodes, where each node has exactly one outgoing edge. Concretely, plane $i$ points to plane $fi$, meaning it “likes” exactly one other plane. Self-loops are explicitly disallowed, so no node points to itself.
Dima has a fixed number of hamsters that will be ready for transport, and a collection of box types, each with a different capacity. Every box used must be completely filled, and all chosen boxes must be of a single type because buying mixed types removes a discount.
We are given several points placed on a number line. Each point is just a single integer coordinate. We want to keep a subset of these points such that the spread of the remaining points is controlled, specifically the difference between the largest and smallest kept point…
We are given a sequence of numbers, and we need to break it into contiguous segments. Each segment is evaluated independently, and then we sum up the segment scores.
We start with a single integer value x = n and repeatedly transform it until it becomes 1. Each move either reduces the value by one at a fixed cost A, or divides the current value by k at cost B, but division is only allowed when the current value is exactly divisible by k.
We are given a binary pattern string s and we want to measure how often this pattern appears inside many different strings derived from a very specific construction. The large string we care about is not arbitrary. It comes from a Fibonacci-style concatenation process.
We are given a large number represented as a string, and for each query we need to construct a strictly smaller number that satisfies a structural property. A number is considered valid if it has an even number of digits and its digits can be rearranged to form a palindrome.
We are given a list of integers, and we are allowed to split this list into two groups in any way we like, with the only rule that every element must belong to exactly one of the two groups.
We are given a string made of lowercase English letters. We are allowed to perform an operation that only increases a character by one step in the alphabet, for example turning c into d or a into b. Characters cannot decrease, and z is terminal.
The grid can be viewed as a rectangular graph where each cell is a node connected to its four orthogonal neighbors. Some nodes contain sheep, some contain wolves, and the rest are empty.
Codeforces 949C: Data Center Maintenance
There are n rooms arranged in a line. Each room must end up with exactly b students being counted by inspectors, but initially the distribution is arbitrary as an array a[i], and the total number of students equals n · b, so globally there is just enough “mass” to satisfy…
We are given 2n lattice points in the plane, each representing a star. Somewhere in the original astronomical configuration there existed a special point, the Moon, with integer coordinates, such that the stars could be partitioned into n pairs with a very rigid geometric…
We are allowed to build a multiset of “coins”, where each coin has a value that is either a positive or negative power of two. In every round, a target integer is announced, and we must be able to select some subset of our fixed coins so that their sum equals that target.
We start with numbers from 1 to $n$. Instead of placing them directly into positions $1$ through $n$, each number $i$ is initially placed at position $2i-1$. So the array of length $2n$ has numbers only in odd positions, while even positions are empty.
We are given a binary string representing a chronological sequence of days, where each character is either 0 or 1.
We are given three groups of players at a training session: people who can only use the left hand, people who can only use the right hand, and ambidextrous players who can be assigned to either hand.
We are given two sequences of positive integers, each sequence representing how a long stream of bytes was transmitted in chunks. Each sequence is a segmentation of the same total length, but the segmentation points are different.
We are given a set of cheeses, each cheese has a unique name and a label indicating whether it is soft or hard. The names are just identifiers, but they can still be ordered lexicographically and used to define structure if needed.
The input is a short arithmetic expression containing small non-negative integers and only two operations: addition and subtraction. There are no parentheses, no multiplication, and no hidden formatting rules beyond the usual infix notation.
We are given a single integer a, guaranteed to be a three-digit or two-digit number between 10 and 999. The task is to output either 0 or 1 based on a hidden property of this number.
We are interacting with a single unknown “cat”, but we are not told directly whether it behaves like a normal cat or a grumpy one. Instead, the cat is split into 10 labeled regions from 0 to 9, and we can probe the cat by choosing a region to pet.
We are given a 3 by m grid where movement is always one column to the right and can also shift vertically by at most one row. The journey starts in the middle row of the first column and must end in the same middle row at the last column.
We are given two strings, one long string and one pattern string, both over a very small alphabet of size six. We slide the pattern across the long string, and for each position we take a substring of the same length as the pattern.
Each tap contributes a controllable flow of water, but every tap has a fixed temperature. You are allowed to choose a real-valued flow rate for each tap between zero and its maximum capacity.
We are given a string that we want to construct starting from an empty string. Each action costs one operation. The basic action is appending a single character to the end of what we already have.
We are given a sequence of moves on a grid where each move is either one step to the right or one step upward. The key operation allowed is merging a right move and an up move when they are adjacent in either order.
We are given a rooted tree with $n$ nodes, rooted at node 1. For every node $u$, we consider a family of structures defined by an integer $k$, where a node can be thought of as the root of a “$k$-ary heap of depth $m$” if it has at least $k$ child-subtrees that themselves…
We have a line of positions from 1 to n, each position containing an icicle with an initial height a[i]. Over time, two things happen: a sound wave spreads from a chosen starting point T, and the icicles touched by the wave begin to melt downward.
Andrew wakes up at a given time of day and realizes his cat is hungry. The cat starts with some initial hunger value, and this hunger grows steadily over time at a fixed rate per minute. Andrew can reduce the cat’s hunger only by buying buns.
We are given a single lowercase string. The task is to decide whether we can split its positions into two disjoint subsequences such that each subsequence forms a string that can be rearranged into exactly two contiguous blocks of equal characters, and those two blocks must…
We are given a one-dimensional strip of length $n$, where each position is either already painted in one of three colors or left blank. The blank positions must be filled using the same three colors so that no two adjacent positions end up sharing the same color.
We are given a line of Jedi, each occupying a fixed position in an array, and each Jedi has one of several possible lightsaber colors. Alongside this, we are given a target specification that tells us how many Jedi of each color we must pick.
We are given two sets of points in the plane, each containing the same number of points. One set represents spaceships, the other represents bases. Every point has a unique location, and no three points lie on a single straight line.
We are given two small point sets in the plane, one representing Rebel ships and the other representing bases. Each ship must be assigned to exactly one base, and each base must also receive exactly one ship, so the assignment is a bijection between the two sets.
We are given a tree with $N$ nodes, meaning every pair of nodes is connected by exactly one simple path. We are allowed to choose $K$ nodes as “active stations”.
We are given a sequence of integers and asked to cut it into exactly $k$ contiguous non-empty segments. Each element must belong to exactly one segment, and the order of elements is preserved. For any segment, we take the sum of its elements, then reduce that sum modulo $p$.
We are given two rectangular grids of characters. The first grid has size $N times M$, while the second grid has size $M times N$.