brain
tamnd's digital brain — notes, problems, research
41508 notes
We are given a rooted tree where each node stores a value representing a chocolate type. The tree structure is fixed, but two kinds of operations are performed over time.
We are given several test cases. In each test case, there are several flower types, each type having a fixed “beauty coefficient” and exactly 100 identical flowers available. Every individual flower costs 1 dinar, and we can buy at most c flowers in total.
We are given a set of distinct points on a 2D plane. The task is to count how many ways we can choose four different points such that all four lie on the same straight line.
We are given a collection of strings, each attached to a distinct index from 1 to N. The task is to determine whether we can choose four different indices such that if we concatenate the first two strings in order, we get exactly the same string as concatenating the other two…
We are given a rectangular grid where each cell is either empty or contains a shop that sells exactly one paint color. Bob starts at the top-left cell and wants to reach the bottom-right cell, moving only in four directions with unit cost per move.
Each test case gives a small phonebook of people, where every person has a unique name and an 8-digit phone number. After that, we receive many queries. Each query does not reveal a full phone number; instead, it reveals only a handful of digits, and their order is irrelevant.
We are moving along a straight road from position 0 to position X, walking at exactly one meter per second. Along the way there are traffic lights placed at fixed coordinates.
We are simulating a very small file system that supports three operations applied sequentially. Each operation either creates a named file, deletes a named file, or asks how many files currently exist.
We are working with an array of length $n$, initially filled with zeros. Then we receive $q$ operations that either ask for a range sum or apply a structured update. A query of the first type asks for the sum of values in a subarray $[l, r]$.
We are given a short sequence of integer adjustments applied one after another to a running total. Each value can either increase or decrease the sum depending on whether it is positive or non-positive, but in practice they are simply added as-is.
We are given a large undirected weighted graph and then many independent queries. Each query asks for the cheapest way to travel between two given vertices, but with a strict restriction: the route is allowed to use at most three edges.
We are given a sequence of programming contest submissions ordered by time. Each submission records a team name, a problem identifier, a timestamp, and whether the attempt was accepted or rejected.
We are asked to count how many sequences of length $n$ can be formed using numbers from $1$ to $k$, but only those sequences that survive three simultaneous structural rules. The sequence has a fixed odd length, so it has a unique middle position.
We are given a source string s and a target string t. Starting from s, we are allowed to repeatedly delete a character, but only if that character is currently located at an even position in the string.
We are given a sequence of integers representing the “strength” of gods arranged in a line. Between every pair of adjacent gods, we look at how different their strengths are. The instability of the whole arrangement is defined as the largest such adjacent difference.
I can’t reliably write a correct editorial for this without the actual problem statement. Right now the prompt only contains the title “Codeforces 104984C - Перси Джексон и царство Аида” but no description of the rules, inputs, or required output.
We are given a tree of servers where every edge has unit length. Each query specifies a vertex $ui$ and a distance limit $d$.
We are given a set of players, and each player must independently choose one of three available options. Each option is described by two values: a resource cost and a score gain. For player i, option j contributes a cost ai,j and a score ci,j.
Codeforces 104985D: Bill Restoration
We are given several episodes to download, and each episode comes with two parameters: a nominal download speed and a target download time if that speed stayed constant.
We are given a grid where each cell has a terrain value that can be interpreted as a required altitude to safely operate in that location. A helicopter starts at some cell and must move across the grid, changing cells in four directions.
We are working with a directed graph whose nodes represent themes and whose edges represent one-way relationships between them.
We are arranging all integers from 1 to n into a permutation, where each integer represents a play and its value represents how good it is. Small numbers are better plays and large numbers are worse plays.
We are given a long string that represents a text written as a sequence of uppercase letters. Alongside this text, we are given a collection of dictionary words.
We are given two collections of points on a number line. The first collection consists of bakeries with positions $x1, x2, dots, xN$.
We are given a fixed set of distinct “unknown words” that William encounters while rewriting a collection of sentences.
We are given a string of length $n$. The only allowed operation is to pick an index $i$ and swap the characters at positions $i$ and $i+k$. This operation can be repeated arbitrarily many times.
We are maintaining a grid of stacks. Each cell of an $N times N$ board contains a vertical stack of letters. The system supports three kinds of operations applied over time: pushing a letter onto a stack, popping the top letter from a stack, and querying whether a given letter…
Working
We are given two independent sequences that interact multiplicatively and additively across many decisions. Each bakery has a position value $xi$. Each mailbox has a position $yj$ and an associated cost $kj$. For every bakery, Cyrano chooses exactly one mailbox to visit.
We are given a long string representing a “text” of length $N$. Alongside it, we are also given a set of $M$ distinct words. The total length of all words combined is bounded, so although there may be many words, their combined structure is still compact.
We are given a string of length $n$. We are allowed to repeatedly apply a swap operation that exchanges characters at positions $i$ and $i+k$, as long as both indices are valid. These swaps can be performed any number of times in any order.
We are given a fixed list of distinct words that William does not know. During his work, he reads a sequence of sentences in order, and every word in those sentences belongs to this “unknown vocabulary” set.
We are maintaining a grid of stacks. Each cell in an $N times N$ board stores a vertical stack of letters, where each update either pushes a letter onto the stack, pops the top letter, or asks whether the current stack has a “dominant” letter.
Working
We are given a single line of text that may contain uppercase and lowercase English letters mixed with spaces. The task is to determine whether the contiguous sequence of characters “be” appears anywhere in this text when we ignore capitalization.
We are given a set of points on a number line, each point representing a possible initial position of Juliet at time zero. Romeo later learns that at time d, Juliet must lie somewhere inside a known interval [A, B].
Codeforces 105013J: 小Q的机器
We are given a binary string consisting only of opening and closing brackets. On this string, we must process a sequence of point updates where a single character is changed, and after each update we must compute a value derived from the current configuration of brackets.
I can’t produce a correct or meaningful editorial from what you’ve provided, because the actual problem statement is missing.
The input describes a binary string that is processed in fixed-size chunks of length k. You can think of splitting the string into consecutive blocks, each block being treated independently first, and then interacting with its neighbors later.
We are given a tree with n nodes, where each node carries a lowercase letter. Every node also has an implicit depth from the root. After building the tree, we receive q queries.
We are given a directed graph where each vertex represents a currency and each edge represents an exchange operation. If we go from currency u to currency v, the amount does not simply get multiplied by a rate, it also loses a fixed fee before conversion.
Each query describes a modular grid universe of size $n times m$, where positions wrap in a structured way. At any fixed time, there are $nm$ individuals, each indexed by a number $k$, and each individual follows a deterministic trajectory across grid cells over time.
Each input describes a disk made of concentric circular sectors. The $i$-th sector is a ring split into $Ai$ equal positions, and each position is painted with one of $K$ colors. So every sector is essentially a colored cyclic array whose length depends on the sector index.
We are given several memory blocks, each block has a size that is a power of two. If an element has value $Si$, its actual size is $2^{Si}$, and it also comes with a strict alignment rule: it can only be placed at a memory address divisible by $2^{Si}$.
We are given, for every node in an unknown tree, the identity of one special node: the node that is farthest from it in terms of shortest-path distance.
We are working on an $N times M$ grid where every cell represents a possible hiding location for a money bag. Yessine will place exactly $K$ bags, with at most one per cell.
We are given a very small grid, at most 5 by 5, filled with two possible colors, black and white. The game repeatedly removes connected regions of the same color, and each removal causes a physical reconfiguration of the grid: cells above fall down to fill gaps, and then empty…
We are given a sequence $P$ that is supposed to behave like a prefix-function array of some hidden integer array $A$.
We are given an array of positive integers and a fixed odd integer $k$. Two players take turns transforming the array. A move consists of choosing two elements, removing them, and appending their sum.
We are given a binary string and allowed to repeatedly perform a local transformation on adjacent equal characters. Whenever we see two consecutive 0s, we may delete them and insert a single 1.
We are given several independent scenarios. In each scenario, there are $N$ champions, each with an initial strength value.
We are given several independent test cases. Each test case contains a sequence of prices over time. The task is to look at every contiguous segment of time where the prices strictly increase step by step, and measure how much the price rises from the beginning of that segment…
We are given a text message that consists of several “animal names” embedded inside a normal sentence. Each animal name is written as a concatenation of words, where each word starts with a capital letter and continues with lowercase letters.
We are given a collection of videos, each video is a string made of uppercase letters. Each character represents a 10-second segment of a certain animal type. Watching a video means consuming the entire string, so the cost of a video is proportional to its length.
We are given a collection of $n$ containers, where each container holds two independent quantities: some number of cat food packs and some number of dog food packs. The total number of containers is odd.
We are given a collection of food items, each described by how soon it disappears from a warehouse and how many calories it provides. Time moves in discrete hours starting from the moment the bear arrives.
We are given a rectangular grid representing a yard divided into unit cells. Each cell is either marked as 0 or 1. The 1 cells form the drawn border of a single pool structure, and the 0 cells inside represent the interior area enclosed by that border.
A frog starts at the first stone in a row of n stones and wants to reach the last one. Normally it moves one step forward, visiting every stone in order.
The training process produces a sequence of exercises. Each exercise has a “correct answer” provided by the owl and a response written by Grisha. The same exercise may appear multiple times, because if Grisha’s answer is not accepted, the owl repeats that exercise later.
We are given a world populated by two kinds of creatures. Each creature of the first type has exactly 1 head and 19 legs, while each creature of the second type has exactly 7 heads and 4 legs.
We are looking at a system of identical animals, where each animal consumes a fixed integer number of carrots per meal. That per-meal amount is the same across all meals for a given animal, and also the same across all animals.
We are given a sequence of distinct ratings assigned to birds, where each position corresponds to a new bird encountered in order.
We are given a single string made of lowercase English letters, and we need to find a substring that appears as many times as possible inside it. Among all substrings with the highest frequency, we prefer the longest one.
We are given a collection of strings, each representing a fixed “spell”. We are allowed to rearrange these strings in any order and concatenate them into one long string.
We are given a rectangular grid where some cells contain artifacts. Each artifact sits at a specific coordinate, and we are only allowed to move from the top-left corner to the bottom-right corner using steps that go either right or down.
We are given a tree, which is a connected graph with no cycles, where every edge represents a path of equal length one. Each query gives us three distinct starting nodes, representing the initial positions of three people inside this tree.
We are given an undirected graph where each vertex represents a chamber in a labyrinth and each edge is a corridor of equal traversal cost. Elisa starts at node 1 and wants to reach any of the designated exit chambers as quickly as possible.
We are asked to count sequences of length $N$, where each element is chosen from the integers $1$ to $M$, and every pair of adjacent elements must be coprime, meaning their greatest common divisor equals 1.
We are given a parking duration expressed as hours and minutes, which we first convert into a single total number of minutes. The parking fee is not constant over time.
We are given many independent queries. Each query describes an interval on the positive integers, and we must count how many numbers inside that interval have the property that their decimal representation reads the same from left to right and from right to left.
We start with a single apartment that already produces a fixed monthly rental income. Each additional apartment costs a fixed amount of money, and once purchased it immediately contributes the same monthly income as the initial one.
We are given a row of $n$ numbers. The only allowed operation is swapping two positions if the numbers at those positions share a common divisor greater than 1.
We are given a sequence of chests arranged in a line, each chest carrying a value that can be positive or negative. A player starts before the first chest and has a limited number of tokens.
We are given a multiset of cards, where each card has a number written on it. From these cards, we consider every possible subset of cards. For each subset, we compute how many distinct values appear inside it, then we sum this quantity over all subsets.
We are given a collection of monsters, and we want to choose some of them to maximize how many we take, under a global limit on total “aggressiveness”. Each monster behaves in a slightly conditional way.
Each test case gives a word, and for that word we need to decide whether it can be seen as an “expanded” version of some shorter string after inserting exactly one character.
We are given a string made of lowercase Latin letters. Two players alternate turns. On a turn, a player may delete one character from the string, but only if the character is not at either end and its removal does not create two identical adjacent characters.
We are given a grid of size n by m, where each cell contains either a letter or a dot indicating an empty cell. On this grid, we want to determine whether a given word s already appears as a valid “snake” path.
Two sequences of numbers are given, and the allowed operation is to repeatedly compress any adjacent pair inside either sequence by replacing it with their sum. Each compression reduces the length of that sequence by one, while preserving the total sum of its elements.
We are working with a 3×3 sliding board where the middle cell is special. Initially, that center cell is empty, and the other eight cells contain chips colored either red or blue.
We are given a sequence of cards arranged in a fixed order. Each card carries an integer value between 1 and m. We are allowed to delete any subset of cards, but we cannot reorder the remaining ones.
We are given a valid chain of domino tiles, already placed in order. Each tile has two numbers from 0 to 6. Adjacent tiles in the chain already match on touching ends, so the chain is consistent.
We are given three piles of science cards, each pile corresponding to a different symbol. One pile counts cards of type R, another S, and another T.
We are given a sequence of identical standard dice placed in a straight line on a table. Each die has the usual six faces, and opposite faces always sum to 7. The dice are aligned left to right, touching each other side-by-side, and the table hides the bottom faces of all dice.
We are given a weighted undirected graph of cities connected by roads. Two players start from different sets of cities: Huize controls a set of starting cities, and Jacobo controls another set.
We are asked to decide whether a pair of positive integers $x, y$ exists such that a fixed rational expression equals a sum of three Egyptian fractions where the third denominator is constrained to be the product $xy$.
We are given a list of numbers and a fixed number of swap operations. A swap operation means picking any two positions and exchanging their values.
Working
Working
I can’t reliably write a correct editorial for this yet because the actual problem statement is missing. “Codeforces 105003A - Debugging Terence Tao’s Code” is not something I can reconstruct safely from the title alone, and guessing would risk inventing constraints…
We are given a tree with up to 20 nodes, where each node represents a treat with a fixed tastiness value. Two players repeatedly remove nodes until nothing remains. In each move, Bob first selects any two nodes that are currently leaves in the remaining tree.
We are working inside a rectangular park that can be treated as a continuous 2D plane from the bottom-left corner $(0,0)$ to the top-right corner $(N,M)$. A corgi starts at $(0,0)$ and wants to reach $(N,M)$.
We are given a collection of corgis, each assigned a 22-bit integer personality value. If we pick any subset of these corgis, every pair inside that subset contributes a “happiness” equal to the bitwise AND of their personalities.
Each dog-walking job can be seen as an item that Alice may choose at most once. A job comes with two pieces of information: a 7-day requirement pattern and a payment value. The pattern is a length-7 binary vector indicating on which days of the week the dog must be walked.
We are given a circular arrangement of $N$ corgis. Each corgi carries a very small “color set”, either one color or two colors, both represented by lowercase letters. The circle means that the first and last corgi are also adjacent.
We are given a rooted tree with node 1 acting as the root of a “proof structure”. Each node represents a subgoal, and leaves are the only things that can be removed during a verification step.
We are given a single string representing a long sequence of genetic markers, where each character is one of 26 possible letters. Our task is to count how many substrings are “valid palindromic gene segments” under an additional biological constraint.
We are given a one-dimensional terrain described by an array of elevations. Each index represents a location along a path, and each location has a height value.