#interactive
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 1023E - Down or Right
CF 1023E - Down or Right Rating: 2100 Tags: constructive algorithms, interactive, matrices Solve time: 2m 14s Verified: no Solution Problem Understanding We are given an unknown $n \times n$ grid where each cell is either open or blocked. Movement is only allowed from a cell to its right neighbor or its bottom neighbor, and only if the destination cell is open. The goal is to determine any valid path...
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 1386A - Colors
CF 1386A - Colors Rating: 2700 Tags: *special, binary search, constructive algorithms, interactive Solve time: 7m 19s Verified: no Solution Problem Understanding We are interacting with a hidden system that has chosen an integer threshold $C$ between 1 and $N$. We can think of the numbers from 1 to $N$ as positions on a line, and every time we pick a position, we are effectively “dyeing” hair with that color....
CF 1305D - Kuroni and the Celebration
CF 1305D - Kuroni and the Celebration Rating: 1900 Tags: constructive algorithms, dfs and similar, interactive, trees Solve time: 3m 8s Verified: no Solution Problem Understanding We are given a fixed tree with up to 1000 vertices. Somewhere in this tree there is a hidden root vertex $r$, which represents Kuroni’s hotel. The structure of the tree is known, but the root is not. The only way to extract information...
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 1773H - Hot and Cold
CF 1773H - Hot and Cold Rating: 2600 Tags: binary search, interactive Solve time: 2m 18s Verified: no Solution Problem Understanding We are playing a coordinate guessing game on a large integer grid. There is a hidden target point somewhere in the square from $(0,0)$ to $(10^6,10^6)$. We are allowed to “query” any point by printing its coordinates, and after each query the system tells us how our Euclidean distance...
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 1556D - Take a Guess
CF 1556D - Take a Guess Rating: 1800 Tags: bitmasks, constructive algorithms, interactive, math Solve time: 9m 7s Verified: no Solution Problem Understanding We are given a hidden array of integers, and we cannot access its elements directly. The only way to learn anything about the array is by asking queries on pairs of indices. Each query returns either the bitwise AND or bitwise OR of two elements. Using only...
CF 1090F - How to Learn You Score
CF 1090F - How to Learn You Score Rating: 2600 Tags: constructive algorithms, interactive Solve time: 6m 5s Verified: no Solution I can’t safely produce a correct, detailed editorial for Codeforces 1090F from the information given here, because the actual problem statement (what the interaction allows, what the judge returns, and what needs to be reconstructed) is missing. For a 2600-rated interactive constructive problem, the entire solution hinges on very...
CF 1089C - Cactus Search
CF 1089C - Cactus Search Rating: 2500 Tags: interactive Solve time: 1m 34s Verified: yes Solution Problem Understanding We are given a connected structure that is almost a tree but may contain simple cycles, with the restriction that any edge belongs to at most one cycle. Inside this graph there is a hidden vertex chosen by the judge. Our only way to interact is to query a vertex, and the...
CF 1403A - The Potion of Great Power
CF 1403A - The Potion of Great Power Rating: 2400 Tags: *special, 2-sat, binary search, data structures, graphs, interactive, sortings, two pointers Solve time: 2m 3s Verified: no Solution Problem Understanding We have a dynamic friendship network among N shamans, each living at a specific altitude H[i] . Initially, no shaman trusts anyone, and every day a single friendship either forms or dissolves. Each shaman can trust at most D...
CF 1425F - Flamingoes of Mystery
CF 1425F - Flamingoes of Mystery Rating: 1400 Tags: interactive Solve time: 2m 18s Verified: no Solution Problem Understanding We have an unknown array $A_1, A_2, \dots, A_N$, where $A_i$ is the number of flamingoes in cage $i$. The only operation available is asking for the sum of a contiguous segment. A query of the form $(L,R)$ returns $$A_L + A_{L+1} + \cdots + A_R$$ with the restriction that $L...
CF 1442F - Differentiating Games
CF 1442F - Differentiating Games Rating: 3400 Tags: games, interactive Solve time: 1m 21s Verified: no Solution Problem Understanding We are dealing with an interactive combinatorial game on a directed graph. Each vertex may hold a token, and two players alternate moves. On a turn, a player chooses any token and moves it along an outgoing edge. If a player cannot move any token, they lose. The interactor selects a...
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 1578I - Interactive Rays
CF 1578I - Interactive Rays Rating: 3300 Tags: geometry, interactive Solve time: 2m 13s Verified: no Solution Problem Understanding We are working in a plane where a circle is hidden from us. The circle is fully determined by its center coordinates and its radius, but we do not know them. Our only tool is to shoot a ray starting from the origin and passing through an integer point we choose....
CF 1599H - Hidden Fortress
CF 1599H - Hidden Fortress Rating: 2100 Tags: interactive, math Solve time: 1m 46s Verified: no Solution Problem Understanding We are working on a huge integer grid, and somewhere inside it lies a hidden axis-aligned rectangle. We are not allowed to enter this rectangle directly. Instead, we can probe any grid cell and receive the Manhattan distance to the closest point of the rectangle, unless we accidentally probe inside it,...
CF 1666I - Interactive Treasure Hunt
CF 1666I - Interactive Treasure Hunt Rating: 2200 Tags: brute force, constructive algorithms, geometry, interactive, math Solve time: 1m 47s Verified: no Solution Problem Understanding We are given a grid of size $n \times m$ where two treasures are hidden in distinct cells. The goal is to locate both treasures using a combination of two operations: DIG r c and SCAN r c . A DIG attempts to find a...
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 1776I - Spinach Pizza
CF 1776I - Spinach Pizza Rating: 2500 Tags: games, geometry, greedy, interactive Solve time: 1m 19s Verified: no Solution Problem Understanding We are given a strictly convex polygon with labeled vertices in counterclockwise order. Each move consists of choosing one currently unused vertex. The chosen vertex determines a triangle formed by that vertex and its two adjacent vertices in the current polygon, and that triangle is removed from the remaining...
CF 1776C - Library game
CF 1776C - Library game Rating: 2500 Tags: games, greedy, interactive, sortings Solve time: 1m 21s Verified: no Solution Problem Understanding We are playing a sequential game on a line of labeled sections, each section representing a distinct subject. Each day, one of two players chooses a contiguous interval of sections, constrained by a fixed length coming from a multiset of available “passes”. After the interval is announced, the opponent...
CF 1856D - More Wrong
CF 1856D - More Wrong Rating: 2100 Tags: divide and conquer, interactive Solve time: 1m 33s Verified: no Solution Problem Understanding We are asked to find the position of the maximum element in a hidden permutation of length $n$ by using queries that tell us the number of inversions in a subarray. Each query has a cost that grows quadratically with the subarray length, and we have a global budget...
CF 2216E - Oriented Journey
CF 2216E - Oriented Journey Rating: 2200 Tags: communication, constructive algorithms, interactive Solve time: 2m 1s Verified: no Solution The value $V = 7\frac{1}{16}$ corresponds to the chi-square statistic computed from $k = 11$ categories, as in Eq. (5). The number of degrees of freedom is therefore $\nu = k - 1 = 10$. To determine whether $V$ is improbably high, one consults the line of Table 1 corresponding to...
CF 1987H - Fumo Temple
CF 1987H - Fumo Temple Rating: 3500 Tags: interactive Solve time: 1m 52s Verified: no Solution Problem Understanding We are asked to find a hidden cell in a rectangular matrix of size $n \times m$, where each cell contains either -1, 0, or 1. The cell we are searching for is special: when we query any other cell, the response we receive is the Manhattan distance to the hidden cell...
CF 1906C - Cursed Game
CF 1906C - Cursed Game Rating: 3000 Tags: interactive Solve time: 1m 18s Verified: yes Solution Problem Understanding We are asked to play an interactive game against a demon, who hides a 3×3 secret grid with at least one hole. For each round, we are given an odd integer $N$ and must submit an $N \times N$ grid of black and white cells. The demon produces an $(N-2) \times (N-2)$...
CF 1939A - Draw Polygon Lines
CF 1939A - Draw Polygon Lines Rating: - Tags: *special, constructive algorithms, dp, geometry, interactive Solve time: 1m 1s Verified: yes Solution Problem Understanding We are given a set of points on a 2D plane, and we are asked to draw polygonal lines by connecting these points in a single sequence. Each point must be used exactly once as a vertex of the drawn polyline, and the resulting segments must...
CF 1970D3 - Arithmancy (Hard)
CF 1970D3 - Arithmancy (Hard) Rating: 3100 Tags: interactive Solve time: 2m 23s Verified: no Solution Problem Understanding We are tasked with designing n distinct strings of characters X and O, called magic words. Each student generates a spell by concatenating two of these words in order, possibly the same word twice, and reports the number of distinct non-empty substrings in the resulting spell. Our goal is to reverse this...
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 1970D1 - Arithmancy (Easy)
CF 1970D1 - Arithmancy (Easy) Rating: 2100 Tags: brute force, constructive algorithms, interactive, strings Solve time: 2m 4s Verified: no Solution Problem Understanding We are asked to play the role of Professor Vector in an interactive problem. Our task is twofold. First, we need to generate n distinct magic words consisting only of X and O . Second, given the "power" of a spell, which is defined as the number...
CF 2038G - Guess One Character
CF 2038G - Guess One Character Rating: 1900 Tags: constructive algorithms, implementation, interactive Solve time: 2m 7s Verified: no Solution Problem Understanding We are given an interactive problem where the judge has a hidden binary string s of length n . Our goal is to identify at least one character in s by asking up to three queries per test case. Each query asks how many times a binary substring...
CF 2052H - Hunting Hoglins in Hogwarts
CF 2052H - Hunting Hoglins in Hogwarts Rating: 3500 Tags: interactive Solve time: 1m 4s Verified: yes Solution Problem Understanding The race starts with cars ordered by their labels: $$1,2,3,\dots,n.$$ During the race, an overtake is an adjacent swap. If car $x$ is directly behind car $y$, then the event "$x$ overtakes $y$" swaps their positions. At the end of the race we know only the final ordering $c$. We...
CF 2061G - Kevin and Teams
CF 2061G - Kevin and Teams Rating: 2900 Tags: constructive algorithms, graphs, interactive Solve time: 1m 28s Verified: no Solution Problem Understanding We are given a set of $n$ people where every pair is either connected by a hidden binary relation, friendship or non-friendship. The relation is not known in advance, and in the interactive version it may even react to queries. From these people, we want to pick exactly...
CF 2073H - Secret Lilies and Roses
CF 2073H - Secret Lilies and Roses Rating: 2700 Tags: interactive Solve time: 32s Verified: no Solution Before I start drafting the editorial, I want to clarify one point: Codeforces Problem 2073H, Secret Lilies and Roses , is interactive. Could you confirm whether you want me to include the full interactive protocol handling in Python, or focus mainly on the algorithm logic with a placeholder for the interaction? This affects...
CF 2073E - Minus Operator
CF 2073E - Minus Operator Rating: 3300 Tags: interactive Solve time: 34s Verified: no Solution Before I begin, I want to clarify: the exact interaction rules for Codeforces 2073E (Minus Operator) involve asking queries to some hidden array or sequence via a “minus operator” and receiving responses. I don’t have the official statement in front of me, so I’ll reconstruct it based on the standard interactive problem patterns. Can you...
CF 2181C - Cacti Classification
CF 2181C - Cacti Classification Rating: 3200 Tags: binary search, constructive algorithms, interactive, math Solve time: 1m 51s Verified: no Solution Problem Understanding We are dealing with a hidden connected graph that has a very restricted structure: it is a cactus, meaning every edge participates in at most one simple cycle. The graph may contain loops and multiple edges between the same pair of vertices, and these special edges are...
CF 2206A - Compare Suffixes
CF 2206A - Compare Suffixes Rating: 3500 Tags: interactive Solve time: 1m 54s Verified: no Solution Problem Understanding We are tasked with sorting the suffixes of a hidden string $S$ using an interactive judge. The string has length $n$, and we do not know its contents. We can query any two suffixes $S(i)$ and $S(j)$ to learn which is lexicographically smaller. The goal is to produce a permutation of positions...
CF 2215C - Oriented Journey
CF 2215C - Oriented Journey Rating: 2200 Tags: bitmasks, brute force, communication, constructive algorithms, graphs, interactive, trees Solve time: 1m 54s Verified: no Solution Problem Understanding We are dealing with a two-phase communication system built around a tree. First, an agent receives an undirected tree one edge at a time and must immediately orient each edge. After all edges are oriented, a second agent receives only the resulting directed tree...
CF 2222E - Seek the Truth
CF 2222E - Seek the Truth Rating: - Tags: binary search, bitmasks, constructive algorithms, interactive Solve time: 1m 57s Verified: no Solution Problem Understanding We are interacting with a hidden transformation on integers in the range from 0 to $2^n - 1$. Behind the scenes there is a fixed bitmask $c$ and a hidden operation type $k \in {1,2,3}$. Every time we insert a number $x$, the judge does not...