#fft
CF 958F3 - Lightsabers (hard) Rating: 2600 Tags: fft Model: gpt-5-3-mini Solve time: 1m 12s Verified: yes (1/1 samples) Share: https://chatgpt.com/share/6a327f72-56e0-83ec-a8f5-d47ee256d697 Solution Problem Understanding We are given a multiset of lightsabers where each saber belongs to one of m colors. The same color means identical objects, so we only care about how many sabers of each color are chosen, not which specific Jedi provide them. The task is to count...
CF 960G - Bandit Blues
CF 960G - Bandit Blues Rating: 2900 Tags: combinatorics, dp, fft, math Solve time: 2m 32s Verified: yes Solution Problem Understanding We are given a permutation of the numbers from 1 to N, and we simulate a simple “record-breaking” process on it. We start with a virtual value 0. Scanning from left to right, we maintain the maximum value seen so far; every time we encounter a number larger than...
CF 914G - Sum the Fibonacci
CF 914G - Sum the Fibonacci Rating: 2600 Tags: bitmasks, divide and conquer, dp, fft, math Solve time: 5m 10s Verified: no Solution Problem Understanding We are given a sequence of integers, each of which can be thought of as a 17-bit mask. From this array we must form ordered selections of five positions. Each selection contributes a value computed from bitwise combinations of the chosen elements, followed by evaluating...
CF 1726E - Almost Perfect
CF 1726E - Almost Perfect Rating: 2400 Tags: combinatorics, fft, math Solve time: 4m 48s Verified: no Solution Problem Understanding We are asked to count how many permutations of size $n$ satisfy a very specific structural constraint involving both the permutation and its inverse. For a permutation $p$, the value $p_i$ is the number placed at position $i$, while $p^{-1}_i$ is the position where value $i$ appears. The condition compares...
CF 1654H - Three Minimums
CF 1654H - Three Minimums Rating: 3500 Tags: combinatorics, constructive algorithms, divide and conquer, dp, fft, math Solve time: 5m 50s Verified: no Solution Problem Understanding We are asked to count permutations of the numbers from 1 to n that satisfy two independent kinds of restrictions. The first restriction is positional and local. We are given a short comparison string s of length m. It fixes whether each adjacent pair...
CF 1553I - Stairs
CF 1553I - Stairs Rating: 3400 Tags: combinatorics, divide and conquer, dp, fft, math Solve time: 6m 11s Verified: no Solution Problem Understanding We are given an array a of length n . It is not a permutation itself but a derived “stability profile” of an unknown permutation of 1..n . For each position i in that hidden permutation, we look at all subarrays that contain i . Among those...
CF 1184A3 - Heidi Learns Hashing (Hard)
CF 1184A3 - Heidi Learns Hashing (Hard) Rating: 3100 Tags: fft, math, number theory Solve time: 7m 45s Verified: yes Solution Problem Understanding We are given two strings of equal length and we want to force a collision under a polynomial rolling hash. The hash is defined by interpreting each string as coefficients of a polynomial in a base $r$, and then evaluating it modulo a prime $p$. Concretely, each...
CF 1575C - Cyclic Sum
CF 1575C - Cyclic Sum Rating: 3000 Tags: data structures, fft, number theory Solve time: 1m 49s Verified: no Solution Problem Understanding We are given an array a of length n and a repetition count m . From this, we form a cyclic sequence b by concatenating m copies of a . Conceptually, b is circular: after the last element, the first element follows. We are asked to count the...
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 1856E2 - PermuTree (hard version)
CF 1856E2 - PermuTree (hard version) Rating: 2700 Tags: bitmasks, dfs and similar, dp, fft, greedy, implementation, math, trees Solve time: 2m 52s Verified: no Solution I have analyzed the issue carefully. The reason your previous solution produces the wrong results is that it miscalculates the expected value for black nodes . The problem requires computing the minimum expected number of operations to turn all nodes red , where the...
CF 2021E1 - Digital Village (Easy Version)
CF 2021E1 - Digital Village (Easy Version) Rating: 2300 Tags: brute force, data structures, dfs and similar, dp, dsu, fft, graphs, greedy, implementation, math, trees Solve time: 2m 17s Verified: yes Solution Problem Understanding 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....
CF 2038F - Alternative Platforms
CF 2038F - Alternative Platforms Rating: 2500 Tags: combinatorics, data structures, fft, math, sortings Solve time: 1m 50s Verified: no Solution Problem Understanding We are given a collection of bloggers, where each blogger has two independent activity counts: how many videos they uploaded to platform A and how many to platform B. A user does not necessarily watch all bloggers equally. Instead, we consider choosing a subset of exactly $k$...
CF 2206F - Minesweeper String
CF 2206F - Minesweeper String Rating: 2400 Tags: fft, number theory Solve time: 50s Verified: no Solution Problem Understanding We are given a string of digits, each representing a cell in a conceptual 1D array of length $n$. Each digit either corresponds to some mines if it is non-zero, or an empty cell if it is zero. We then arrange these cells into a 2D grid of width $w$, filling...