brain

tamnd's digital brain — notes, problems, research

41641 notes

CF 106164A - Among Us

We are dealing with a hidden structure on a set of $N$ labeled crewmates. Each crewmate secretly points to exactly one other crewmate, and every crewmate is pointed to by exactly one person.

codeforcescompetitive-programming
CF 106161D - Deductive Snooker Scoring

We are given a target state of a simplified snooker-like scoring system. At any moment, there are two players, and one of them is currently at the table. We know the current scores of Player A and Player B, we know how many balls remain on the table, and we know whose turn it is.

codeforcescompetitive-programming
CF 106159N - Nautic Issue

We are given a motion process that starts from an unknown integer position $X$. From this starting point, a sequence of moves is executed.

codeforcescompetitive-programming
CF 106151G - windowmanager

We are given a collection of axis-aligned rectangles placed on a 2D plane, each representing a window. Every window also has a unique height value, which determines visibility: if two windows overlap, the one with higher height covers the other in the overlapping region.

codeforcescompetitive-programming
CF 106144H - Rigged Matchmaking

We are given two teams, each consisting of all athletes whose skill values form a contiguous integer segment. Monland has skills from $lM$ to $rM$, and Berland has skills from $lB$ to $rB$. One special athlete from Monland, the one with skill $lM$, is fixed as Monocarp.

codeforcescompetitive-programming
CF 106142H - Разделение на части

We are given a string composed of lowercase Latin letters. The task is to cut this string into several contiguous segments so that every character belongs to exactly one segment. Each segment must satisfy a strict structural constraint.

codeforcescompetitive-programming
CF 106141F - Arsen and Toy Soldiers

We are working with a lineup of n soldiers. Each soldier is associated with two assignments: one for the morning formation and one for the evening formation. Each assignment is a number between 1 and n representing a rifle type, except some entries are unknown and marked as −1.

codeforcescompetitive-programming
CF 106136H - Square the Circle

We are interacting with a hidden geometric shape centered at the origin. In each test case, the hidden object is either a circle or a square, both centered at $(0,0)$, and we can only probe it by asking whether specific integer lattice points lie inside it.

codeforcescompetitive-programming
CF 106130I - 运动世界校园

We are given a single probability value p, describing the success rate of one independent attempt to obtain a required result. A student has exactly three independent attempts. Each attempt either succeeds with probability p or fails with probability 1 - p.

codeforcescompetitive-programming
CF 106125G - Genealogy Gumbo

We are given a collection of parent-child relations written in the form “A, son of B”. Each statement says that person A has a single known father B.

codeforcescompetitive-programming
CF 106132G - Torque Transmission

We are given a directed network of gears connected by shafts. Each shaft transfers torque from one gear to another, but only a fraction of the incoming torque survives, determined by an efficiency percentage on that shaft.

codeforcescompetitive-programming
CF 106130K - 最不上升也不下降序列

We are asked to construct a permutation of the numbers from 1 to n. From this permutation we look at two classical subsequence measures: the length of the longest strictly increasing subsequence and the length of the longest strictly decreasing subsequence.

codeforcescompetitive-programming
CF 106130D - 序列重构(困难版)

We are interacting with a hidden permutation of length $n$, and our only way to learn about it is to submit test permutations of the same length. Each query gives a score equal to how many positions match the hidden permutation exactly.

codeforcescompetitive-programming
CF 106129H - Happy Hookup

We are given a directed graph where vertices represent train stations and edges represent one-way train connections. Two people start from two different stations, and each can travel along directed edges any number of times.

codeforcescompetitive-programming
CF 106129D - Demand for Cycling

We are given a simple orthogonal polygon, meaning its boundary is a closed cycle made only of horizontal and vertical segments, with no self-intersections. The vertices are listed in counterclockwise order, so walking through them traces the city boundary.

codeforcescompetitive-programming
CF 106129C - Congklak

We are given a row of $n$ holes, each containing some number of stones. The process we simulate is a repeated game played $t$ times. In each game, a single “hand” starts at hole 1 carrying exactly one stone and moves strictly from left to right.

