brain

tamnd's digital brain — notes, problems, research

43815 notes

CF 2006A - Iris and Game on the Tree

We are given a rooted tree with root fixed at vertex 1. Each vertex carries a label that is either 0, 1, or unknown. The unknown entries are the only things we are allowed to choose during the game, and the two players alternate assigning them values until every vertex is fixed.

codeforcescompetitive-programmingconstructive-algorithmsdfs-and-similargamesgraphsgreedytrees
CF 2006B - Iris and the Tree

This is a Type B (prove) problem. The requirement is to show that any triangle admitting a circle tangent to two of its sides and to two of its medians must necessarily be isosceles. The statement is exact and requires a complete geometric or analytic proof.

codeforcescompetitive-programmingbrute-forcedata-structuresdfs-and-similardsumathtrees
CF 2007A - Dora's Set

We start with all integers in the interval $[l,r]$. In one operation, we must choose three distinct numbers whose pairwise greatest common divisors are all equal to $1$. After choosing them, those three numbers are removed permanently.

codeforcescompetitive-programminggreedymathnumber-theory
Kvant Math Problem 588

For the planar analogue, take a triangle $ABC$ and a point $P$ inside it.

kvantmathematicsolympiad
CF 2007B - Index and Maximum Value

We are given an array, but the operations do not directly modify positions. Instead, each operation targets values: whenever we see a range $[l, r]$, every element whose current value lies in that numeric interval is incremented or decremented by exactly one.

codeforcescompetitive-programmingdata-structuresgreedy
CF 2008H - Sakurako's Test

We are given an array and a parameter $x$. With this $x$, we are allowed to repeatedly pick any element that is at least $x$ and reduce it by exactly $x$.

codeforcescompetitive-programmingbinary-searchbrute-forcegreedymathnumber-theory
CF 2008G - Sakurako's Task

This is a Type B (prove) problem. The requirement is to prove that for every point $P$ in the plane and for every choice of the distinguished vertex of the isosceles trapezoid, the sum of the distances from $P$ to the other three vertices is strictly greater than the distance…

codeforcescompetitive-programmingbinary-searchgreedymathnumber-theory
CF 2008E - Alternating String

We are given a string of lowercase letters. An alternating string has a very specific form. All characters at even indices must be identical, all characters at odd indices must be identical, and the final length must be even.

codeforcescompetitive-programmingbrute-forcedata-structuresdpgreedyimplementationstrings
Kvant Math Problem 517

A convex $n$-gon $A_1A_2\dots A_n$ is inscribed in a circle of radius $R$ with center $O$.

kvantmathematicsolympiad
CF 2008B - Square or Not

We are given a binary string that was originally formed by flattening a rectangular grid row by row. The grid is known to be “beautiful”, meaning its border cells are all 1 and all interior cells are 0.

codeforcescompetitive-programmingbrute-forcemathstrings
CF 2008F - Sakurako's Box

This is a Type B (prove) problem. The requirement is to prove that for every point $P$ in the plane and for every choice of the distinguished vertex of the isosceles trapezoid, the sum of the distances from $P$ to the other three vertices is strictly greater than the distance…

codeforcescompetitive-programmingcombinatoricsmathnumber-theory
CF 2008D - Sakurako's Hobby

We are given a permutation of integers from 1 to n, and each number is colored black or white. From any starting integer i, we can repeatedly apply the permutation to jump from i to pi, then to p{pi}, and so on.

codeforcescompetitive-programmingdpdsugraphsmath
CF 2008A - Sakurako's Exam

We are asked to decide whether it is possible to assign a positive or negative sign to each element in an array made up of a certain number of ones and twos such that the total sum becomes zero.

codeforcescompetitive-programmingbrute-forceconstructive-algorithmsgreedymath
CF 2008C - Longest Good Array

We are asked to construct an array of integers between two given bounds, l and r, such that the array is strictly increasing and the differences between consecutive elements are also strictly increasing. Our goal is to find the maximum possible length of such an array.

codeforcescompetitive-programmingbinary-searchbrute-forcemath
CF 2009G3 - Yunli's Subarray Queries (extreme version)

We are given an array and many range queries. For each query range $[l, r]$, we look at every subarray inside it whose length is at least $k$.

codeforcescompetitive-programmingdata-structuresdpimplementation
Kvant Math Problem 556

The answer is **yes**.

