#games
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 1600E - Array Game
CF 1600E - Array Game Rating: 1900 Tags: games, greedy, two pointers Solve time: 1m 34s Verified: yes Solution Problem Understanding We are given an array of numbers laid out in a line. Two players alternate turns, starting with Alice. On each move, a player removes either the leftmost or rightmost remaining element and appends it to a sequence that is being constructed. The only restriction is that the resulting...
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 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 914H - Ember and Storm's Tree Game
CF 914H - Ember and Storm's Tree Game Rating: 3400 Tags: combinatorics, dp, games, trees Solve time: 10m 4s Verified: yes Solution Problem Understanding The game begins with Ember choosing a tree on $n$ labeled vertices, with the restriction that no vertex has degree exceeding $d$. After that, Storm selects an ordered pair of vertices $(u, v)$, which determines a simple path in the tree. Writing the vertex labels along...
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 1402C - Star Trek
CF 1402C - Star Trek Rating: 2600 Tags: *special, combinatorics, dfs and similar, dp, games, graphs, matrices, trees Solve time: 1m 26s Verified: yes Solution Problem Understanding We are given a tree of $N$ planets. Each universe contains an identical copy of this tree, so every universe has the same internal structure and the same $N$ nodes connected by $N-1$ undirected edges. There are $D+1$ universes indexed from $0$ to...
CF 1425A - Arena of Greed
CF 1425A - Arena of Greed Rating: 1400 Tags: games, greedy Solve time: 1m 16s Verified: yes Solution Problem Understanding The problem is a two-player coin game. There is a pile of $N$ gold coins. Players alternate turns, starting with Mr. Chanek. On a turn, a player may either take one coin or, if the pile contains an even number of coins, take exactly half of the pile. Each player...
CF 1434E - A Convex Game
CF 1434E - A Convex Game Rating: 3500 Tags: dsu, games Solve time: 1m 8s Verified: yes Solution Problem Understanding We are given several independent games. Each game consists of a strictly increasing array of integers. Two players alternate moves, and on each move a player selects one element from the array. The chosen indices must form a strictly increasing sequence over time, so once you pick a position, you...
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 1695A - Subrectangle Guess
CF 1695A - Subrectangle Guess Rating: 800 Tags: games Solve time: 2m 22s Verified: yes Solution Problem Understanding We are given a grid containing distinct integers. Michael chooses dimensions h × w , then Joe secretly selects any subrectangle of exactly that size. Michael must name the maximum value inside Joe's chosen rectangle before seeing which rectangle was selected. Since all values are distinct, the entire board has a unique...
CF 1695B - Circle Game
CF 1695B - Circle Game Rating: 1000 Tags: games, greedy Solve time: 2m 6s Verified: yes Solution Problem Understanding We are asked to analyze a two-player game played on a circle of stone piles. Each pile has a certain number of stones. Players take turns removing a positive number of stones from the current pile. The turns move clockwise, so after a player removes stones from pile i , 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 1987D - World is Mine
CF 1987D - World is Mine Rating: 1800 Tags: dp, games Solve time: 5m 18s Verified: no Solution Problem Understanding We have a two-player game between Alice and Bob played over a set of cakes, each with an integer tastiness. Alice goes first. On her turn, she can only take a cake with a tastiness strictly higher than any cake she has previously eaten, while Bob can take any remaining...
CF 1866I - Imagination Castle
CF 1866I - Imagination Castle Rating: 2300 Tags: dp, games, two pointers Solve time: 1m 42s Verified: yes Solution Problem Understanding We are given a grid with $N$ rows and $M$ columns. A game piece starts at the top-left cell $(1,1)$. From any cell, the piece can move either to the right within the same row or downward within the same column, but never left or up. Each move can...
CF 1906G - Grid Game 2
CF 1906G - Grid Game 2 Rating: 2900 Tags: games, number theory Solve time: 2m 21s Verified: yes Solution Problem Understanding We are asked to analyze a two-player game played on an enormous grid of size $10^9 \times 10^9$. Each cell can be either black or white. Initially, only $N$ specific cells are black, and all others are white. Players take turns choosing a black cell. When a cell $(r,...
CF 1939D - Big Persimmon
CF 1939D - Big Persimmon Rating: - Tags: *special, dp, games Solve time: 33s Verified: no Solution Before I start, can you confirm if the input consists of multiple test cases, or just a single test case per execution? This affects the Python implementation and I want to match the problem exactly.
CF 1970C3 - Game on Tree (Hard)
CF 1970C3 - Game on Tree (Hard) Rating: 1900 Tags: dfs and similar, dp, games, trees Solve time: 1m 59s Verified: yes Solution Problem Understanding We are given a tree of n nodes, and multiple rounds of a two-player game. In each round, a stone starts on one node. Players alternate moves, moving the stone to an unactivated neighbor and marking that neighbor as activated. The player who cannot move...
CF 1970C2 - Game on Tree (Medium)
CF 1970C2 - Game on Tree (Medium) Rating: 1700 Tags: dfs and similar, dp, games, trees Solve time: 2m Verified: yes Solution Problem Understanding We are given a tree where every node is initially unused. A single stone is placed on a chosen starting node. From that moment, players alternate moves, starting with Ron. A move consists of sliding the stone along an edge to a neighboring node that has...
CF 1970C1 - Game on Tree (Easy)
CF 1970C1 - Game on Tree (Easy) Rating: 1400 Tags: games Solve time: 1m 18s Verified: yes Solution Problem Understanding The structure we are given is not an arbitrary tree in the usual sense, but a very restricted one: it has exactly two leaves. That means every node has degree at most two, except possibly some internal nodes, and the whole graph is essentially a single chain. In other words,...
CF 2002B - Removals Game
CF 2002B - Removals Game Rating: 1000 Tags: constructive algorithms, games Solve time: 3m Verified: yes Solution Problem Understanding We have two players, Alice and Bob, each holding a permutation of the numbers from 1 to n. They will alternately remove elements from either end of their respective arrays. After n-1 turns, only one element remains in each array. If the remaining elements are equal, Bob wins; otherwise, Alice wins....
CF 2038A - Bonus Project
CF 2038A - Bonus Project Rating: 1400 Tags: games, greedy Solve time: 2m 9s Verified: no Solution Problem Understanding We have a team of engineers, each with a promised bonus and a personal cost for doing one unit of work. The team needs to complete a project that requires exactly $k$ units of work, and every engineer will decide individually how much to contribute. The amount each engineer contributes, $c_i$,...
CF 2045F - Grid Game 3-angle
CF 2045F - Grid Game 3-angle Rating: 3000 Tags: games, math Solve time: 1m 48s Verified: no Solution Problem Understanding We are given a triangular grid of size $N$, where row $r$ has $r$ cells. Certain cells initially contain some stones. Two players, Anda and Kamu, alternate turns, starting with Anda. On a turn, a player picks a cell with at least one stone, removes between $1$ and $K$ stones,...
CF 2079A - Alice, Bob, And Two Arrays
CF 2079A - Alice, Bob, And Two Arrays Rating: 3300 Tags: *special, data structures, dp, games Solve time: 55s Verified: yes Solution Problem Understanding We have two players, Alice and Bob, each with their own array of integers of the same length. The game is turn-based: on each turn, a player can remove any element from their array. The score a player earns on a turn is the sum of...
CF 2181F - Fragmented Nim
CF 2181F - Fragmented Nim Rating: 1600 Tags: games Solve time: 1m 51s Verified: yes Solution Problem Understanding We are asked to analyze a variation of the classical game of Nim. In the original Nim, players take turns picking a pile and removing any number of stones. The player who takes the last stone wins. In this variant, the twist is that the player whose turn it is does not...
CF 2181B - Battle of Arrays
CF 2181B - Battle of Arrays Rating: 1400 Tags: data structures, games, greedy Solve time: 1m 55s Verified: no Solution Problem Understanding We are asked to simulate a turn-based game between Alice and Bob. Each player starts with an array of positive integers. On their turn, a player picks any element from their own array and applies it against the maximal element in the opponent's array. If the chosen element...
CF 2206B - Subtree Removal Game
CF 2206B - Subtree Removal Game Rating: 2500 Tags: binary search, games, trees Solve time: 2m 20s Verified: yes Solution Problem Understanding We are given a rooted tree with nodes numbered from 1 to $n$, rooted at node 1. Each node may either have an integer written on it (leaves) or be empty (internal nodes). Two players play a game: on a turn, a player removes a subtree rooted at...
CF 2215F - Research
CF 2215F - Research Rating: 3500 Tags: games Solve time: 1m 40s Verified: no Solution Problem Understanding We are looking at a two-player deterministic game played on a deck that is mostly identical cards except for one special card. The special card, initially green, sits at a known position from the top. Each turn, a player removes a fixed number of cards from the top of the deck, can optionally...
CF 48E - Ivan the Fool VS Gorynych the Dragon
CF 48E - Ivan the Fool VS Gorynych the Dragon Rating: 2100 Tags: dp, games, graphs Solve time: 2m 21s Verified: yes Solution Problem Understanding The game state is completely described by two numbers: how many heads and how many tails the dragon currently has. From a state (h, t) Ivan may choose one of two move types. If he cuts i heads, where 1 ≤ i ≤ n and...
CF 38F - Smart Boy
CF 38F - Smart Boy Rating: 2100 Tags: dp, games, strings Solve time: 2m 49s Verified: no Solution Problem Understanding We start with an empty string. The first player picks any single letter that appears somewhere inside at least one dictionary word. After that, players alternately extend the current string by adding exactly one character either to the front or to the back. The restriction is the core of the...