codeforcescompetitive-programming
CF 106125A - Alto Adaptation

We are given a sequence of musical notes, each represented as an integer pitch. We are also given a fixed vocal range, defined by an inclusive interval from ℓ to h.

codeforcescompetitive-programming
CF 106125K - Koehandel

Two players are about to perform a single exchange based on sealed bids. One player, Old MacDonald, has already hidden a number of coins in a cup, and you know exactly how many coins that is, call it $c$. You also have $n$ coins available.

codeforcescompetitive-programming
CF 106124D - Dune Dash

We are given a set of points in the plane that represent checkpoints of a race route, but the order in which the runner visited them is lost.

codeforcescompetitive-programming
CF 106124K - km/h

We are simulating a driver moving through a sequence of road signs, where each sign either sets a specific speed limit or removes the current restriction and restores the original national speed limit.

codeforcescompetitive-programming
CF 106124H - Hidden Permutation

We are given a hidden permutation on positions $1 ldots N$. This permutation defines how a binary string of length $N$ is transformed: each step simply reorders the bits according to the permutation.

codeforcescompetitive-programming
CF 106124F - Follower Forensics

We are given a set of accounts. Each account already comes with two numbers: how many people it follows, and how many people follow it.

codeforcescompetitive-programming
CF 106124A - Arithmetic Adaptation

We are given a single integer s, and we need to split it into two integers a and b such that their sum equals s. Both a and b must be nonzero, and both must lie within the range of three-digit integers, meaning between −999 and 999 inclusive.

codeforcescompetitive-programming
CF 106118C - CK Chang's Shopping Spree

We are given a list of gadget prices and an initial amount of money. The buying rule is restrictive: before purchasing any gadget, the current amount of money must be at least ten times the price of that gadget. After buying it, the money is reduced by the gadget’s price.

codeforcescompetitive-programming
CF 106118N - Nobita's Homework! Help Me Doraemon

We are given three arrays of length n. The first two arrays define the boundary of an n by n grid. The first column is filled directly from the array a, the first row is filled from the array b, and the top-left cell is shared between them.

codeforcescompetitive-programming
CF 106118L - Label the Tree

We are given a rooted tree where vertex 1 is the root, and every other vertex has a fixed parent. On this tree we consider permutations of the vertices, meaning every vertex label from 1 to n appears exactly once in some order.

codeforcescompetitive-programming
CF 106118H - Horse Racing

We are given a weighted grid where every cell has a non-negative difficulty value. Movement is allowed in four directions on adjacent cells. For each query, we are given a starting position and a small axis-aligned rectangle containing at most 100 cells.

codeforcescompetitive-programming
CF 106118D - Demon on the Grid

We are working on an infinite integer grid where each point can potentially be the hidden location of a target. We receive several clues, and each clue consists of a center point and a distance.

codeforcescompetitive-programming
CF 106114B - Network

The task describes a transmission pipeline that behaves like a layered flow system. A message is split into multiple consecutive chunks, and each chunk must pass through a chain of routers.

codeforcescompetitive-programming
CF 106114F - SYSU II

We are given a string and we want to count how many of its substrings are “good” under a very specific structural requirement.

codeforcescompetitive-programming
CF 106087C - Правильные тройки

We are asked to count ordered triples of natural numbers $(a, b, c)$, each between $1$ and $n$, such that the third number can be obtained from the first two using either addition or multiplication in a fixed structure: $a$ and $b$ combine to form $c$ as either $a + b = c$ or…

codeforcescompetitive-programming
CF 106087A - Соревнование трёх

Three swimmers compete across a sequence of races. In every race, the ranking of the three is a strict ordering, so exactly one swimmer gets first place, one gets second, and one gets third.

codeforcescompetitive-programming
CF 106087G - Бегуны и препятствия

We have a circular track with n positions. At time zero, every position contains one runner. Each runner always occupies a single position and moves one step per unit time to an adjacent position. Initially, all runners move clockwise. During the process, m events occur.