kvantmathematicsolympiad
Kvant Math Problem 574

Let

kvantmathematicsolympiad
Kvant Math Problem 576

Represent each chosen vector by an oriented edge of a directed graph whose vertices are the given points.

kvantmathematicsolympiad
CF 2009G2 - Yunli's Subarray Queries (hard version)

We are given an array a of size n. For each subarray of a, Yunli can perform an operation on any element to set it to any integer she wants. The goal is to form a consecutive increasing sequence of length at least k within that subarray.

codeforcescompetitive-programmingbinary-searchdata-structuresdp
CF 2009F - Firefly's Queries

We are given an array a of length n, and we are asked to handle queries on a much larger array b. This array b is constructed by taking all n cyclic shifts of a and concatenating them in order.

codeforcescompetitive-programmingbitmasksdata-structuresflowsmath
CF 2009G1 - Yunli's Subarray Queries (easy version)

We are given an array of integers and need to answer multiple queries. Each query asks for the minimum number of changes required to create a consecutive increasing subarray of length exactly k within a specified slice of the array.

codeforcescompetitive-programmingbinary-searchdata-structurestwo-pointers
CF 2009E - Klee's SUPER DUPER LARGE Array!!!

We are given a conceptual array that contains a strictly increasing sequence of integers starting at $k$ and ending at $k+n-1$.

codeforcescompetitive-programmingbinary-searchmathternary-search
CF 2009D - Satyam and Counting

Let $ABCD$ be an isosceles trapezoid with $ABparallel CD,$ and let $AB$ be the longer base. Then $ABCD.$ For a point $P$ in the plane, consider the quantity $S=PA+PB+PC+PD.

codeforcescompetitive-programminggeometrymath
CF 2009B - osu!mania

Each test case describes a small osu!mania beatmap with 4 columns. Every row contains exactly one note, marked by , and the remaining cells contain ..

codeforcescompetitive-programmingbrute-forceimplementation
CF 2009A - Minimize!

We are given multiple independent queries. Each query provides two integers a and b, and we are allowed to choose any integer c in the inclusive range between them. For each choice of c, we compute a cost defined as the distance from a to c plus the distance from c to b.

codeforcescompetitive-programmingbrute-forcemath
CF 2009C - The Legend of Freya the Frog

Codeforces 2009C: The Legend of Freya the Frog

codeforcescompetitive-programmingimplementationmath
CF 2010C2 - Message Transmission Error (hard version)

We are asked to determine whether a given string could have resulted from a very specific transmission error in a network. The error occurs when a message s is sent twice consecutively, and the second copy partially overlaps the first at some non-zero length.

codeforcescompetitive-programminghashingstring-suffix-structuresstringstwo-pointers
CF 2010A - Alternating Sum of Numbers

The task is to compute an alternating sum over a sequence of integers. Specifically, for each sequence, you start with the first number, add it, subtract the second number, add the third, subtract the fourth, and continue in this alternating pattern.

codeforcescompetitive-programmingbrute-forceimplementationmath
CF 2010B - Three Brothers

This is a Type B (proof) problem. To succeed, the solution must rigorously establish the stated vector identities for: 1. An equilateral triangle. 2. An arbitrary regular $n$-gon. 3. A regular tetrahedron.

codeforcescompetitive-programmingbrute-forceimplementationmath
CF 2010C1 - Message Transmission Error (easy version)

We receive a single string t that represents a message captured by a server. The server originally sends some string s twice in a row.

codeforcescompetitive-programmingbrute-forcestrings
CF 2011I - Stack and Queue

We maintain two evolving ordered structures over patients: one behaves like a FIFO queue (first in, first out) and the other like a stack (last in, first out). Each patient has a fixed service duration.

codeforcescompetitive-programming*specialdata-structuresdivide-and-conquer
CF 2011F - Good Subarray

We are asked to count all contiguous subarrays of a given integer array such that each subarray can be generated by a process that starts with a single integer and repeatedly appends either the same number, one less, or one more than an element already in the array.

codeforcescompetitive-programming*specialdata-structuresgreedy
CF 2011D - Among Wolves

We are given a 2-row by $n$-column grid representing a field, where each cell can be empty, contain a sheep, or contain a wolf. There is exactly one sheep, and some cells contain wolves.

codeforcescompetitive-programming*special
CF 2011H - Strange Matrix

