#implementation
CF 1553B - Reverse String
CF 1553B - Reverse String Rating: 1300 Tags: brute force, dp, hashing, implementation, strings Solve time: 1m 34s Verified: no Solution Problem Understanding We are given a string that represents a line of characters. A chip starts on some chosen position in this string. After placing it, we repeatedly move it and each time we record the character at the chip’s current position. The movement has a strict structure: the...
CF 1267I - Intriguing Selection
CF 1267I - Intriguing Selection Rating: 2600 Tags: brute force, constructive algorithms, implementation, interactive, sortings Solve time: 2m 16s Verified: no Solution Problem Understanding We are given a hidden set of $2n$ distinct values, one per player, and we can only compare two players at a time and learn which one is stronger. The goal is not to fully reconstruct the ranking, but to identify exactly which $n$ players belong...
CF 1252C - Even Path
CF 1252C - Even Path Rating: 1600 Tags: data structures, implementation Solve time: 1m 50s Verified: no Solution Problem Understanding The grid in this problem is not given explicitly as an $N \times N$ matrix. Instead, every cell value is determined by a simple additive structure: the value at position $(i, j)$ is $R_i + C_j$. This means each row contributes a fixed offset $R_i$, and each column contributes a...
CF 1250E - The Coronation
CF 1250E - The Coronation Rating: 2300 Tags: graphs, implementation Solve time: 1m 40s Verified: no Solution Problem Understanding We are given several binary strings, each representing a necklace. Each position in a string is either 0 or 1, and we interpret this as two types of gems. We are allowed to reverse some of these strings. After choosing which necklaces to reverse, we compare every pair of necklaces. Two...
CF 983A - Finite or not? Rating: 1700 Tags: implementation, math Model: gpt-5-5 Solve time: 1m 7s Verified: yes (1/1 samples) Share: https://chatgpt.com/share/6a33757e-78f4-83ec-b62c-055c2636f4e3 Solution Problem Understanding We are given a rational number $p/q$ and asked to determine whether its representation is finite when written in base $b$. A finite representation means that after some point, the expansion stops and no further digits are needed, similar to how $1/2 = 0.5$...
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 960D - Full Binary Tree Queries Rating: 2100 Tags: brute force, implementation, trees Model: gpt-5-3-mini Solve time: 4m 22s Verified: no (0/1 samples) Share: https://chatgpt.com/share/6a33a068-fe28-83ec-9de5-e9a20df13517 Solution Problem Understanding We are working with an infinite complete binary tree whose nodes are labeled in the standard heap order. The root is 1, and every node x has children 2x and 2x+1. This means every node corresponds to a unique binary representation...
CF 960C - Subsequence Counting Rating: 1700 Tags: bitmasks, constructive algorithms, greedy, implementation Model: gpt-5-3-mini Solve time: 4m 22s Verified: no (0/1 samples) Share: https://chatgpt.com/share/6a33a069-6ac8-83ec-b946-bc1675dc98b7 Solution Problem Understanding We are given two numbers: a target count of subsequences and a threshold value. We must construct an integer array such that when we look at all its non-empty subsequences and keep only those subsequences whose maximum minus minimum is strictly less...
CF 984B - Minesweeper Rating: 1100 Tags: implementation Model: gpt-5-3-mini Solve time: 1m 5s Verified: yes (1/1 samples) Share: https://chatgpt.com/share/6a33a777-461c-83ec-870f-45a398a95555 Solution Problem Understanding We are given a grid that represents a finished Minesweeper board. Each cell can contain either a bomb, a digit from 1 to 8, or be empty. The digit in a cell is supposed to encode how many bombs exist in its surrounding 8-neighborhood, and empty cells...
CF 1070K - Video Posts Rating: 1100 Tags: implementation Model: gpt-5-3-mini Solve time: 1m 10s Verified: yes (1/1 samples) Share: https://chatgpt.com/share/6a33813e-d9b8-83ec-b42b-9a3a674904f7 Solution Problem Understanding We are given a sequence of video durations arranged in chronological order. The task is to split this sequence into exactly k contiguous groups, where each group represents one post, and every video must belong to exactly one group. The key constraint is not just the...
CF 931C - Laboratory Work Rating: 1700 Tags: implementation, math Model: gpt-5-3-mini Solve time: 1m 27s Verified: yes (1/1 samples) Share: https://chatgpt.com/share/6a327606-d3c4-83ec-8000-99ae5512713a Solution Problem Understanding We are given a multiset of integers representing Kirill’s measurements. All values are very tightly clustered: every value lies within an interval of length at most two, so after shifting, the data contains only three possible integers at most. Anya must construct another multiset of...
CF 958A1 - Death Stars (easy) Rating: 1400 Tags: implementation Model: gpt-5-3-mini Solve time: 1m 10s Verified: yes (1/1 samples) Solution Problem Understanding We are given two square grids of size $N \times N$, where each cell is either a star or empty space. The task is to determine whether these two grids can represent the same pattern if we are allowed to transform one of them using rigid symmetries...
CF 958B1 - Maximum Control (easy) Rating: 1000 Tags: implementation Model: gpt-5-3-mini Solve time: 1m 17s Verified: yes (1/1 samples) Share: https://chatgpt.com/share/6a327e68-d164-83ec-b8c1-6a5c68225db7 Solution Problem Understanding We are given a network of planets connected by tunnels, forming a tree structure. This means every planet is reachable from every other planet, and between any two planets there is exactly one simple path. A planet is called remote if it connects to the...
CF 930D - Game with Tokens Rating: 2500 Tags: data structures, games, implementation Model: gpt-5-3-mini Solve time: 1m 49s Verified: yes (1/1 samples) Share: https://chatgpt.com/share/6a32759f-eca8-83ec-8ce0-6915f5e36d45 Solution Problem Understanding We are given a set of black tokens placed at distinct integer grid points. There is also a single white token whose starting position is not fixed. The game proceeds in alternating turns: white moves first, and on each turn a player...
CF 931B - World Cup
CF 931B - World Cup Rating: 1200 Tags: constructive algorithms, implementation Solve time: 1m 8s Verified: yes Solution Problem Understanding We are given a single-elimination tournament with $n$ teams labeled from 1 to $n$. The structure of the tournament is fixed and mechanical: in every round, the remaining teams are sorted by their original labels, then paired consecutively, so team 1 plays 2, 3 plays 4, and so on. Winners...
CF 931A - Friends Meeting
CF 931A - Friends Meeting Rating: 800 Tags: brute force, greedy, implementation, math Solve time: 1m 8s Verified: yes Solution Problem Understanding Two people stand on a number line at integer coordinates $a$ and $b$. They want to end up at the same integer position, and each of them can move one step left or right any number of times. The twist is that movement cost is not linear. If...
CF 948A - Protect Sheep
CF 948A - Protect Sheep Rating: 900 Tags: brute force, dfs and similar, graphs, implementation Solve time: 1m 20s Verified: no Solution Problem Understanding The grid can be viewed as a rectangular graph where each cell is a node connected to its four orthogonal neighbors. Some nodes contain sheep, some contain wolves, and the rest are empty. Wolves are free to move step by step across empty cells, but they...
CF 957A - Tritonic Iridescence
CF 957A - Tritonic Iridescence Rating: 1300 Tags: implementation Solve time: 1m 2s Verified: yes Solution Problem Understanding We are given a one-dimensional strip of length $n$, where each position is either already painted in one of three colors or left blank. The blank positions must be filled using the same three colors so that no two adjacent positions end up sharing the same color. The task is not to...
CF 958F1 - Lightsabers (easy)
CF 958F1 - Lightsabers (easy) Rating: 1500 Tags: implementation Solve time: 3m 11s Verified: no Solution Problem Understanding We are given a line of Jedi, each occupying a fixed position in an array, and each Jedi has one of several possible lightsaber colors. Alongside this, we are given a target specification that tells us how many Jedi of each color we must pick. The task is to determine whether there...
CF 960A - Check the string
CF 960A - Check the string Rating: 1200 Tags: implementation Solve time: 1m 4s Verified: yes Solution Problem Understanding We are given a string made only of the characters a , b , and c . This string is claimed to have been constructed in a very specific way: it starts with one or more a characters, then some b characters are appended, and finally some c characters are appended...
CF 967A - Mind the Gap
CF 967A - Mind the Gap Rating: 1100 Tags: implementation Solve time: 27s Verified: no Solution Problem Understanding We are given a timeline of scheduled landings, each occupying exactly one minute, already sorted in increasing order. We must insert one additional event, a takeoff that also lasts one minute, into this timeline. The key restriction is safety spacing. If a landing occurs at time t, then the takeoff must not...
CF 1017B - The Bits
CF 1017B - The Bits Rating: 1200 Tags: implementation, math Solve time: 1m 47s Verified: yes Solution Problem Understanding We are given two binary strings of equal length. You are allowed to pick any two positions in the first string and swap their bits. The second string stays fixed. After each swap, we recompute the bitwise OR of the two strings position by position, and we want to count how...
CF 1017A - The Rank
CF 1017A - The Rank Rating: 800 Tags: implementation Solve time: 1m 30s Verified: yes Solution Problem Understanding We are given a class of students, each identified by a unique integer id starting from 1. Every student has four exam scores corresponding to different subjects. The task is to rank all students by their total score across the four subjects. Higher total score means a better rank. When two students...
CF 1023A - Single Wildcard Pattern Matching
CF 1023A - Single Wildcard Pattern Matching Rating: 1200 Tags: brute force, implementation, strings Solve time: 1m 56s Verified: yes Solution Problem Understanding We are given a pattern string s and a target string t . The pattern looks almost like a normal string of lowercase letters, except that it may contain a single special character * . This wildcard is flexible: when we “instantiate” the pattern, we are allowed...
CF 1025E - Colored Cubes
CF 1025E - Colored Cubes Rating: 2700 Tags: constructive algorithms, implementation, matrices Solve time: 5m 51s Verified: yes Solution Problem Understanding We are given an $n \times n$ grid and $m$ identical-sized cubes, each having a unique color. Each cube starts on a distinct cell, and each also has a target cell where it must eventually be placed. Some cubes may already start on their destination, but otherwise every cube...
CF 1025C - Plasticine zebra
CF 1025C - Plasticine zebra Rating: 1600 Tags: constructive algorithms, implementation Solve time: 5m 11s Verified: no Solution Problem Understanding We are given a binary string made of two symbols, black and white, and we want to extract a long contiguous segment that alternates perfectly between the two colors. The segment must be consecutive in the final arrangement, but we are allowed to rearrange the original string using a very...
CF 1025A - Doggo Recoloring
CF 1025A - Doggo Recoloring Rating: 900 Tags: implementation, sortings Solve time: 2m 13s Verified: yes Solution Problem Understanding We are given a string representing the colors of a line of puppies, where each character is a color from 'a' to 'z'. The goal is to determine whether we can transform this string so that all characters become the same, using a very specific operation. The operation allows us to...
CF 1323A - Even Subset Sum Problem
CF 1323A - Even Subset Sum Problem Rating: 800 Tags: brute force, dp, greedy, implementation Solve time: 3m 48s Verified: yes Solution Problem Understanding We are given several independent arrays of positive integers. For each array, we must select a non-empty group of positions such that the sum of the chosen values is even. If no such group exists, we report failure. The output is not the subset itself but...
CF 1305E - Kuroni and the Score Distribution
CF 1305E - Kuroni and the Score Distribution Rating: 2200 Tags: constructive algorithms, greedy, implementation, math Solve time: 7m 11s Verified: no Solution Problem Understanding We are asked to construct a strictly increasing sequence of integers $a_1 < a_2 < \dots < a_n$, all between 1 and $10^9$, such that a specific combinatorial condition on triples is satisfied. The condition counts how many index triples $i < j < k$...
CF 1267J - Just Arrange the Icons
CF 1267J - Just Arrange the Icons Rating: 1800 Tags: greedy, implementation, math Solve time: 3m 21s Verified: yes Solution Problem Understanding We are given a multiset of applications, each belonging to a category. The only thing that matters about a category is how many apps it contains, so the input can be compressed into frequencies of each distinct category. We must place all apps into “screens”. Each screen has...
CF 1252H - Twin Buildings
CF 1252H - Twin Buildings Rating: 1800 Tags: greedy, implementation Solve time: 4m 48s Verified: no Solution Problem Understanding We are given several rectangular plots of land, and we want to place two identical rectangular buildings of size $A \times B$. The goal is to choose $A$ and $B$ to maximize the area $A \cdot B$, under the constraint that both buildings must fit into the available land configuration. There...
CF 1209C - Paint the Digits
CF 1209C - Paint the Digits Rating: 1500 Tags: constructive algorithms, greedy, implementation Solve time: 3m 18s Verified: no Solution Problem Understanding We are given a sequence of digits and we must assign each position one of two labels, 1 or 2. After labeling, we form a new sequence by taking all digits labeled 1 in their original order, followed by all digits labeled 2 in their original order. The...
CF 1208D - Restore Permutation
CF 1208D - Restore Permutation Rating: 1900 Tags: binary search, data structures, greedy, implementation Solve time: 5m 28s Verified: yes Solution Problem Understanding We are given a hidden permutation of numbers from 1 to n. Instead of seeing the permutation directly, we are given a derived value for each position. For position i, the value s[i] is the sum of all elements that appear before i and are smaller than...
CF 1208B - Uniqueness
CF 1208B - Uniqueness Rating: 1500 Tags: binary search, brute force, implementation, two pointers Solve time: 3m 49s Verified: yes Solution Problem Understanding We are given a sequence of numbers and we are allowed to remove one continuous block from it, or remove nothing at all. After this single deletion, the remaining elements must all be different from each other. The task is to choose a subarray to remove so...
CF 1070H - BerOS File Suggestion
CF 1070H - BerOS File Suggestion Rating: 1500 Tags: brute force, implementation Solve time: 6m 19s Verified: no Solution Problem Understanding We are given a fixed collection of short file names and a stream of queries. Each query is a short string, and we must determine how many file names contain that string as a contiguous substring. Along with the count, we also need to return any one file name...
CF 1070G - Monsters and Potions
CF 1070G - Monsters and Potions Rating: 2300 Tags: brute force, dp, greedy, implementation Solve time: 3m Verified: yes Solution Problem Understanding We are given a one-dimensional board of length $n$. Each cell can contain a monster with some HP, a potion that increases HP, or be empty. In addition, there are $m$ heroes initially placed on distinct empty cells, each hero starting with its own HP. We must choose...
CF 907B - Tic-Tac-Toe
CF 907B - Tic-Tac-Toe Rating: 1400 Tags: implementation Solve time: 4m 10s Verified: no Solution Problem Understanding The board is a 9 by 9 grid, but it is conceptually split into nine 3 by 3 sub-boards arranged in a 3 by 3 macro layout. Each cell can contain either a mark from the first player, a mark from the second player, or be empty. The game is not ordinary tic-tac-toe....
CF 907A - Masha and Bears
CF 907A - Masha and Bears Rating: 1300 Tags: brute force, implementation Solve time: 3m 6s Verified: yes Solution Problem Understanding We are given four small integers representing sizes of three bears and Masha. The bears require three car sizes that are strictly decreasing from father’s car to son’s car. Each bear is assigned to one specific car: father to the largest, mother to the middle, son to the smallest....
CF 1060C - Maximum Subrectangle
CF 1060C - Maximum Subrectangle Rating: 1600 Tags: binary search, implementation, two pointers Solve time: 4m 48s Verified: yes Solution Problem Understanding The matrix in this problem is not given explicitly. Instead, every cell is formed by multiplying an element from array a with an element from array b . This creates a grid where each row is a scaled version of b , and each column is a scaled...
CF 1773I - Interactive Factorial Guessing
CF 1773I - Interactive Factorial Guessing Rating: 2500 Tags: brute force, games, implementation, interactive Solve time: 2m 18s Verified: no Solution Problem Understanding We are interacting with a hidden integer $n$, but we are not allowed to see it directly. Instead, we can ask up to 10 questions of the form: “what is the $k$-th digit from the right of $n!$ in decimal representation?”. If that digit does not exist...
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 1726H - Mainak and the Bleeding Polygon
CF 1726H - Mainak and the Bleeding Polygon Rating: 3500 Tags: binary search, geometry, implementation, math Solve time: 7m 13s Verified: no Solution Problem Understanding We are given a convex polygon described by its vertices in counter-clockwise order. The shape is not arbitrary: every corner is either a right angle or slightly wider than a right angle, but never sharp. That geometric restriction has a strong consequence on how “far...
CF 1578K - Kingdom of Islands
CF 1578K - Kingdom of Islands Rating: 2800 Tags: brute force, graphs, implementation Solve time: 4m 15s Verified: no Solution Problem Understanding We are given a set of jarls, each belonging to exactly one island. The default rule of conflict is simple: jarls from different islands are in conflict, while jarls from the same island are peaceful. On top of this, there are a few exceptions, at most 20 pairs,...
CF 1561A - Simply Strange Sort
CF 1561A - Simply Strange Sort Rating: 800 Tags: brute force, implementation, sortings Solve time: 2m 40s Verified: yes Solution Problem Understanding We are given a permutation, meaning an array containing every integer from 1 to n exactly once. The process repeatedly applies a deterministic “strange bubble pass” operation, but with a twist: odd-numbered rounds compare adjacent pairs starting from index 1, 3, 5, and even-numbered rounds start from index...
CF 1556C - Compressed Bracket Sequence
CF 1556C - Compressed Bracket Sequence Rating: 1800 Tags: brute force, implementation Solve time: 4m 31s Verified: no Solution Problem Understanding We are given a bracket string, but it is not written explicitly character by character. Instead, it is compressed into blocks. Each number describes how many identical consecutive brackets appear, and the type of bracket alternates: the first block is opening brackets, the second is closing brackets, then opening...
CF 1556B - Take Your Places!
CF 1556B - Take Your Places! Rating: 1300 Tags: implementation Solve time: 2m 51s Verified: yes Solution Problem Understanding We are given an array of integers, and we are allowed to swap adjacent elements. The goal is to rearrange the array so that no two neighboring elements share the same parity, meaning we want an alternating pattern of even and odd numbers. Each swap only exchanges two elements next to...
CF 1323B - Count Subrectangles Rating: 1500 Tags: binary search, greedy, implementation Model: gpt-5-3-mini Solve time: 3m 30s Verified: yes (1/1 samples) Share: https://chatgpt.com/share/6a2ded2f-7b30-83ec-ae4c-241598b69c4b Solution Problem Understanding The matrix in this problem is not arbitrary. Every cell is determined by a simple outer-product rule: row i is either fully “active” or fully “inactive” depending on whether $a_i$ is 1 or 0, and column j is similarly controlled by $b_j$. A...
CF 1315A - Dead Pixel Rating: 800 Tags: implementation Model: gpt-5-3-mini Solve time: 5m 14s Verified: yes (1/1 samples) Share: https://chatgpt.com/share/6a2de47e-2e90-83ec-a206-77a7142f95da Solution Problem Understanding We are given a rectangular screen with width a and height b , treated as a grid of pixels with integer coordinates. One pixel is broken at position (x, y) . The goal is to choose an axis-aligned rectangular subwindow that does not include this broken...
CF 1250F - Data Center
CF 1250F - Data Center Rating: 800 Tags: brute force, implementation Solve time: 2m 26s Verified: yes Solution Problem Understanding We are given a target area $n$, and we want to build a rectangle whose sides are integers and whose area is exactly $n$. Every valid rectangle corresponds to choosing two integers $a$ and $b$ such that $a \cdot b = n$. Among all such factor pairs, we want the...
CF 1250A - Berstagram
CF 1250A - Berstagram Rating: 1400 Tags: implementation Solve time: 7m 25s Verified: yes Solution Problem Understanding We are simulating a social media feed where posts continuously swap positions based on incoming likes. Initially, posts are arranged in a fixed vertical order from top to bottom, with post 1 at the top and post n at the bottom. Each time a post receives a like, it attempts to move one...
CF 1209B - Koala and Lights
CF 1209B - Koala and Lights Rating: 1300 Tags: implementation, math, number theory Solve time: 11m 21s Verified: yes Solution Problem Understanding Each light in this problem behaves like a binary switch that flips its state over time. You are given an initial configuration where each light is either on or off. After that, every light follows its own periodic rule: it starts toggling at a specific time offset and...
CF 1184C1 - Heidi and the Turing Test (Easy)
CF 1184C1 - Heidi and the Turing Test (Easy) Rating: 1600 Tags: implementation Solve time: 2m 9s Verified: yes Solution Problem Understanding We are given a small set of points on a grid, where almost all points lie exactly on the border of an axis-aligned square. Only one point is an exception and lies strictly inside the square. The task is to identify that single interior point. The square is...
CF 1090M - The Pleasant Walk
CF 1090M - The Pleasant Walk Rating: 1000 Tags: implementation Solve time: 4m 16s Verified: yes Solution Problem Understanding We are given a line of houses, each painted with an integer color. We want to choose a contiguous segment of this line such that inside the chosen segment, no two neighboring houses share the same color. Among all such valid segments, we are asked to maximize the number of houses...
CF 1090G - Combostone
CF 1090G - Combostone Rating: 2500 Tags: games, implementation Solve time: 2m 45s Verified: yes Solution Problem Understanding We are given a configuration of stones arranged in a line. Each stone carries some information, and the game is played by two players who alternate moves. A move consists of selecting two adjacent stones, removing them, and replacing them with a single new stone whose type is determined by a fixed...
CF 1089J - JS Minification
CF 1089J - JS Minification Rating: 3200 Tags: greedy, implementation Solve time: 6m 4s Verified: no Solution Problem Understanding We are given a small programming language source file together with a set of reserved tokens. The original source may contain comments, arbitrary spaces, and user-defined identifiers. The parser removes comments, skips spaces, and repeatedly extracts the longest valid token according to the language rules. The task has two distinct parts....
CF 914A - Perfect Squares
CF 914A - Perfect Squares Rating: 900 Tags: brute force, implementation, math Solve time: 4m 38s Verified: yes Solution Problem Understanding We are given an array of integers and need to find the largest element that is not a perfect square . A perfect square is a number that can be expressed as the square of an integer. The input consists of a number n , the size of the...
CF 906A - Shockers
CF 906A - Shockers Rating: 1600 Tags: implementation, strings Solve time: 5m 30s Verified: yes Solution Problem Understanding Valentin is playing a game where a single unknown letter has been chosen, and every time he pronounces a word containing that letter, he gets shocked. He can also make guesses about the letter, and incorrect guesses result in shocks. The key question is not just how many shocks he received, but...
CF 914B - Conan and Agasa play a Card Game
CF 914B - Conan and Agasa play a Card Game Rating: 1200 Tags: games, greedy, implementation Solve time: 2m 35s Verified: yes Solution Problem Understanding We have a game where Conan and Agasa take turns removing cards from a pile. Each card has a positive integer written on it. When a player chooses a card, not only does that card get removed, but all cards with strictly smaller numbers are...
CF 1120A - Diana and Liana
CF 1120A - Diana and Liana Rating: 1900 Tags: greedy, implementation, two pointers Solve time: 1m 37s Verified: no Solution Problem Understanding The town of Shortriver has a single, very long liana of flowers. Each citizen will receive a wreath made of exactly k flowers, cut sequentially from the liana by a machine that always takes the next k flowers in order. Diana has a preferred sequence of flowers, which...
CF 1120B - Once in a casino
CF 1120B - Once in a casino Rating: 2700 Tags: constructive algorithms, greedy, implementation, math Solve time: 1m 25s Verified: no Solution Problem Understanding We are given two equal-length decimal strings, representing numbers written digit by digit. The task is to transform the first number into the second one using a very specific operation applied to adjacent digit pairs. Each operation selects an index between two neighboring digits and either...
CF 1121C - System Testing
CF 1121C - System Testing Rating: 1600 Tags: implementation Solve time: 2m 2s Verified: yes Solution Problem Understanding We have a situation that models parallel system testing in a contest setting. There are n solutions submitted to a contest. Each solution i requires a[i] tests to be fully verified. There are k independent testing processes, each capable of running one solution at a time, executing one test per second sequentially....
CF 1121B - Mike and Children
CF 1121B - Mike and Children Rating: 1200 Tags: brute force, implementation Solve time: 1m 12s Verified: yes Solution Problem Understanding We are given a collection of distinct positive integers representing candy sizes. Each child must receive exactly two different candies, and the “happiness level” of a child is defined as the sum of the two candies they receive. The constraint is global: all children must end up with the...
CF 1121A - Technogoblet of Fire
CF 1121A - Technogoblet of Fire Rating: 1100 Tags: implementation, sortings Solve time: 1m 6s Verified: yes Solution Problem Understanding We are given a set of students, each belonging to a school, and each with a power rating. The tournament rule is simple: only the strongest student from each school gets selected. Arkady wants to ensure that a chosen set of k students are selected. Some of these students may...
CF 1162A - Zoning Restrictions Again
CF 1162A - Zoning Restrictions Again Rating: 800 Tags: implementation Solve time: 1m 19s Verified: yes Solution Problem Understanding We have a street with n building positions. Every position can contain a house whose height is an integer between 0 and h . The profit from a house of height a is a² , so taller houses are always better. The city imposes m zoning rules. Each rule covers a...
CF 1184D1 - Parallel Universes (Easy)
CF 1184D1 - Parallel Universes (Easy) Rating: 1600 Tags: implementation Solve time: 3m 16s Verified: yes Solution Problem Understanding We have a line of universes arranged sequentially, each numbered from 1 to $n$, with the Doctor starting at position $k$. The multiverse can change over time according to a series of operations. An operation can either insert a new universe between two existing ones or at the ends, or break...
CF 1208H - Red Blue Tree
CF 1208H - Red Blue Tree Rating: 3500 Tags: data structures, implementation, trees Solve time: 1m 27s Verified: yes Solution Problem Understanding The tree defines a bottom-up majority-like rule where only leaves carry fixed information and every internal node derives its state from its children. Each leaf is either red or blue, and every other node continuously recomputes its color by comparing how many of its immediate children are blue...
CF 1208E - Let Them Slide
CF 1208E - Let Them Slide Rating: 2200 Tags: data structures, implementation Solve time: 2m 18s Verified: yes Solution Problem Understanding We are given a table with n rows and w columns. Each row contains an array that can be slid left or right within its row, but it must remain fully inside the table and occupy consecutive columns. The arrays can have different lengths, and some elements can be...
CF 1209G1 - Into Blocks (easy version)
CF 1209G1 - Into Blocks (easy version) Rating: 2000 Tags: data structures, dsu, greedy, implementation, two pointers Solve time: 1m 44s Verified: yes Solution Problem Understanding We are asked to transform a given sequence of integers into a "nice" sequence. A sequence is nice if all occurrences of the same number appear in contiguous blocks. For example, [3, 3, 1, 1, 2] is nice, but [3, 1, 3] is not...
CF 1209A - Paint the Numbers
CF 1209A - Paint the Numbers Rating: 800 Tags: greedy, implementation, math Solve time: 1m 41s Verified: yes Solution Problem Understanding We are given a list of integers, and we want to partition them into as few groups as possible. Each group has a structural constraint: if you look at the smallest number inside that group, every other number assigned to the same group must be divisible by that smallest...
CF 1277A - Happy Birthday, Polycarp!
CF 1277A - Happy Birthday, Polycarp! Rating: 1000 Tags: implementation Solve time: 2m 35s Verified: no Solution There is not enough information to diagnose the bug or provide a corrected solution. The sample 3 3 tab one bat with expected output 6 tabbat appears to belong to a string construction problem, but you have not provided: the problem statement, the original Python solution, or even the name of the problem....
CF 1277D - Let's Play the Words?
CF 1277D - Let's Play the Words? Rating: 1900 Tags: data structures, hashing, implementation, math Solve time: 2m 3s Verified: no Solution Problem Understanding We are given a collection of binary strings, and we are allowed to optionally reverse some of them. After doing so, we want to arrange all strings in a single sequence such that every adjacent pair is compatible: the last character of a word must match...
CF 1402A - Fancy Fence
CF 1402A - Fancy Fence Rating: 1800 Tags: *special, data structures, dsu, implementation, math, sortings Solve time: 1m 59s Verified: no Solution Problem Understanding We are given a fence composed of $N$ rectangular sections placed side by side. Each section $i$ has a width $w_i$ and a height $h_i$. Our task is to count all axis-aligned rectangles that can be formed entirely on top of these sections. A rectangle must...
CF 1403C - Chess Rush
CF 1403C - Chess Rush Rating: 3200 Tags: *special, combinatorics, dp, implementation, math Solve time: 4m 8s Verified: yes Solution What is actually going wrong Let’s trace what the wrong behavior implies. Input: 3 4 #.## #### ##.. Grid: #.## #### ##.. There are only 4 # cells total. But the output is 9 , which is suspiciously close to “counting something per cell plus neighbors” or “counting all 2x2...
CF 1425E - Excitation of Atoms
CF 1425E - Excitation of Atoms Rating: 2200 Tags: greedy, implementation Solve time: 2m 30s Verified: no Solution Problem Understanding We are given a sequence of $N$ atoms, each with a cost to excite $D_i$ and a reward when excited $A_i$. Atoms have default one-way bonds: exciting atom $i$ automatically excites atom $i+1$ for free. Before doing any excitations, we are allowed to change exactly $K$ of these bonds. The...