codeforcescompetitive-programming
CF 106087F - Пат ладьями

We are counting how many ways we can place exactly two or three rooks on an empty n × n chessboard together with a single black king so that the position is a stalemate for the king.

codeforcescompetitive-programming
CF 106087E - Оптимальное наложение

We are given two square grids of size $n times n$, each cell containing an integer value. We are allowed to place the second grid over the first one, but only with a restricted alignment rule: the bottom-right corner of the second grid must land on some cell of the first grid.

codeforcescompetitive-programming
CF 106087D - Пила

We are given an array of integers. The task is not to directly build a target arrangement, but to measure how far the current array is from being convertible into a special alternating pattern after rearrangement.

codeforcescompetitive-programming
CF 106087B - Ленивые голубцы

We are given a total distance $s$ and a fixed increment $k$. A sequence of runners (called “pigeons” in the statement) produces a list of positive integers $a1, a2, dots, an$ such that the first value is at least 1 and every next value is at least $k$ greater than the…

codeforcescompetitive-programming
CF 106110G - A + B = C

We are given three strings that represent three numbers, but they are not fixed numbers in the usual sense. Instead, each string may behave like a pattern over digits.

codeforcescompetitive-programming
CF 106180B - Flappy Bird

We are simulating a one-dimensional movement process through a sequence of columns. Each column defines a vertical corridor of allowed heights, and a bird moves from left to right across these columns. At any moment the bird occupies exactly one integer height.

codeforcescompetitive-programming
CF 106189H - IP v6

The task is about normalizing an IPv6 address representation. The input is a single string consisting of hexadecimal groups separated by colons.

codeforcescompetitive-programming
CF 106369A - Lucky 7

The task is built around a simple “lucky digit” check on a given number written as a sequence of characters. You receive one or more inputs, each representing a number in its textual form, and you must decide whether that number qualifies as “lucky” according to a single…

codeforcescompetitive-programming
CF 106503B - 0100101

We are given a binary string of length $n$. We must construct a sequence $a1, a2, dots, a{n+1}$, where each value is a small positive integer bounded by 100.

codeforcescompetitive-programming
CF 106467L - Haitei Raoyue

Hmm...something seems to have gone wrong.

codeforcescompetitive-programming
CF 106456M - Little t's GCD

We are given a sequence of positive integers and we are allowed to split it into several contiguous segments that together cover the entire array. For each segment, we compute two quantities. The first quantity depends only on the segment indices.

codeforcescompetitive-programming
CF 106456I - Milk Tea

We are asked to compute the cheapest way to buy exactly n cups of milk tea when the shop offers two purchase options: buying a single cup for cost a, or buying a bundle of two cups for cost b. Each bundle is indivisible and gives exactly two cups.

codeforcescompetitive-programming
CF 106456D - Taffy's LCM

We are given multiple independent queries. Each query provides a single integer $c$. For each $c$, we must split it into two positive integers $a$ and $b$ such that $a + b = c$.

codeforcescompetitive-programming
CF 106444J - Shuttekka Panorama

We are given an array of values over positions, and a list of queries. Each query specifies a contiguous segment of the array. For each segment, we look at all elements inside it and identify where the maximum value occurs.

codeforcescompetitive-programming
CF 106444F - Lama Pute Pute

We are given an array-like structure that can be interpreted as a set of positions for dancers, where each position contributes to a global score through a number-theoretic interaction.

codeforcescompetitive-programming
CF 106444D - Ikam Bokam

The statement you provided is not usable for reconstructing the problem. “Codeforces 106444D - Ikam Bokam” appears with an empty description (“Add .”) and no input/output format, constraints, or meaningful task description.

codeforcescompetitive-programming
CF 106443H - Hungry pou

There are several food items initially placed at integer coordinates on a vertical plane, all of them falling straight down toward the ground line $y = 0$. Each second, every food item moves down by exactly one unit while keeping its horizontal position unchanged.

codeforcescompetitive-programming
CF 106443B - Balatro