This is a Type B (proof) problem. The required task is to prove the stated vector identities for: 1. An equilateral triangle. 2. A regular $n$-gon. 3. A regular tetrahedron. A valid solution must establish the identities themselves.

codeforcescompetitive-programming*specialgraphsgreedy
CF 2011G - Removal of a Permutation

Connection interrupted. Waiting for the complete answer

codeforcescompetitive-programming*special
CF 2011C - Split the Expression

We are given a string consisting of blocks of digits separated by plus signs, where each block has between 2 and 13 digits, and every digit is non-zero.

codeforcescompetitive-programming*special
CF 2011E - Rock-Paper-Scissors Bot

Working

codeforcescompetitive-programming*specialgreedystrings
Kvant Math Problem 561

The condition says that corresponding sides are parallel, but the directions are reversed.

kvantmathematicsolympiad
CF 2011A - Problem Solving

Jane has a list of problems with known difficulties. The last problem in the list is strictly harder than every earlier problem. Her skill level is some integer $x$.

codeforcescompetitive-programming*special
CF 2011B - Shuffle

We need to construct a permutation of numbers from 1 to n such that every adjacent pair follows a rule that depends on divisibility. If two neighboring numbers have a divisibility relationship, the sequence must increase at that point.

codeforcescompetitive-programming*special
Kvant Math Problem 482

Let the regular tetrahedron be $ABCD$, with edge length $a$.

kvantmathematicsolympiad
CF 2013F1 - Game in Tree (Easy Version)

We are given a tree. One player, Alice, always starts at vertex 1. The other player, Bob, starts at a vertex that lies on a fixed simple path between two vertices u and v.

codeforcescompetitive-programmingbinary-searchbrute-forcedata-structuresdpgamesgreedyimplementationtrees
CF 2013A - Zhan's Blender

Zhan has a number of fruits, and he wants to blend all of them as quickly as possible using a blender with two constraints. Each second, he can put at most a fixed number of fruits into the blender, and the blender can process a maximum number of fruits per second.

codeforcescompetitive-programmingconstructive-algorithmsmath
CF 2014H - Robin Hood Archery

For each query we look only at the subarray $al, a{l+1}, dots, ar$. Robin moves first. On every turn a player chooses any remaining target, gains its value, and removes it.

codeforcescompetitive-programmingdata-structuresdivide-and-conquergreedyhashing
CF 2014G - Milky Days

We are tracking Little John's milk consumption over time. He receives milk in discrete batches, each associated with a day and a quantity. Milk has a freshness limit k days, meaning that milk acquired on day di will spoil after day di + k - 1.

codeforcescompetitive-programmingbrute-forcedata-structuresgreedyimplementation
CF 2014F - Sheriff's Defense

We are given a tree where each node represents a camp holding some amount of gold. We may choose certain camps to “strengthen”. Strengthening a camp does not change its own gold directly, but it reduces the gold of all its neighbors by a fixed amount $c$.

codeforcescompetitive-programmingdfs-and-similardpgreedytrees
CF 2014D - Robert Hood and Mrs Hood

Each job occupies an interval of days [l, r]. A visitor stays for exactly d consecutive days, so choosing a start day s means the visit covers the interval [s, s + d - 1]. A job is counted if it overlaps the visit at least once. The amount of overlap does not matter.

codeforcescompetitive-programmingbrute-forcedata-structuresgreedysortings
CF 2014E - Rendez-vous de Marian et Robin

We are working on a weighted undirected graph where two people start from opposite ends and want to meet as quickly as possible. One starts at vertex 1 and the other at vertex n.

codeforcescompetitive-programmingdfs-and-similargraphsshortest-paths
CF 2014C - Robin Hood in Town

We are asked to determine how much extra gold must be added to the richest person in a town so that strictly more than half of the population becomes unhappy. Each person's happiness depends on whether their wealth is less than half of the average wealth of the town.

codeforcescompetitive-programmingbinary-searchgreedymath
CF 2014A - Robin Helps

This is a construction and impossibility problem (type D/B hybrid). For each case, the task is either to construct an explicit set of numbers such that all sums of three distinct elements are prime, or to prove that no such set exists. Each of the four subcases is independent.

codeforcescompetitive-programminggreedyimplementation
CF 2014B - Robin Hood and the Major Oak

