brain
tamnd's digital brain — notes, problems, research
43815 notes
We are given an array and we want to understand how “stable” each value is across fixed-length windows. For a chosen window size $k$, we slide a segment of length $k$ across the array. A number is considered good for this $k$ if it appears in every single such segment.
A direct Euclidean angle chase in the original configuration quickly becomes entangled because four different circles interact in a non-symmetric way: the circumcircle $G$, two internally tangent circ…
Each query gives a segment of integers and asks how many numbers in that segment share a specific value under a transformation function g. The function g takes a number and repeatedly replaces it with the product of its digits until the value becomes a single digit.
We are simulating a dynamic chat sidebar that always shows recent conversations first. Every time Polycarp sends a message to a friend, that friend’s chat becomes the most recently active and is moved to the very top of the list.
We are given a video of length c seconds. Each second of watching requires consuming a units of data, while the internet connection can download b units of data per second continuously.
We are given multiple independent queries. Each query describes a triangle in the plane using three points. A vertical light source shines from above, and every point of the triangle casts a vertical projection downwards onto the ground.
We are looking at a sequential game played by people sitting in a circle. Each player has a fixed “favorite number”. A single die with faces from 1 to m is rolled repeatedly, but the rolls are not globally shared.
We are given a fixed set of dictionary words, each very short, and then a large number of queries. Each query provides a word and a rank. For a query word, we compare it against every dictionary word using suffix matching.
We are given an array where each element is a large integer up to 10^18, and we need to support two operations. One operation updates a single position in the array.
We are given a collection of pigeon species, where each species has a limited supply of pigeons available for purchase. The goal is to build as many identical pigeon houses as possible.
We are given several independent scenarios. In each scenario there are $n$ steps, each with a height value, and a frog that moves from the leftmost step to the rightmost step. The frog can rearrange the steps in any order before starting its journey.
Two players stand on a tree, initially anchored at node 1. They take turns moving a token along edges, always stepping to a neighbor of the current node. Once a node has been visited, it is removed from consideration, so the token can never return to it.
The condition states that $n^{p-1}$ divides $(p-1)^n+1$, with $p$ prime and $n \le 2p$.
Codeforces 105229I: 六元组计数
We are given a set of missions, each mission i has a cost of time Ai and a value Bi. A person has a total time budget M and can choose a subset of missions to complete, each at most once, in any order, as long as the total time spent does not exceed M.
We are given a line of $n$ water lilies labeled from left to right. We need to design two independent directed systems of connections on these positions. The first system belongs to a frog.
We are given a rooted tree where each node represents a state in a diffusion process. Starting from the root, a token moves downward until it reaches a leaf.
We are given several independent test cases. Each test case provides an array of positive integers. From this array we consider every contiguous segment and compute its sum.
We are observing a gacha system that produces a sequence of “gold intervals”. Each interval is the number of draws between two consecutive gold pulls, and that interval is a random variable whose distribution depends on a counter that evolves during the same interval.
We are asked to count how many monotone paths exist on an $n times n$ grid from the bottom-left corner $(0,0)$ to the top-right corner $(n,n)$, where each move increases either the x-coordinate or the y-coordinate by exactly one.
Each hero comes with two labels, think of them as two “bond types”. Every bond type appears on at most two heroes in total. A bond becomes active only when both heroes that contain it are selected.
We are given a line of positions, and at every position there are two possible “actions” available. Each action is either an addition of a fixed value or a multiplication by a fixed value.
We are given a long sequence of letters, and we are allowed to freely rearrange any of them after “cutting” them out of the original text.
We are given a set of points on the plane, and we must cover every point using exactly two geometric covering devices. One device is a circle and the other is a square.
We are working on a grid of integer lattice points inside a rectangle from (0, 0) to (n, m). For every lattice point (a, b), we must count how many distinct geometric squares can be formed such that (a, b) is one of the four vertices and all four vertices lie inside the…
We are given a tree where each node stores an integer weight. For any two nodes, we can look at the unique path between them and compute the bitwise XOR of all node weights along that path.
We are given a rectangular grid where each cell represents either a wall, an empty passage, a trap, the starting position, or a cell containing a numeric amount of treasure. From the starting cell, movement is allowed in four directions.
The condition requires a set of marked squares such that every square of an $n\times n$ board is either marked or shares a side with a marked square.
We are given a rectangular grid with $n$ rows and $m$ columns. A piece starts at the top-left cell and moves like a bishop, meaning it always travels diagonally.
We are given a set of ingredients, and some pairs of ingredients are known to taste the same. That relation is not just pairwise, it extends transitively, so if ingredient A matches B and B matches C, then A, B, and C all belong to the same flavor group.
Codeforces 105230F: Franklin is Back
We are maintaining an array where each element is a small positive integer, and we are interested only in its prime factor structure.
We are given a one-dimensional path encoded as a string of + and -. We start at an implicit height of zero before processing the string. Each character moves the current height by exactly one unit: + increases height by one, - decreases it by one.
We are given a single integer $n$, and we want to express it as a product of integers greater than 1. The twist is that among all possible factorizations, we are not optimizing for simplicity or minimal number of terms, but for the opposite: we want to maximize how many…
We are given a list of integers, and for each one we repeatedly apply a transformation: replace the number with the sum of its proper divisors, meaning all divisors strictly smaller than the number itself.
Codeforces 105230A: Areas
We are given a classroom with $n$ students, each independently assigned a birthday uniformly over 365 days. We are asked for the probability of a very specific configuration.
Each of the 60 cards corresponds to a fixed pattern over the positive integers. A number appears on a card exactly when it satisfies a certain binary condition derived from that card’s index.
Let $S=\sum_{1\le i<j\le n} x_i x_j (x_i^2+x_j^2)$ and $T=\sum_{i=1}^n x_i$.
The condition says that for every pair of distinct points $A,B \in S$, the perpendicular bisector of segment $AB$ is a symmetry axis of the entire finite set $S$.
Codeforces 105231A: Maliang Learning Painting
Substituting small values reveals structural rigidity.
The configuration centers on the intouch triangle of $ABC$.
The divisibility condition is $ab^{2}+b+7 \mid a^{2}b+a+b$.
We are given a one-dimensional field of leeks represented by an array. A worker starts at a fixed position and moves along this line for a fixed number of time steps. At every step, all leeks grow uniformly by the same amount.
For each prime exponent $a$ in $n=\prod p_i^{a_i}$ the ratio contributes a factor
For each contestant, the pattern of ratings by the $b$ judges can be encoded by a binary vector of length $b$, where $1$ represents a pass and $0$ represents a fail.
Placing $P$ at the origin is safe because the perpendicular bisector conditions $PA=PB$ and $PC=PD$ become $|a|=|b|$ and $|c|=|d|$.
We are given a weighted undirected graph representing a campus. Each node contains a number of tourists, and certain nodes are designated as gates. Each gate is only active during a specific time interval. Over time from 1 to T, the set of active gates changes.
We are given a graph that is extremely simple in structure: a grid with 2 rows and $m$ columns. Each cell $(i, j)$ is a vertex, and edges exist only between orthogonally adjacent cells.
We are given multiple independent hands of Mahjong, each consisting of 14 tiles encoded as a 28-character string. Each tile is written as a value plus a suit or honor marker, so every tile occupies exactly two characters in the input.
We are given a set of points in the plane, and we should think of every pair of points as being connected by a segment. Each such segment corresponds to one “enemy” that can appear at any position along that segment, but its exact location is not fixed in advance.
We are given a large numeric grid, think of it as a matrix of values. We also fix the size of a smaller rectangular “filter” of size $k times l$.
We are given a very large integer written in base 11, but we never see it as a continuous string. Instead, the number is encoded as a sequence of blocks. Each block says “repeat digit d exactly k times”, and concatenating all blocks gives the full base-11 representation.
We are given a tree of up to two hundred thousand nodes. Each edge is marked with a value 0 or 1, and over time these edge values can flip between broken and working. The structure of the tree itself never changes, only whether an edge is currently usable.
We are given a sequence of positive integers and asked to construct two different subsets of indices such that the sum of values chosen by the first subset equals the sum of values chosen by the second subset.
We are given a sequence of positive integers. We are allowed to repeatedly pick any two positions in the sequence and replace the pair using a deterministic transformation: one position becomes the gcd of the pair, the other becomes the lcm of the pair.
We are given a set of players, each of whom claims to own a certain integer value. However, these claims may or may not be true. The actual values assigned to all players must sum up to a fixed total $s$.
Testing the structure of partitions of $2^n$ into powers of $2$ for small $n$ shows that multiplicities alone do not determine any canonical pairing process.
The equation is
We are given a square grid of size $n times n$. The first row is fixed: it contains the numbers from 1 to $n$ in order. Every cell below is generated deterministically: each entry is the square of the number directly above it in the same column.
The condition states that for every index $i$, every symbol in $S={1,2,\dots,2n-1}$ must appear at least once in the union of row $i$ and column $i$.
The previous argument fails because it attempts to control prefix sums via a greedy choice that is not guaranteed to be feasible at every step, and it incorrectly infers global bounds from stepwise bo…
We are given a sequence of integers, and we are allowed to remove exactly one element from it. After removing that element, the remaining elements keep their original order, forming a shorter sequence. On this modified sequence, we look at all prefixes.
Substituting small configurations clarifies the failure of any approach relying on a relation between $\angle BAU$ and $\angle CAU$.
A black–white checkerboard coloring on $\mathbb{Z}^2$ can be encoded by the function $c(x,y)=(-1)^{x+y}$, where one color corresponds to $+1$ and the other to $-1$.
The sequence $(x_i)_{i=0}^n$ evolves by steps of fixed sizes $p$ or $-q$, with $p,q>0$, and starts and ends at $0$.
We are given a number of candies, called Zingers, initially held by Kaito. Before any distribution happens, a character named Taim is allowed to secretly take up to k Zingers for himself.
We are given an array and allowed to perform a single operation at most once. The operation selects a contiguous segment, computes the mex of that segment, and then overwrites every element inside the segment with that mex value.
We are asked to enumerate sequences of length n where every element is a positive integer and neighboring elements differ by at most one.
The configuration consists of a convex hexagon $ABCDEF$ with three pairs of parallel sides: $AB \parallel DE$, $BD \parallel EF$, and $CD \parallel FA$.
Let
We are given a tree where each node carries two attributes: a weight and a color. From this tree we want to select a subset of vertices with two simultaneous restrictions. First, no two chosen vertices may be adjacent in the tree, so the chosen set must be an independent set.
We are given three integers $R$, $x$, and $y$. We consider all integer segments $[l, r]$ such that both endpoints lie between 1 and $R$. For each such segment, we look at how many numbers inside it are divisible by $y$.
The functional equation is
A direct continuation of the previous angle-sum manipulation is unsafe because relations involving three rays at a point were previously used without controlling whether the point lies inside the rele…
We are given two points on the integer grid, each acting as the center of a circular influence. Around each center, every lattice point within a given Euclidean radius has its value flipped by multiplying it by −1.
The correction must repair three independent failures: a missing invariant for even $r$, a non-existent construction for $r=73$, and a spurious modular obstruction for $r=97$.
For small primes the structure can be tested directly.
The failure in the previous argument comes from a structural mismatch: the target inequality cannot be reached by first producing an expression for $CF$ and then attempting to “discard” remaining boun…
We are given a set of points on a 2D integer grid. Among them, there exists a hidden point $(a, b)$. For every given point $(xi, yi)$, we are also given the squared Euclidean distance from that point to $(a, b)$, but the list of these distances is shuffled, so we do not know…
We are given a weighted tree with up to one hundred thousand vertices. Each edge has an integer weight. For every query, we pick two vertices and look at the unique simple path between them. This path gives us a sequence of edge weights in order.
We have $n$ football players. Initially, each player $i$ has a shirt numbered $i$, so the labels form the sequence $1,2,dots,n$. After a change, shirt number $1$ is replaced by $n+1$, so the available set of shirt numbers becomes $2,3,dots,n+1$.
We are given a sequence of cups arranged in a line. Each cup has a value that represents how relaxing it is to drink. Evgeny repeatedly removes cups until none remain, but each time he is only allowed to take either the leftmost or the rightmost remaining cup.
The recurrence is first rewritten correctly by clearing denominators:
We are given a rooted tree where every edge is directed from a child up to its parent, so from any node you can follow a unique chain of parents until you reach the root. Each vertex has a distinct integer value attached to it.
We are given a small combinatorial game played on three independent piles of stones. Each move consists of selecting exactly one pile and removing a number of stones from it. The number of stones removed must belong to a fixed allowed set given in the input.
Each store trip gives Butterball two independent supplies: some rice and some chicken breast. Across all trips, he wants to assemble meals of fixed size $k$ grams, but the rules restrict how ingredients can be combined.
We are asked to count how many ways we can completely cover a rectangular grid of height m and extremely large width n using 1×2 dominoes. Each domino covers exactly two adjacent cells either horizontally or vertically, and every cell of the grid must be covered exactly once.
We are given a rectangular grid representing flooded terrain, where each cell has a water depth value. A traveler starts in the top-left cell and wants to reach the bottom-right cell.
We are given a collection of projects, and for each project there are several mutually exclusive ways to execute it. Each way has a cost and a revenue. For every project we must either pick exactly one of its available ways or skip the project entirely.
We are given several independent test cases. Each test case describes a tree, meaning a connected acyclic graph. The task is to decide whether there exists a walk on this tree that visits every node at least once and never more than twice.
Testing the condition for small values of $n$ starts with rewriting the requirement as a linear system in the unknowns $r_i$.
For any infinite set $S$ of primes, the objects under consideration are integers of the form $p_1p_2\cdots p_k$, where $p_i\in S$ are distinct primes and $k\ge 2$.
We are given several test cases, and in each one we start with a list of integers. The task is to split this list into two non-empty groups so that every element belongs to exactly one of the groups.
We are given multiple test cases. Each test case consists of a set of points on a 2D plane. Every point has integer coordinates and also a color label.
We are given a single odd integer n that represents the number of chess games played between two players, both named Ahmad. Every game produces a decisive result, so there are no draws, and each game contributes exactly one win to one of the two players.
Testing small structures suggests that the expression $x+f(y)+xf(y)$ behaves like a deformed product since it equals $(1+x)(1+f(y))-1$.
We are given an array of integers and then asked many independent queries. Each query provides a value x, and we must consider all pairs of distinct indices (i, j) such that the bitwise OR of the two array values is “compatible” with x, in the sense that every bit that…
We are given a hotel with floors numbered from bottom to top. Each floor has a structural limit that restricts how many guests can be on that floor or any floors above it.