We are given two sequences of integers of equal length. One sequence belongs to Drex, the other to a boss. Before any interaction happens, Drex is allowed to permute his own sequence freely.

codeforcescompetitive-programming
CF 106440H - 死亡变速

The problem describes a timeline where a rhythm chart switches tempo over time. The chart is measured in beats, while real execution time is measured in seconds. The conversion between these two depends on the current BPM, and the BPM changes at specific beat positions.

codeforcescompetitive-programming
CF 106440D - 收纳收纳袋

We are given a sequence of containers, each container has a base size and a capacity. The twist is that containers can be nested, but with a strict rule: a container can directly hold at most one other container, and it can only do so if the inner container’s effective size…

codeforcescompetitive-programming
CF 106435D - Зарядка

We have a row of rooms indexed from left to right. A special position k plays a central role. On certain days, a “director event” happens, and each such event triggers a time-dependent pattern of which rooms participate in morning exercise.

codeforcescompetitive-programming
CF 106434C - Бюджетная экскурсия

We are given a graph of cities connected by bidirectional roads. Each road has a cost of exactly one step, but it also carries a binary attribute. Some roads are normal, while others are expensive “bridges”.

codeforcescompetitive-programming
CF 106430I - Bessie and XOR

The task can be seen as working on a system of constraints over XOR values, but the constraints are not written directly in terms of edges and nodes. Instead, they originate from operations on segments of an array, which can be reinterpreted into a graph problem.

codeforcescompetitive-programming
CF 106430C - Bessie and Array

We are given an array of integers and we want to determine whether it is possible to transform it into its reverse using exactly K swap operations. A swap operation exchanges the values of any two positions in the array.

codeforcescompetitive-programming
CF 106429D - Binary Beaver

We are given a multiset of integers, each represented in binary using a fixed number of bits. For any candidate integer $x$, we define its score as the total sum, over all array elements $ai$, of the number of matching lowest-order bits between $x$ and $ai$.

codeforcescompetitive-programming
CF 106420G - Tyson's Taunt

We are given an array of integers and a pair of real thresholds $a$ and $b$. The task is to count how many contiguous subarrays have an average that lies in a specific range.

codeforcescompetitive-programming
CF 106420H - Red Combo

We are given a permutation-like process that builds a structure by repeatedly merging or “validating” adjacent segments of values.

codeforcescompetitive-programming
CF 106420C - Champion's Meeting (Easy)

We are given two ordered lists of racers, where every racer has a unique prestige value. The task is to construct a single final lineup by repeatedly picking the next racer either from the front of the first list or the front of the second list, always consuming one element at…

codeforcescompetitive-programming
CF 106420B - Beta Tester

The problem can be understood as exploring connectivity in a directed system of rooms. Each room represents a node in a graph, and each one-way vent represents a directed edge from one node to another.

codeforcescompetitive-programming
CF 106416H - Holes and Tunnels

We are given a tree with $N$ nodes. Each node represents a hole, and each edge is a tunnel. A move in the game is any simple path between two nodes. Since the graph is a tree, every pair of nodes defines exactly one such path. Two players independently pick two paths $A$ and $B$.

codeforcescompetitive-programming
CF 106416A - Ants on a Ring

We are given a circular track with positions labeled from 1 to L, where position L wraps around to position 1. Several ants start on distinct positions and each ant has a distinct target position. Time proceeds in discrete seconds.

codeforcescompetitive-programming
CF 106398H - Ветер крепчает

We are given a line of towers, each with a fixed height. Then we process a sequence of wind experiments. Each experiment starts at some position and moves strictly to the right. The wind carries a strength value that decreases as it passes towers.

codeforcescompetitive-programming
CF 106398D - Хомячьи бега

We are given a rectangular grid of size $N times M$. A hamster starts at the top-left cell and moves diagonally down-right at a 45-degree angle, marking every visited cell.

codeforcescompetitive-programming
CF 106396L - 福禄宴

We are given a set of points on a 2D plane. The task is to choose two vertical lines, meaning lines of the form $x = c1$ and $x = c2$, and also implicitly a horizontal line $y = c3$, so that the plane is split into four rectangular regions.