The tree produces new leaves every year. In year $i$, it grows $i^i$ leaves. Leaves do not stay forever. A leaf created in year $i$ remains on the tree for exactly $k$ years, meaning it is present during years $i, i+1, dots, i+k-1$.

codeforcescompetitive-programmingmath
Kvant Math Problem 475

Assume that an equilateral triangle has all three vertices at lattice points.

kvantmathematicsolympiad
CF 2018F3 - Speedbreaker Counting (Hard Version)

We are asked to count arrays of integers representing "time limits" for conquering cities in a row, and then categorize those arrays by how many starting cities allow a valid conquest.

codeforcescompetitive-programmingdpgreedymath
CF 2018F1 - Speedbreaker Counting (Easy Version)

The problem asks us to count arrays of length $n$ where each element $ai$ is a positive integer between 1 and $n$, and to categorize these arrays based on how many starting cities allow a sequential conquest without violating the upper limits $ai$.

codeforcescompetitive-programmingcombinatoricsdpgreedymath
CF 2018F2 - Speedbreaker Counting (Medium Version)

I can't provide a complete, correct editorial and implementation for this problem from the information available here. I was able to retrieve the official editorial hints and the high-level solution outline.

codeforcescompetitive-programmingdpgreedymath
CF 2018E1 - Complex Segments (Easy Version)

We are given a collection of closed segments on a number line, each defined by a left and right endpoint. The goal is to identify the largest possible subset of these segments that forms a "complex" set.

codeforcescompetitive-programmingbinary-searchdata-structuresdivide-and-conquerdsugreedymathsortings
CF 2018E2 - Complex Segments (Hard Version)

Producing a fully correct editorial for Codeforces 2018E2 requires reconstructing a fairly intricate DSU-based optimization and the divide-and-conquer evaluation of all values of $f(m)$.

codeforcescompetitive-programmingbinary-searchdata-structuresdivide-and-conquerdsugreedymathsortings
CF 2018D - Max Plus Min Plus Size

We are given a one-dimensional array of positive integers and the ability to color some elements red. The restriction is that no two consecutive elements can be red.

codeforcescompetitive-programmingdata-structuresdpdsugreedyimplementationmatricessortings
CF 2018C - Tree Pruning

We are given a tree rooted at node 1, and we can remove leaves one by one along with their connecting edges. The goal is to make all remaining leaves equidistant from the root. A leaf is any node with degree 1 that is not the root.

codeforcescompetitive-programmingbrute-forcedfs-and-similargreedysortingstrees
CF 2018A - Cards Partition

We are given multiple independent scenarios. In each one, we start with a multiset of cards where each integer value from $1$ to $n$ appears a certain number of times. We are allowed to add up to $k$ extra cards of any values we choose.

codeforcescompetitive-programming2-satbrute-forcegreedyimplementationmath
CF 2018B - Speedbreaker

We are given a line of cities, each city indexed from left to right, and each city comes with a deadline that tells us how late it is allowed to be conquered.

codeforcescompetitive-programmingbinary-searchdata-structuresdpgreedyimplementationtwo-pointers
CF 2019B - All Pairs Segments

We are given a set of points on the number line, each at a distinct positive integer coordinate, and we want to understand coverage by segments formed between every pair of points.

codeforcescompetitive-programmingimplementationmath
CF 2019A - Max Plus Size

We are given an array of positive integers and asked to select a subset of elements to color red, subject to a simple restriction: no two red elements can be adjacent.

codeforcescompetitive-programmingbrute-forcedpgreedy
CF 2020E - Expected Power

We are given an array of integers, each with an independent probability of being included in a random multiset. The task is to compute the expected value of the square of the XOR of all selected elements.

codeforcescompetitive-programmingbitmasksdpmathprobabilities
Kvant Math Problem 496

A six-digit number can be written as the product of two three-digit numbers if and only if it belongs to the set

kvantmathematicsolympiad
CF 2020F - Count Leaves

Codeforces 2020F: Count Leaves

codeforcescompetitive-programmingdpmathnumber-theory
CF 2020D - Connect the Dots

We are given a set of points on a line, initially completely disconnected. Each operation takes a starting position, a fixed step size, and a length, and then connects all points that lie in that arithmetic progression segment.

codeforcescompetitive-programmingbrute-forcedpdsugraphsmathtrees
CF 2020C - Bitwise Balancing

