brain

tamnd's digital brain — notes, problems, research

41650 notes

LeetCode 3740 - Minimum Distance Between Three Equal Elements I

The problem gives us an integer array nums and asks us to find three distinct indices (i, j, k) such that all three positions contain the same value: Such a triple is called a good tuple.

leetcodeeasyarrayhash-table
LeetCode 3735 - Lexicographically Smallest String After Reverse II

The problem is asking us to manipulate a string s of length n in order to produce the lexicographically smallest possible string after exactly one operation.

leetcodehardstringbinary-searchrolling-hashsuffix-arrayhash-function
LeetCode 3732 - Maximum Product of Three Elements After One Replacement

This problem asks us to maximize the product of any three distinct elements in an array, given that we are allowed to replace exactly one element in the array with any integer from -10^5 to 10^5. The input is an integer array nums of length at least 3 and at most 10^5.

leetcodemediumarraymathgreedysorting
LeetCode 3719 - Longest Balanced Subarray I

The problem asks us to find the longest contiguous subarray of an integer array nums such that the number of distinct even numbers in the subarray is equal to the number of distinct odd numbers.

leetcodemediumarrayhash-tabledivide-and-conquersegment-treeprefix-sum
LeetCode 3713 - Longest Balanced Substring I

The problem is asking us to find the length of the longest substring of a given string s where all distinct characters in that substring appear the same number of times.

leetcodemediumhash-tablestringcountingenumeration
LeetCode 3701 - Compute Alternating Sum

This problem asks us to compute the alternating sum of an integer array nums. The alternating sum is calculated by taking the sum of elements at even indices (0, 2, 4, ...) and subtracting the sum of elements at odd indices (1, 3, 5, ...).

leetcodeeasyarraysimulation
LeetCode 3678 - Smallest Absent Positive Greater Than Average

The crash is now purely an input-format mismatch, and it already reveals exactly where the implementation diverges from the actual problem.

leetcodeeasyarrayhash-table
LeetCode 3673 - Find Zombie Sessions

Exercise 4.3.1.7 asks for the average number of times the algorithm of Exercise 5 finds that a carry propagates through exactly digits of the partial answer, for , under the assumption that both inputs are independent and uniformly distributed integers in .

leetcodehard
LeetCode 3670 - Maximum Product of Two Integers With No Common Bits

The problem asks us to find the maximum product of two distinct elements in an array of integers, under the constraint that their binary representations do not share any set bits.

leetcodemediumarraydynamic-programmingbit-manipulation
LeetCode 3669 - Balanced K-Factor Decomposition

The problem asks us to split a positive integer n into exactly k positive integers such that the product of these integers equals n. Among all possible splits, we are required to find one in which the maximum difference between any two numbers is minimized.

leetcodemediummathbacktrackingnumber-theory
LeetCode 3659 - Partition Array Into K-Distinct Groups

We are given an integer array nums and an integer k. The goal is to determine whether all elements of the array can be partitioned into one or more groups such that every group satisfies two conditions: 1. Each group contains exactly k elements. 2.

leetcodemediumarrayhash-tablecounting
LeetCode 3649 - Number of Perfect Pairs

This problem asks us to count the number of perfect pairs in an integer array nums. A pair (i, j) is perfect if i < j and the elements at these indices satisfy two conditions: the minimum of |a - b| and |a + b| is less than or equal to the smaller absolute value of the two…

leetcodemediumarraymathtwo-pointerssorting
LeetCode 3637 - Trionic Array I

We interpret the task as follows. Two nonnegative integers are given in radix , each represented as a sequence of digits. The digits are not processed in the standard right-to-left carry propagation.

leetcodeeasyarray
LeetCode 3644 - Maximum K to Sort a Permutation

The problem provides a permutation array nums of length n, meaning it contains each integer from 0 to n-1 exactly once, in some arbitrary order.

leetcodemediumarraybit-manipulation
LeetCode 3628 - Maximum Number of Subsequences After One Inserting