codeforcescompetitive-programming
CF 106396G - 狼与良

We are looking at a stochastic process over positions labeled from 0 to n - 1. At each step, the system redistributes probability mass across these positions using a fixed transition rule, so the state is always a probability distribution over the n positions.

codeforcescompetitive-programming
CF 106396C - 影子戏

We are given a rectangular board with dimensions $n times m$. Each cell can be interpreted as a position where we may place a chess piece, and the problem asks for the maximum number of pieces we can place under a movement restriction that comes from a knight-like attack rule.

codeforcescompetitive-programming
CF 106393D - Годжо Сатору запечатали

We are given a sequence of walls, each with a resistance value. A character starts with an initial punch strength and walks through a chosen contiguous segment of walls from left to right. When he encounters a wall, two things can happen depending on his current strength.

codeforcescompetitive-programming
CF 106387H - Ultimate Figure Skating

We are given a directed system where each element is a node and each rule is a directed edge describing how we can move from one node to another. Each node contributes some value, and when we walk along a directed path, we collect the values of visited nodes.

codeforcescompetitive-programming
CF 106387D - Revenge of the (C/K)or(e)ys

We are looking at a configuration problem involving a fixed number of positions and two types of indistinguishable objects. There are $2n$ positions in a line, and exactly $n$ of them are labeled as American stones while the remaining $n$ are Swedish stones.

codeforcescompetitive-programming
CF 106384M - 猫娘题

Each catgirl occupies a connected shape on an infinite grid. One specific cell of each shape is marked as the “eye”, and each catgirl faces one of eight compass directions.

codeforcescompetitive-programming
CF 106384J - 朴素的最长路问题

The task describes a graph problem where we are given a set of directed connections between nodes, and we are asked to determine the longest possible path that can be formed by following these directed edges.

codeforcescompetitive-programming
CF 106384G - LaVI-Bavellabion

I can’t write a correct editorial for this yet because the actual problem content is missing. What you’ve provided only includes the title (“LaVI-Bavellabion”) and empty input/output sections, so there’s no way to reconstruct the task, constraints, or required…

codeforcescompetitive-programming
CF 106384B - 事已至此就赌上性命来猜迷吧

I can’t produce a meaningful editorial for this problem as written, because the actual problem content is missing.

codeforcescompetitive-programming
CF 106362G - Four in a Row

We are counting permutations of the numbers from 1 up to n under a very specific evolving constraint: as the permutation grows, we keep track of patterns of four consecutive positions whose values form an increasing sequence.

codeforcescompetitive-programming
CF 106356I - Cosmic Bit Flip

The country can be seen as a tree with $n$ cities connected by $n-1$ roads, meaning there is exactly one simple path between any two cities. Some cities contain a special property, a “ley-line”, and we are only interested in the parity of how many such cities lie on a path.

codeforcescompetitive-programming
CF 106353F - Fair Share

A group of people has just finished a shared expense event, and each person has two relevant values. One value represents how much cash they can immediately contribute if someone else is responsible for paying the bill.

codeforcescompetitive-programming
CF 106328G - HDZ's Legendary Problem

A monster is defined by four base stats: attack, defense, health, and speed. On top of that, it has a fixed number of enhancement points that can be distributed freely, one point increasing exactly one of the four stats by one unit.

codeforcescompetitive-programming
CF 106270J - C-Style String Length

We are given a string that represents the raw inside of a C-style string literal, but restricted to only two possible characters: backslash and zero.

codeforcescompetitive-programming
CF 106262D - Drinking Culture

We are given a collection of bottles, where each bottle i contains a volume vi and an amount of alcohol ai. Every bottle is internally uniform, so any fraction of liquid taken from it preserves the same alcohol ratio ai / vi.

codeforcescompetitive-programming
CF 106252G - Collision Damage

We are given two convex polygons in the plane. Think of them as two rigid “collision shapes”. One polygon, call it P, stays fixed. The other polygon, Q, is translated by a vector t in the plane, without rotation or reflection.