We are given three non-negative integers b, c, and d. We must construct a non-negative integer a such that $$(a mid b) - (a & c) = d$$ where The task is not to optimize some value of a. Any valid a is acceptable. If no such value exists, we print -1.

codeforcescompetitive-programmingbitmaskshashingimplementationmathschedulesternary-search
CF 2020B - Brightness Begins

We are given a process on a line of bulbs indexed from $1$ to $n$. Initially every bulb is on. We then repeatedly flip bulbs in a structured way: for each $i$, every multiple of $i$ has its state toggled once.

codeforcescompetitive-programmingbinary-searchmath
CF 2020A - Find Minimum Operations

We are asked to reduce a given integer n to zero by repeatedly subtracting powers of a second integer k. Each subtraction can use any power of k (including k^0 = 1), and the goal is to minimize the number of subtractions.

codeforcescompetitive-programmingbitmasksbrute-forcegreedymathnumber-theory
CF 2021E3 - Digital Village (Extreme Version)

We are given a connected village represented as a graph. Each node is a house, and edges are internet cables with a latency weight. Some subset of houses specifically need internet.

codeforcescompetitive-programmingdata-structuresdfs-and-similardpdsugraphsgreedymathtrees
Kvant Math Problem 473

Let the weights in the first group be

kvantmathematicsolympiad
CF 2021E1 - Digital Village (Easy Version)

In this problem, we are given a village represented as a connected graph with houses as nodes and internet cables as edges. Each edge has a latency, representing the delay of transmitting data along that cable.

codeforcescompetitive-programmingbrute-forcedata-structuresdfs-and-similardpdsufftgraphsgreedyimplementationmathtrees
CF 2021E2 - Digital Village (Hard Version)

We are given a connected undirected graph representing a village, where nodes are houses and edges are internet cables with latencies. A subset of houses requires internet, and we are allowed to place servers at up to k houses.

codeforcescompetitive-programmingdata-structuresdpdsugraphsmathtrees
CF 2021D - Boss, Thirsty

We are asked to plan drink sales over several days in a canteen. Each day, there are multiple drink types, each with a projected profit that can be positive or negative. On any day, we must select a contiguous segment of drink types to sell.

codeforcescompetitive-programmingdpgreedyimplementation
CF 2021C2 - Adjust The Presentation (Hard Version)

We have a fixed permutation a describing the initial order of team members in a line. During the presentation, the person currently at the front presents the next slide.

codeforcescompetitive-programmingconstructive-algorithmsdata-structuresgreedyimplementationsortings
CF 2021C1 - Adjust The Presentation (Easy Version)

We are given an initial lineup of people, where each person appears exactly once. A sequence of presentations must be delivered in a fixed order, and each presentation is assigned to a specific person.

codeforcescompetitive-programmingconstructive-algorithmsgreedy
CF 2021A - Meaning Mean

We are given an array of positive integers and a process that repeatedly combines two elements into a single new element: we pick two distinct elements, compute the floor of their average, remove the original two, and append the new number.

codeforcescompetitive-programmingdata-structuresgreedymathsortings
CF 2021B - Maximize Mex

We start with an array of non-negative integers. The only operation allowed is to pick an element and add x to it. We may repeat this operation any number of times on any element. Adding x repeatedly has a very specific effect.

codeforcescompetitive-programmingbrute-forcegreedymathnumber-theory
CF 2022E2 - Billetes MX (Hard Version)

We are asked to count the number of ways to fill an integer grid with certain cells already preassigned so that the grid is "beautiful." A grid is beautiful if, for any rectangle defined by four corners, the XOR of the corner values equals zero.

codeforcescompetitive-programmingbinary-searchcombinatoricsdata-structuresdsugraphs
Kvant Math Problem 459

Let the route produced by the minimum-greedy algorithm be

kvantmathematicsolympiad
CF 2022E1 - Billetes MX (Easy Version)

We are given a partially specified n × m grid. Some cells already contain integers in the range [0, 2³⁰), while the remaining cells are unknown. A grid is called beautiful if every axis-aligned rectangle satisfies the XOR condition on its four corners.

codeforcescompetitive-programming2-satbinary-searchcombinatoricsconstructive-algorithmsdfs-and-similardsugraphs
CF 2022D2 - Asesino (Hard Version)

The task is to find the single Impostor among $n$ players in an interactive game where each player has one of three roles: Knight, Knave, or Impostor. Knights always tell the truth, Knaves always lie, and the Impostor behaves like a Knave from the perspective of all others.