The solution partially addresses the exercise, but it does not fully satisfy what was asked. The exercise is not asking for modern algorithms that resemble the work of Sun Tsï, al-Khwārizmī, al-Uqlidisī, Fibonacci, and Recorde.

leetcodemediumstringdynamic-programminggreedyprefix-sum
LeetCode 3624 - Number of Integers With Popcount-Depth Equal to K II

The problem asks us to efficiently handle queries on an array nums involving a special property called the popcount-depth.

leetcodehardarraydivide-and-conquerbinary-indexed-treesegment-tree
LeetCode 3627 - Maximum Median Sum of Subsequences of Size 3

We are given an array nums whose length is always divisible by 3. The array must be emptied by repeatedly selecting exactly three elements. For each selected triple, we compute its median, add that median to our answer, and remove all three elements from the array.

leetcodemediumarraymathgreedysortinggame-theory
LeetCode 3629 - Minimum Jumps to Reach End via Prime Teleportation

This problem is essentially about navigating an array using two types of moves: adjacent steps and prime-based teleportation. You start at the first index and want to reach the last index in the minimum number of moves.

leetcodemediumarrayhash-tablemathbreadth-first-searchnumber-theory
LeetCode 3603 - Minimum Cost Path with Alternating Directions II

No. The proposed solution does not answer Exercise 4.3.1.1 at all. Exercise 4.3.1.1 asks the reader to study the early history of classical arithmetic algorithms by consulting historical sources (e.g.

leetcodemediumarraydynamic-programmingmatrix
LeetCode 3623 - Count Number of Trapezoids I

The problem asks us to count the number of horizontal trapezoids that can be formed from a set of points in 2D Cartesian space.

leetcodemediumarrayhash-tablemathgeometry
LeetCode 3613 - Minimize Maximum Component Cost

The problem asks us to minimize the maximum cost among components in a connected undirected graph after removing edges. Each edge has a weight, and the cost of a connected component is the largest weight of any edge in that component.

leetcodemediumbinary-searchunion-findgraph-theorysorting
LeetCode 3608 - Minimum Time for K Connected Components

We are given an undirected graph with n vertices and a list of edges. Each edge has a removal time timei. The graph evolves over time. At time t, every edge whose removal time satisfies timei <= t has already been removed. All remaining edges are those with timei t.

leetcodemediumbinary-searchunion-findgraph-theorysorting
CF 1558B - Up the Strip

We are given a token placed at position $n$ on a vertical line of cells labeled from $1$ at the top to $n$ at the bottom. The goal is to count how many distinct sequences of moves can bring the token from $n$ down to $1$. From a position $x 1$, two types of moves are allowed.

codeforcescompetitive-programmingbrute-forcedpmathnumber-theorytwo-pointers
LeetCode 3601 - Find Drivers with Improved Fuel Efficiency

This problem asks us to analyze fuel efficiency trends for drivers across two different periods of the year. We are given two tables: - drivers, which stores each driver's identifier and name.

leetcodemediumdatabase
LeetCode 3602 - Hexadecimal and Hexatrigesimal Conversion

The problem gives us a single integer n and asks us to construct a string from two different number system conversions.

leetcodeeasymathstring
LeetCode 3584 - Maximum Product of First and Last Elements of a Subsequence

Program B is designed to perform a sequence of numerical calculations using the X-register of a hypothetical or HP-style RPN calculator. In such machines, the X-register holds the current number on the stack.

leetcodemediumarraytwo-pointers
LeetCode 3598 - Longest Common Prefix Between Adjacent Strings After Removals

We are given a token placed at position on a vertical line of cells labeled from at the top to at the bottom. The goal is to count how many distinct sequences of moves can bring the token from down to . From a position , two types of moves are allowed.

leetcodemediumarraystring
LeetCode 3587 - Minimum Adjacent Swaps to Alternate Parity

The problem requires transforming a given array of distinct integers into an arrangement where the parity of adjacent elements alternates - that is, an even number must always be next to an odd number, and vice versa.

leetcodemediumarraygreedy
LeetCode 3583 - Count Special Triplets

This problem asks us to count the number of special triplets in an integer array nums. A special triplet (i, j, k) must satisfy three conditions: the indices are strictly increasing 0 <= i < j < k < n, nums[i] is exactly double nums[j], and nums[k] is also exactly double nums[j].

leetcodemediumarrayhash-tablecounting
LeetCode 3562 - Maximum Profit from Trading Stocks with Discounts

This problem asks us to maximize profit from buying and selling stocks under a hierarchical discount structure. Each employee can buy a stock today at a present price and sell it tomorrow at a future price.

leetcodehardarraydynamic-programmingtreedepth-first-search
CF 1559A - Mocha and Math

We are given an array of integers and allowed to perform a repeated operation: choose any contiguous subarray and replace each element in it with the bitwise AND of itself and its symmetric counterpart relative to the interval.

codeforcescompetitive-programmingbitmasksconstructive-algorithmsmath
LeetCode 3569 - Maximize Count of Distinct Primes After Split

Here is a complete, detailed technical solution guide following your exact formatting rules. This problem asks us to handle dynamic array updates and, after each update, find the maximum sum of distinct prime counts across any valid split of the array.

leetcodehardarraymathsegment-treenumber-theory
LeetCode 3551 - Minimum Swaps to Sort by Digit Sum

The problem asks us to sort an array of distinct positive integers not by their natural numeric value, but by the sum of their digits. If two numbers share the same digit sum, the smaller number must come first.

leetcodemediumarrayhash-tablesorting
LeetCode 3568 - Minimum Moves to Clean the Classroom

We are given a grid representing a classroom. A student starts at the cell marked 'S' and must collect every litter cell marked 'L'. Movement is allowed only in the four cardinal directions, and moving one cell costs exactly one unit of energy.

leetcodemediumarrayhash-tablebit-manipulationbreadth-first-searchmatrix
LeetCode 3564 - Seasonal Sales Analysis

This problem asks us to analyze sales data and determine the most popular product category for each season based on the total quantity sold.

leetcodemediumdatabase
LeetCode 3539 - Find Sum of Array Product of Magical Sequences

The expression in the statement should be interpreted as: A sequence seq of length m is magical when the binary representation of this sum contains exactly k set bits. Each element of the sequence is an index into nums. The contribution of an index i is the power of two .

leetcodehardarraymathdynamic-programmingbit-manipulationcombinatoricsbitmask
LeetCode 3555 - Smallest Subarray to Sort in Every Sliding Window

We are given an array nums and a window size k. For every contiguous subarray of length k, we must determine the minimum length of a continuous segment that needs to be sorted so that the entire window becomes non-decreasing.

leetcodemediumarraytwo-pointersstackgreedysortingmonotonic-stack
LeetCode 3550 - Smallest Index With Digit Sum Equal to Index

This problem asks us to find the smallest index i in an integer array nums such that the sum of the digits of nums[i] equals i. In other words, for each element in the array, we compute the sum of its digits and check whether that sum matches the element's index.

leetcodeeasyarraymath
LeetCode 3548 - Equal Sum Grid Partition II

The problem is asking whether a given m x n matrix of positive integers can be split exactly once, either horizontally or vertically, such that the sums of the two resulting sections are equal, or can be made equal by discounting at most one cell.

leetcodehardarrayhash-tablematrixenumerationprefix-sum
CF 1560E - Polycarp and String Transformation

We are given a string t which is generated from some original string s through a specific sequence of operations. Starting with an empty string t, Polycarp repeatedly appends the current s to t and then removes all occurrences of one chosen character from s.

codeforcescompetitive-programmingbinary-searchimplementationsortingsstrings
LeetCode 3531 - Count Covered Buildings

A single-precision floating point number in MIX, as defined in Section 4.2.1, consists of a sign byte, an exponent field, and a normalized fraction stored in one word.

leetcodemediumarrayhash-tablesorting
LeetCode 3537 - Fill a Special Grid

The problem asks us to generate a special 2ⁿ x 2ⁿ grid filled with integers from 0 to 4ⁿ - 1 (note that 22n - 1 in the problem is likely a typo; it should be 4^n - 1) such that certain order constraints between quadrants are satisfied.

leetcodemediumarraydivide-and-conquermatrix
LeetCode 3526 - Range XOR Queries with Subarray Reversals

Here’s a full technical solution guide for LeetCode 3526 - Range XOR Queries with Subarray Reversals following your requested structure and formatting: The problem provides an array nums of integers and a list of queries, where each query can either update a value in the…

leetcodehardarraytreebinary-tree
LeetCode 3522 - Calculate Score After Performing Instructions

This problem asks you to simulate a linear sequence of instructions that can either modify a running score or move the instruction pointer by a specified offset. You are given two arrays, instructions and values, both of size n. Each index i represents an instruction.

leetcodemediumarrayhash-tablestringsimulation
CF 1560A - Dislike of Threes

We are asked to generate a sequence of positive integers that Polycarp "likes." A number is liked if it is not divisible by 3 and does not end with the digit 3. Given an integer $k$, the task is to output the $k$-th number in this sequence.

codeforcescompetitive-programmingimplementation
LeetCode 3520 - Minimum Threshold for Inversion Pairs Count

Program M computes a double-precision product by expanding each normalized operand into high and low halves, forming four partial products, then discarding all terms that lie strictly to the right of the retained word boundary.

leetcodemediumarraybinary-searchbinary-indexed-treesegment-tree
LeetCode 3502 - Minimum Cost to Reach Every Position

You are given an array cost where cost[i] represents how much person i charges if you want to swap places with them while they are in front of you. Initially, you stand at position n, which is the very end of a line containing positions 0 through n.

leetcodeeasyarray
LeetCode 3495 - Minimum Operations to Make Array Elements Zero

This problem asks us to determine the minimum number of operations required to reduce all elements of arrays defined by queries to zero, where each query [l, r] defines an array of consecutive integers from l to r.

leetcodehardarraymathbit-manipulation
CF 1561C - Deep Down Below

We are given a hero facing a sequence of caves. Each cave contains a number of monsters, each with an armor value, and the hero can defeat a monster only if his current power is strictly greater than the monster's armor.

codeforcescompetitive-programmingbinary-searchgreedysortings
LeetCode 3487 - Maximum Unique Subarray Sum After Deletion

The problem asks us to find the maximum sum of a subarray from an integer array nums under two key constraints: all elements in the chosen subarray must be unique, and we are allowed to delete any number of elements (except leaving the array empty) before selecting the subarray.

leetcodeeasyarrayhash-tablegreedy
CF 1562F - Tubular Bells

We are given a hidden permutation of integers that forms a contiguous interval, but the endpoints of that interval are unknown. Each position in the permutation stores a distinct integer, and together they cover every value in some range of length $n$.

codeforcescompetitive-programminginteractivemathnumber-theoryprobabilities
CF 1562D2 - Two Hundred Twenty One (hard version)

We are given a binary sequence where each position has a value either +1 or -1. A query gives a segment of this sequence, and we are allowed to delete elements from that segment.

codeforcescompetitive-programmingdata-structuresmath
LeetCode 3466 - Maximum Coin Collection

The problem describes Mario driving along a two-lane freeway with coins (or tolls) on each mile. The arrays lane1 and lane2 represent the coin values at each mile for each lane. Positive numbers mean Mario collects coins, negative numbers mean Mario loses coins.

leetcodemediumarraydynamic-programming
CF 1562E - Rescue Niwen!

Program M computes a double-precision product by expanding each normalized operand into high and low halves, forming four partial products, then discarding all terms that lie strictly to the right of the retained word boundary.

codeforcescompetitive-programmingdpgreedystring-suffix-structuresstrings
LeetCode 3483 - Unique 3-Digit Even Numbers

Here’s a comprehensive technical guide for LeetCode 3483 following your requested format: The problem asks us to determine the number of distinct three-digit even numbers that can be formed from an array of digits called digits.

leetcodeeasyarrayhash-tablerecursionenumeration
LeetCode 3431 - Minimum Unlocked Indices to Sort Nums

We are given two arrays of equal length: - nums, where every value is either 1, 2, or 3 - locked, where each value is either 0 or 1 The array is considered sortable if we can repeatedly perform certain adjacent swaps until the array becomes sorted in nondecreasing order.

leetcodemediumarrayhash-table
LeetCode 3443 - Maximum Manhattan Distance After K Changes

The input is a string s consisting of the four cardinal directions 'N', 'S', 'E', and 'W'. Starting from the origin (0, 0), we perform the moves one by one in the order given by the string.

leetcodemediumhash-tablemathstringcounting
CF 1562A - The Miracle and the Sleeper

The task asks us to maximize the remainder when one integer divides another, given a range of integers. Specifically, we have two integers, l and r, and we can choose any pair (a, b) such that b is at least l and at most a, and a is at most r.

codeforcescompetitive-programminggreedymath
LeetCode 3434 - Maximum Frequency After Subarray Operation

We are given an array nums and a target value k. We must perform exactly one operation: 1. Choose a contiguous subarray nums[i..j]. 2. Choose an integer x. 3. Add x to every element inside that subarray.

leetcodemediumarrayhash-tabledynamic-programminggreedyenumerationprefix-sum
LeetCode 3025 - Find the Number of Ways to Place People I

The proposed solution does not address the actual content of the TAOCP exercise. The exercise is about constructing and explaining numerical instability in floating point evaluation of algebraically equivalent expressions, but the “solution” instead discusses Python…

leetcodemediumarraymathgeometrysortingenumeration
CF 1562D1 - Two Hundred Twenty One (easy version)

The proposed solution does not address the actual content of the TAOCP exercise. The exercise is about constructing and explaining numerical instability in floating point evaluation of algebraically equivalent expressions, but the “solution” instead discusses Python…

codeforcescompetitive-programmingdata-structuresdpmath
CF 1562B - Scenes From a Memory

We are given a number n without zeros in its decimal representation, and the task is to remove some digits to obtain a number that is not prime, either a composite number or 1. The goal is to remove as many digits as possible while still ensuring the result is not prime.

codeforcescompetitive-programmingbrute-forceconstructive-algorithmsimplementationmathnumber-theory
CF 1562C - Rings

We are given a binary string representing a sequence of rings, where each character is either 0 or 1. Any contiguous segment of this string can be interpreted as a binary number, and its value is obtained in the usual way: reading left to right, shifting previous value by one…

codeforcescompetitive-programmingconstructive-algorithmsmath
LeetCode 3432 - Count Partitions with Even Sum Difference

The problem gives us an integer array nums of length n. We must consider every possible partition point between elements, where the array is split into two non-empty parts. For a partition at index i: - The left subarray is nums[0...i]. - The right subarray is nums[i+1...n-1].

leetcodeeasyarraymathprefix-sum
Kvant Physics Problem 201

The circuit consists of one or more batteries connected to a fixed external resistor.

kvantphysics
LeetCode 3426 - Manhattan Distances of All Arrangements of Pieces

We are given an m × n grid and must place exactly k identical pieces onto distinct cells. Every possible placement of these k pieces is considered a valid arrangement. For a single arrangement, we compute the sum of Manhattan distances between every pair of placed pieces.

leetcodehardmathcombinatorics
LeetCode 3404 - Count Special Subsequences

We are given an array nums of positive integers and need to count how many subsequences of length four satisfy a specific multiplicative relationship.

leetcodemediumarrayhash-tablemathenumeration
LeetCode 3405 - Count the Number of Arrays with K Matching Adjacent Elements

We are given three integers: - n, the length of the array. - m, the number of possible values each element may take, namely integers in the range [1, m]. - k, the exact number of adjacent pairs that must be equal.

leetcodehardmathcombinatorics
CF 1566H - Xor-quiz

We are given a hidden set $A$ of size $n$, where every element is an integer between $1$ and $c$. We can query any value $x$, and the judge responds with a value computed from the elements of $A$: it takes all $y in A$ that are coprime with $x$, and XORs them together.

codeforcescompetitive-programmingconstructive-algorithmsdpinteractivemathnumber-theory
LeetCode 3313 - Find the Last Marked Nodes in Tree

We are given an undirected tree with n nodes. A tree is a connected graph with exactly n - 1 edges and no cycles. For every node i, we perform the following process: - Node i is marked at time t = 0.

leetcodehardtreedepth-first-search
LeetCode 3381 - Maximum Subarray Sum With Length Divisible by K

We are given an integer array nums and an integer k. We must find a contiguous subarray whose length is divisible by k, and among all such valid subarrays, return the maximum possible sum. A subarray is a contiguous segment of the array.

leetcodemediumarrayhash-tableprefix-sum
LeetCode 2933 - High-Access Employees

This problem provides a list of employee access records. Each record contains two pieces of information: - The employee's name. - A timestamp in 24-hour "HHMM" format. All timestamps belong to the same day, so there is no need to handle dates or day transitions.

leetcodemediumarrayhash-tablestringsorting
LeetCode 3191 - Minimum Operations to Make Binary Array Elements Equal to One I

The problem presents a binary array nums of length at least 3, containing only 0s and 1s. The allowed operation is to select any three consecutive elements and flip all of them, meaning each 0 becomes 1 and each 1 becomes 0.

leetcodemediumarraybit-manipulationqueuesliding-windowprefix-sum
LeetCode 1787 - Make the XOR of All Segments Equal to Zero

We are given an array nums and an integer k. Every contiguous segment of length k must have XOR equal to 0 after we perform some modifications to the array. Our goal is to change as few elements as possible.

leetcodehardarrayhash-tabledynamic-programmingbit-manipulationcounting
CF 1566G - Four Vertices

We are working with a weighted undirected graph that changes over time by edge insertions and deletions. After every modification, including the initial state, we must look at all pairs of vertices and imagine the shortest path distance between each pair.

codeforcescompetitive-programmingconstructive-algorithmsdata-structuresgraphsgreedyimplementationshortest-paths
CF 1566C - MAX-MEX Cut

The traceback says: at: So the program is using sys without importing it. This is consistent with the previous correction: we switched to sys.stdin.read() but forgot the required import line: Across previous iterations, there were multiple partial fixes: 1.

codeforcescompetitive-programmingbitmasksconstructive-algorithmsdpgreedy
CF 1566E - Buds Re-hanging

We are given a rooted tree with root at vertex 1. A vertex is a leaf if it has no children. A vertex is a bud if it is not the root, has at least one child, and every one of its children is a leaf.

codeforcescompetitive-programmingconstructive-algorithmsdfs-and-similardpgreedytrees
Kvant Physics Problem 197

A body of mass $m$ lies on a fixed horizontal rough surface.

kvantphysics
CF 1566F - Points Movement

We are given a set of starting positions on a number line, each hosting a point that can move left or right in unit steps, each step costing 1. Alongside this, we are given several closed intervals on the same line.

codeforcescompetitive-programmingdata-structuresdpgreedyimplementationsortings
CF 1566D2 - Seating Arrangements (hard version)

We are tasked with seating nm people in a cinema with n rows and m columns, where the seats in each row are numbered consecutively left to right. Each person has a "sight level," and lower sight levels should get better seats, which are defined as seats with lower indices.

codeforcescompetitive-programmingdata-structuresgreedyimplementationsortingstwo-pointers
CF 1566B - MIN-MEX Cut

We are given a binary string and may split it into any number of contiguous pieces. Every character must belong to exactly one piece. For each piece, we compute its MEX.

codeforcescompetitive-programmingbitmasksconstructive-algorithmsdpgreedy
CF 1566D1 - Seating Arrangements (easy version)

We are given a line of seats in a single row, labeled from left to right in increasing order. There are $m$ seats, and $nm$ people, but since $n = 1$, we only have one row of length $m$ containing exactly $m$ people in total.

codeforcescompetitive-programmingdata-structuresgreedysortings
Kvant Physics Problem 198

A skater moves on horizontal ice with both skate blades in contact with the surface.

kvantphysics
Kvant Physics Problem 193

Two infinite sequences of thin lenses are placed along a common optical axis $z$.

kvantphysics
CF 1566A - Median Maximization

We are asked to determine the largest possible median of an array of n non-negative integers whose sum is exactly s.

codeforcescompetitive-programmingbinary-searchgreedymath
CF 1567B - MEXor Mixup

Ah, I see exactly what went wrong. The traceback shows: This happened because in the test harness we called solve() but in your actual script the function solve wasn’t defined in the global scope or the script wasn’t executed properly inside the harness.

codeforcescompetitive-programmingbitmasksgreedy
Kvant Physics Problem 199

The physical system consists of a neutron entering a layer of material.

kvantphysics
CF 1567F - One-Four Overload

We are given a grid of size $n times m$ where some cells are marked with an X and the rest are unmarked .. The marked cells are never on the boundary of the grid.

codeforcescompetitive-programming2-satconstructive-algorithmsdfs-and-similardsugraphsimplementation
CF 1567E - Non-Decreasing Dilemma

We maintain an array under point updates. After each update, future queries must use the new values. For a query on a segment [l, r], we must count how many subarrays completely inside that range are non-decreasing.

codeforcescompetitive-programmingdata-structuresdivide-and-conquermath
Kvant Physics Problem 187

Consider a thin metal plate of area $s$ coated with a layer of liquid dielectric of density $\rho$ and relative permittivity $\varepsilon$, where the thickness of the layer is much smaller than the li…

kvantphysics
CF 1567D - Expression Evaluation Error

We are given a situation where Bob writes down a sequence of positive integers whose sum is fixed. The only freedom he has is how to split this total sum into exactly n parts.

codeforcescompetitive-programmingconstructive-algorithmsgreedyimplementationmath
CF 1567A - Domino Disaster

We are given a 2-row grid of width $n$ fully covered by $1 times 2$ dominoes. Each domino can be placed either vertically, covering one cell in each row, or horizontally, covering two adjacent cells in the same row.

codeforcescompetitive-programmingimplementationstrings
CF 1567C - Carrying Conundrum

We are asked to count the number of ordered pairs of positive integers (a, b) that produce a specific result n under an unusual addition scheme. In this scheme, instead of carrying to the next column as in standard addition, Alice carries to the column two places to the left.

codeforcescompetitive-programmingbitmaskscombinatoricsdpmath
Kvant Physics Problem 181

A satellite of mass $m$ moves around the Earth of mass $M$ in a nearly circular orbit of radius $r$ with orbital speed $v$.

kvantphysics
CF 1569C - Jury Meeting

We are asked to count the number of permutations of jury members that are “nice,” given how they present their tasks. Each jury member $i$ has $ai$ tasks, and they tell tasks in order according to a permutation.

codeforcescompetitive-programmingcombinatoricsmath
CF 1569F - Palindromic Hamiltonian Path

We are given a small undirected graph with at most 12 vertices. We want to assign each vertex a letter from a fixed alphabet of size k. Every such assignment produces a labeled graph.

codeforcescompetitive-programmingbrute-forcedfs-and-similardpgraphshashing
Kvant Physics Problem 189

A point charge $q = 10^{-8},\text{C}$ is uniformly distributed along a circular arc of radius $R = 1,\text{cm} = 10^{-2},\text{m}$.

kvantphysics
CF 1569E - Playoff Restoration

We are given a single-elimination tournament with $2^k$ teams, where $k$ ranges from 1 to 5. The matches are structured in a fixed bracket: in the first round, consecutive teams play each other, and winners advance to the next round, pairing up according to the same rule until…

codeforcescompetitive-programmingbitmasksbrute-forcehashingimplementationmeet-in-the-middle
CF 1569D - Inconvenient Pairs

We are asked to count the number of "inconvenient pairs" among people located on the streets of a city that is a perfect square grid. Each person is guaranteed to be on either a vertical or a horizontal street, which are given as sorted coordinates.

codeforcescompetitive-programmingbinary-searchdata-structuresimplementationsortingstwo-pointers
Kvant Physics Problem 188

A refrigerator operates for a time interval $\tau$ while consuming electrical power $W$.

kvantphysics