codeforcescompetitive-programming
CF 106241D - Mini-Max Permutation

We are asked to construct a permutation of the integers from 1 to n. For every subarray of this permutation, we compute a value that depends on how spread out the numbers are inside it. Specifically, for a segment p[i..

codeforcescompetitive-programming
CF 106239G - 万能矩阵

We are asked to construct a square grid of size $2n times 2n$ filled with non-negative integers. Each cell value must not exceed $n^4$. The requirement is extremely strong: every integer $K$ from $1$ to $n^4$ must appear as the sum of some axis-aligned submatrix of this grid.

codeforcescompetitive-programming
CF 106238J - Fresh Days and Lovely Days

The problem statement you provided is empty, so there isn’t enough information to reconstruct what Codeforces 106238J (“Fresh Days and Lovely Days”) actually asks.

codeforcescompetitive-programming
CF 106225G - Git Gud

We are given a target number $n$. We must construct a fixed sequence of “missions”. Each mission has two parameters: a difficulty $y$ and a duration $l$. We do not control the initial skill $s$, except that it is some unknown integer in the range $[1, n]$.

codeforcescompetitive-programming
CF 106161L - Label Matching

We are given a connected weighted undirected graph. Several friends start from distinct nodes and all of them want to reach a common destination node, the mall at node 1.

codeforcescompetitive-programming
CF 106161A - A Lot of Paintings

We are given a small party of up to six characters who repeatedly fight over a long sequence of rounds. Each round starts with a fixed pool of energy, and each character may either use their skill once or stay idle.

codeforcescompetitive-programming
CF 106159D - Djqifs Tijgu

We are given a long sequence of numbers, and a shorter pattern sequence. We are allowed to choose a single shift value between 0 and 9999. Applying this shift means adding it to every element of the long sequence and taking everything modulo 10000.

codeforcescompetitive-programming
CF 106159K - Kronos

We are given a collection of timestamps representing when messages arrived from the future. Each timestamp is just a single integer on a very large number line.

codeforcescompetitive-programming
CF 106159G - Gelatos from Goiás

We are given a collection of ingredients, each with a numerical quality score. We want to choose a subset of these ingredients to maximize a specific score function.

codeforcescompetitive-programming
CF 106158D - Hamster Spectacle

We are given a sequence of positive integers arranged in a line. Each position represents a hamster, and each hamster contributes a set of “skills”, where a skill is simply any divisor of its number.

codeforcescompetitive-programming
CF 106153G - 琪露诺寻找锐角

We are given several test cases. Each test case provides a sequence of points in the plane in a fixed order. The task is to determine whether there exists a triple of indices that forms a triangle with at least one strictly acute angle, and if so, output one such triple.

codeforcescompetitive-programming
CF 106151D - packages

We are given a collection of packages, each package having two parameters. The first is a base cost that you pay once if you include that package in your delivery batch.

codeforcescompetitive-programming
CF 106144D - Gooseberry

We are simulating Monocarp’s eating schedule across a season of $n$ days. On some days he visits the market and buys a “batch” of gooseberries.

codeforcescompetitive-programming
CF 106142C - Построение порталов

We are given a directed graph where edges describe one-way movement between cities. In addition to traveling along these edges, we are allowed to place special “portals” in selected vertices.

codeforcescompetitive-programming
CF 106141L - Vector Magic

We are given an array of integers $a1, a2, dots, an$. For each position we must choose a value $bi$ from the restricted set ${-3, -1, 1, 3}$.

codeforcescompetitive-programming
CF 106141A - Stones and Bananas

We are given an $n times n$ grid where some cells contain stones and exactly two special cells contain bananas. The grid is not just a static picture: stones can be moved, but only up to $k$ stones may be relocated, and $k le 5$, which is the crucial limitation.

codeforcescompetitive-programming
CF 106139C - Expansion on Tree

I cannot reliably recover the exact statement of Codeforces 106139C “Expansion on Tree” from available sources in this environment, and the official problem page content is not accessible here.

codeforcescompetitive-programming