#probabilities
CF 1267G - Game Relics
CF 1267G - Game Relics Rating: 3000 Tags: math, probabilities Solve time: 1m 28s Verified: no Solution Problem Understanding We are given a collection of $n$ distinct items called relics. Each relic $i$ can be obtained in two ways: either by directly purchasing it at a fixed cost $c_i$, or by paying a fixed cost $x$ to receive a uniformly random relic among all $n$, where duplicates do not help...
CF 1210F2 - Marek and Matching (hard version)
CF 1210F2 - Marek and Matching (hard version) Rating: 3200 Tags: brute force, probabilities Solve time: 1m 44s Verified: no Solution Problem Understanding We are given a complete bipartite structure between two sets of size $n$, where every potential edge $(\ell_i, r_j)$ exists independently with some probability $p_{ij}/100$. The randomness is over the presence or absence of each edge, and all edges are independent. The question is not about constructing...
CF 930B - Game with String Rating: 1600 Tags: implementation, probabilities, strings Model: gpt-5-3-mini Solve time: 2m 11s Verified: no (0/1 samples) Share: https://chatgpt.com/share/6a339406-73a4-83ec-9c03-b248d932d6fb Solution Problem Understanding We are given a string that is conceptually placed on a circle. Kolya rotates this circle by a random shift, and Vasya observes only the first character of the rotated string. After seeing that character, Vasya is allowed to reveal exactly one additional...
CF 960E - Alternating Tree
CF 960E - Alternating Tree Rating: 2300 Tags: combinatorics, dfs and similar, divide and conquer, dp, probabilities, trees Solve time: 2m 1s Verified: no Solution Problem Understanding We are given a tree with a value attached to every node. Between any two nodes $u$ and $v$, there is exactly one simple path, and we assign a score to that directed path by taking the node values along the path and...
CF 1039B - Subway Pursuit
CF 1039B - Subway Pursuit Rating: 2100 Tags: binary search, interactive, probabilities Solve time: 11m 23s Verified: no Solution Problem Understanding We are dealing with a single moving target on a very large numbered line of stations from 1 to n. At any moment there is exactly one station where the train is located, but after every query the train is allowed to move up to k stations left or...
CF 1210F1 - Marek and Matching (easy version)
CF 1210F1 - Marek and Matching (easy version) Rating: 3100 Tags: brute force, probabilities Solve time: 2m 41s Verified: yes Solution Problem Understanding We are given a complete bipartite structure with $n$ vertices on the left and $n$ vertices on the right. For every possible pair $(i, j)$, the edge between left vertex $i$ and right vertex $j$ exists independently with probability $p_{ij}/100$. The randomness only affects whether edges appear....
CF 1600F - Party Organization
CF 1600F - Party Organization Rating: 2300 Tags: brute force, math, probabilities Solve time: 2m 22s Verified: yes Solution Problem Understanding We are given a simple undirected graph where people are vertices and friendships are edges. A valid party is a selection of exactly five distinct vertices such that the induced subgraph on these five vertices is either completely empty of edges or completely full, meaning it is a 5-vertex...
CF 1773B - BinCoin
CF 1773B - BinCoin Rating: 2200 Tags: binary search, divide and conquer, hashing, implementation, probabilities, trees Solve time: 2m 27s Verified: no Solution Problem Understanding We are given a rooted binary tree with $n$ employees. Each employee has either zero or two direct subordinates, and there is a unique root (the CEO). The company runs a procedure that produces a full ordering of all employees, and this procedure is executed...
CF 1773A - Amazing Trick
CF 1773A - Amazing Trick Rating: 1900 Tags: constructive algorithms, graph matchings, math, probabilities Solve time: 2m 23s Verified: no Solution Problem Understanding We are given a permutation $a$ of size $n$, meaning every number from $1$ to $n$ appears exactly once. We are allowed to apply two permutations $q$ first and then $p$, so that the final position $i$ receives the value originally at position $p[q[i]]$. In other words,...
CF 1726D - Edge Split
CF 1726D - Edge Split Rating: 2000 Tags: brute force, constructive algorithms, dfs and similar, dsu, graphs, probabilities, trees Solve time: 3m 56s Verified: no Solution Problem Understanding We are given a connected undirected graph with a small number of extra edges beyond a tree. For each edge, we must decide whether it is colored red or blue. After fixing the coloring, we look at two induced subgraphs: one formed...
CF 1578M - The Mind
CF 1578M - The Mind Rating: 2700 Tags: constructive algorithms, interactive, probabilities Solve time: 6m 11s Verified: no Solution Problem Understanding Each test gives us a hand of five distinct numbers between 1 and 100. Two players independently receive such hands, and each player only sees their own five numbers. From those five numbers, only the smallest one matters for the actual game, because the rules force every player to...
CF 1578G - Game of Chance
CF 1578G - Game of Chance Rating: 3500 Tags: math, probabilities Solve time: 5m 52s Verified: no Solution Problem Understanding We are given a line of participants, each assigned a positive “luckiness” value. These participants enter a knockout tournament with a very rigid pairing structure. In any match between two players with luck values $x$ and $y$, the probability that the first player wins is $x/(x+y)$, and the second wins...
CF 1556H - DIY Tree
CF 1556H - DIY Tree Rating: 3300 Tags: graphs, greedy, math, probabilities Solve time: 4m 54s Verified: no Solution Problem Understanding We are given a complete weighted undirected graph on $n$ vertices, so every pair of vertices is connected and every edge has a known cost. The task is to select exactly $n-1$ edges that form a spanning tree of minimum total weight, but with an additional restriction that only...
CF 1556F - Sports Betting
CF 1556F - Sports Betting Rating: 2500 Tags: bitmasks, combinatorics, dp, graphs, math, probabilities Solve time: 5m 15s Verified: yes Solution Problem Understanding We are given a complete tournament where every pair of teams plays exactly one match. The result of each match is random, but biased: team $i$ beats team $j$ with probability proportional to its strength, specifically $\frac{a_i}{a_i + a_j}$. Each match outcome is independent. From all match...
CF 1305F - Kuroni and the Punishment Rating: 2500 Tags: math, number theory, probabilities Model: gpt-5-3-mini Solve time: 1m 51s Verified: yes (1/1 samples) Share: https://chatgpt.com/share/6a2dd87b-f5dc-83ec-a859-ab36a2e89043 Solution Problem Understanding We are given a list of large positive integers. In one move, we can pick any single element and shift it by exactly one unit up or down, as long as it stays positive. Each such shift costs one operation. The...
CF 1510I - Is It Rated?
CF 1510I - Is It Rated? Rating: 2700 Tags: greedy, interactive, math, probabilities Solve time: 3m 29s Verified: no Solution Problem Understanding In this problem, you act as a participant, Izzy, in a series of wagers predicting whether improv contests will be rated or unrated. For each wager, you see the predictions of all other participants, then make your own prediction. After that, the real outcome is revealed. Your goal...
CF 1523E - Crypto Lights
CF 1523E - Crypto Lights Rating: 2600 Tags: combinatorics, dp, math, probabilities Solve time: 2m 17s Verified: no Solution Problem Understanding We are asked to compute the expected number of lights that turn on in a line of $n$ lights, given a stopping condition based on consecutive segments of length $k$. Each light starts off, and in each step, one random light that is still off is turned on. The...
CF 1523D - Love-Hate
CF 1523D - Love-Hate Rating: 2400 Tags: bitmasks, brute force, dp, probabilities Solve time: 2m 6s Verified: yes Solution Problem Understanding We are given a set of n friends, each with their own preferences over m currencies. Each friend likes at most p currencies, so the like-lists are sparse. The goal is to find the largest set of currencies such that at least half of the friends like all the...
CF 1530F - Bingo
CF 1530F - Bingo Rating: 2600 Tags: bitmasks, combinatorics, dp, math, probabilities Solve time: 2m 2s Verified: no Solution Problem Understanding We are asked to compute the probability that a square table of events is "winning." Each cell of an $n \times n$ table contains an event that may happen with a given probability. Rows, columns, the main diagonal, and the antidiagonal are considered lines. A table is winning if...
CF 1599C - Bubble Strike
CF 1599C - Bubble Strike Rating: 2000 Tags: combinatorics, math, probabilities, ternary search Solve time: 1m 44s Verified: no Solution Problem Understanding We are asked to determine how many maps Johnny must study to ensure that the probability he ends up playing on a studied map is at least $P$. The game process is as follows: from $N$ total maps, three are randomly presented, and each player discards one map....
CF 1765G - Guess the String
CF 1765G - Guess the String Rating: 2600 Tags: constructive algorithms, interactive, probabilities Solve time: 2m 3s Verified: no Solution Problem Understanding We are asked to reconstruct a hidden binary string of length $n$, knowing that its first character is always '0'. We cannot read the string directly. Instead, we can query two special functions: the prefix function $p_i$, which measures the length of the longest prefix that matches the...
CF 1765F - Chemistry Lab
CF 1765F - Chemistry Lab Rating: 2200 Tags: dp, geometry, probabilities Solve time: 2m 17s Verified: no Solution Problem Understanding We have a chemistry lab scenario where Monocarp can buy contracts that give him unlimited access to specific solutions of an acid. Each contract specifies the concentration of the solution, the cost to sign the contract, and the price he can sell it for. Monocarp expects a number of customers,...
CF 1765C - Card Guessing
CF 1765C - Card Guessing Rating: 2600 Tags: combinatorics, dp, probabilities Solve time: 4m 5s Verified: yes Solution Problem Understanding We are dealing with a long sequence of independent random experiments: a deck contains exactly four suits, and each suit appears exactly (n) times, so the total length is (4n). The deck is shuffled uniformly at random, so every permutation is equally likely. A player scans the deck from top...
CF 1773G - Game of Questions
CF 1773G - Game of Questions Rating: 2800 Tags: bitmasks, combinatorics, dp, fft, math, probabilities Solve time: 4m 17s Verified: yes Solution Problem Understanding Each test case gives a binary matrix with up to 17 columns and up to 2⋅10^5 rows. Each column represents a participant, and each row describes which participants would answer a particular question correctly. The questions are randomly permuted before being asked. As the sequence runs,...
CF 1866M - Mighty Rock Tower
CF 1866M - Mighty Rock Tower Rating: 2400 Tags: brute force, combinatorics, dp, math, probabilities Solve time: 2m 18s Verified: no Solution Problem Understanding We are asked to compute the expected number of moves to build a tower of height N using identical small rocks, where each placement may trigger a cascading fall of the top rocks. Every time a rock is placed at height x , the topmost rock...
CF 1912F - Fugitive Frenzy
CF 1912F - Fugitive Frenzy Rating: 3100 Tags: math, probabilities Solve time: 3m 5s Verified: no Solution Problem Understanding We are asked to compute the expected duration of a pursuit on a tree, where a police officer and a fugitive take turns moving. The city is represented as an undirected tree with $n$ vertices. The police officer starts at a fixed vertex, while the fugitive chooses any other vertex to...
CF 1970D2 - Arithmancy (Medium)
CF 1970D2 - Arithmancy (Medium) Rating: 2600 Tags: constructive algorithms, interactive, probabilities, strings Solve time: 1m 57s Verified: no Solution Problem Understanding We are asked to play the role of Professor Vector. We need to construct a set of distinct magic words made of 'X' and 'O' and then, given a number called the power of a spell, figure out which two words (and in which order) were concatenated to...
CF 2068A - Condorcet Elections
CF 2068A - Condorcet Elections Rating: 2300 Tags: constructive algorithms, graphs, greedy, probabilities Solve time: 1m 20s Verified: yes Solution Problem Understanding We are given a directed relationship between candidates, where an input pair “a defeats b” is not a vote but a constraint on the final outcome we must simulate. The real output is not a ranking itself but a multiset of full rankings (permutations of all candidates), such...
CF 2181J - Jinx or Jackpot
CF 2181J - Jinx or Jackpot Rating: 2300 Tags: brute force, dp, math, probabilities Solve time: 1m 41s Verified: no Solution Problem Understanding We are given a casino machine whose behaviour is determined by one hidden probability value. There is an array of probabilities, and the casino owner secretly picks one index uniformly at random at the start and fixes it forever. That chosen entry defines a single-slot machine: whenever...
CF 1949A - Grove
CF 1949A - Grove Rating: 3300 Tags: brute force, dfs and similar, dp, geometry, probabilities Solve time: 2m 41s Verified: yes Solution Problem Understanding Every tree is planted at an integer lattice point. Around that point we place a disk of radius r , representing the root system. Two conditions must hold. The entire disk must stay inside the square lawn. Since the lawn is the square [0,n] × [0,n]...