codeforcescompetitive-programmingconstructive-algorithmsdpinteractive
CF 2022D1 - Asesino (Easy Version)

In this problem, we are asked to identify a single Impostor among n players, where every player is either a Knight, a Knave, or the Impostor.

codeforcescompetitive-programmingbinary-searchbrute-forceconstructive-algorithmsimplementationinteractive
CF 2022A - Bus to Pénjamo

Each bus row contains exactly two seats. We have several families, and family i contains ai people. A person is happy in one of two situations. They sit next to a member of the same family, or they occupy a row alone with the other seat empty.

codeforcescompetitive-programmingconstructive-algorithmsgreedyimplementationmath
CF 2022B - Kar Salesman

Each test case describes a dealership with several car models, where model i has ai identical cars that must all be sold.

codeforcescompetitive-programmingbinary-searchgreedymath
CF 2022C - Gerrymandering

We are given a voting grid with exactly two rows and n columns, where each cell is labeled either “A” or “J”, representing how that house will vote.

codeforcescompetitive-programmingdpimplementation
CF 2023F - Hills and Pits

We are given an array of nonzero integers representing a one-dimensional terrain. Positive values mean surplus sand that must be removed, and negative values mean deficits that must be filled.

codeforcescompetitive-programmingdata-structuresgreedymathmatrices
CF 2023E - Tree of Life

We are given a tree of n nodes, which are connected by n-1 edges. Each node can be thought of as a source of magical energy, and each edge as a channel through which this energy flows.

codeforcescompetitive-programmingdpgreedytrees
CF 2023D - Many Games

The problem presents a casino with multiple games, each offering a chance to win a certain amount. Each game has two parameters: a probability of winning, given as a percentage, and a payout if you win.

codeforcescompetitive-programmingbrute-forcedpgreedymathprobabilities
Kvant Math Problem 464

Let each square correspond to its center.

kvantmathematicsolympiad
CF 2023B - Skipping

We are given a sequence of problems in an olympiad, each with a score and a skip parameter. The competition begins with the first problem.

codeforcescompetitive-programmingbinary-searchdpgraphsshortest-paths
CF 2023A - Concatenation of Arrays

We are given n arrays, and every array contains exactly two numbers. We may reorder these arrays in any way we want, but inside each array the order of the two elements must remain unchanged. After choosing an order, we concatenate all arrays and obtain one sequence of length 2n.

codeforcescompetitive-programmingconstructive-algorithmsgreedymathsortings
CF 2023C - C+K+S

We are given two directed graphs, each with the same number of vertices. Each graph is already strongly connected, and every directed cycle inside each graph has length divisible by a fixed integer $k$.

codeforcescompetitive-programmingconstructive-algorithmsdfs-and-similargraphsgreedyhashingimplementationstrings
CF 2024A - Profitable Interest Rate

We are given two types of bank deposits and a number of coins Alice has. The "Profitable" deposit requires at least a certain amount, b, to open, while the "Unprofitable" deposit has no minimum.

codeforcescompetitive-programminggreedymath
Kvant Math Problem 419

Let $D_{16}$ denote the closed disk of radius $16$ centered at the origin, and suppose $650$ points $P_1, \dots, P_{650}$ are placed in $D_{16}$.

kvantmathematicsolympiad
Kvant Math Problem 414

Let the convex pentagon be $A_1A_2A_3A_4A_5$, with indices taken modulo $5$.

kvantmathematicsolympiad
CF 2025E - Card Game

The core issue is not a boundary bug or a missing case. The previous approach was fundamentally overconstrained: it tried to force both segments to be aligned with axes and also tied them to a single corner or a simplistic placement rule.

codeforcescompetitive-programmingcombinatoricsdpfftgreedymath
CF 2025G - Variable Damage

The problem models a turn-based battle between a dragon and an army of heroes protected by artifacts. Each hero has a health value and each artifact has a durability value. A hero can hold at most one artifact, and artifacts can only protect heroes while they are active.

codeforcescompetitive-programmingdata-structuresflows
CF 2025D - Attribute Checks

We are given a sequence of game records where each element represents either acquiring an attribute point or encountering an attribute check. The character starts with Strength and Intelligence at zero.

codeforcescompetitive-programmingbrute-forcedata-structuresdpimplementationmathtwo-pointers