Codeforces Global Round 31 (Div. 1 + Div. 2)

Solutions are presented as using the least memory and the fastest execution time. It also takes the top 10 most recent solutions from each language. If you want to limit to a specific index, click the "Solved" button and go to that problem.

ContestId
Name
Phase
Frozen
Duration (Seconds)
Relative Time
Start Time
2180 Codeforces Global Round 31 (Div. 1 + Div. 2) FINISHED False 9000 10250722 Dec. 19, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 25751 ) A Carnival Wheel PROGRAMMING brute force number theory

You have a prize wheel divided into (l) sections, numbered from (0) to (l-1). The sections are arranged in a circle, so after section (l-1), the numbering continues again from section (0). Initially, the prize pointer is at section (a). Each time you spin the wheel, the pointer moves exactly (b) sections forward. That is, after one spin, the pointer moves from section (a) to section ((a+b)\bmod l), after two spins to ((a+2b)\bmod l), and so on(^{\text{∗}}). You may spin the wheel any number of times (including zero). After you stop, the section where the pointer finally lands determines your prize: you receive an amount equal to the number of that section. What is the maximum prize you can obtain? (^{\text{∗}})Here, (x \bmod y) denotes the remainder from dividing (x) by (y). Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 500)). The description of the test cases follows. The first line of each test case contains three integers (l, a), and (b) ((1 \le l, b \le 5000), (0 \le a \le l-1)). For each test case, output the maximum prize that can be obtained. In the first test case, by spinning the wheel three times and then claiming the reward, you can obtain a maximum value of (4). The sequence of pointer positions is: (3, 0, 2, 4, 1, 3, 0, \ldots) In the second test case, the pointer will remain on section (0) indefinitely. In the fourth test case, with (b = 1) and starting from section (0), the pointer will iterate over all sections, including the last one. Link to the visualizer

Tutorials

Codeforces Global Round 31

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
354267107 MahiPatel11 A Dec. 20, 2025, 6:10 a.m. OK C++17 (GCC 7-32) TESTS 4 15 0
354259046 N1664 A Dec. 20, 2025, 4:41 a.m. OK C++17 (GCC 7-32) TESTS 4 15 0
354254735 Laserlight A Dec. 20, 2025, 3:36 a.m. OK C++17 (GCC 7-32) TESTS 4 15 0
354254634 love_csu A Dec. 20, 2025, 3:34 a.m. OK C++17 (GCC 7-32) TESTS 4 15 0
354253029 CodeIsOnlyWay A Dec. 20, 2025, 3:04 a.m. OK C++17 (GCC 7-32) TESTS 4 15 0
354252460 wangtianze A Dec. 20, 2025, 2:54 a.m. OK C++17 (GCC 7-32) TESTS 4 15 0
354252121 A_zhen A Dec. 20, 2025, 2:47 a.m. OK C++17 (GCC 7-32) TESTS 4 15 0
354249433 gymbro123321 A Dec. 20, 2025, 1:42 a.m. OK C++17 (GCC 7-32) TESTS 4 15 0
354248257 ORZXY A Dec. 20, 2025, 1:11 a.m. OK C++17 (GCC 7-32) TESTS 4 15 0
354240281 Jimmyia A Dec. 19, 2025, 9:12 p.m. OK C++17 (GCC 7-32) TESTS 4 15 0
354255689 K-Marjona A Dec. 20, 2025, 3:52 a.m. OK C++20 (GCC 13-64) TESTS 4 15 0
354228372 Guzal11 A Dec. 19, 2025, 6:36 p.m. OK C++20 (GCC 13-64) TESTS 4 15 0
354226800 palakbandhu A Dec. 19, 2025, 6:23 p.m. OK C++20 (GCC 13-64) TESTS 4 15 0
354225507 arbalestOvO A Dec. 19, 2025, 6:12 p.m. OK C++20 (GCC 13-64) TESTS 4 15 0
354211227 codegodddd A Dec. 19, 2025, 4:52 p.m. OK C++20 (GCC 13-64) TESTS 4 15 0
354209826 gurusakthis.23ece A Dec. 19, 2025, 4:49 p.m. OK C++20 (GCC 13-64) TESTS 4 15 0
354259562 sailTuT A Dec. 20, 2025, 4:48 a.m. OK C++20 (GCC 13-64) TESTS 4 15 102400
354254006 L1r0gn A Dec. 20, 2025, 3:23 a.m. OK C++20 (GCC 13-64) TESTS 4 15 102400
354266928 232006 A Dec. 20, 2025, 6:08 a.m. OK C++20 (GCC 13-64) TESTS 4 31 0
354266287 guptameetkumar A Dec. 20, 2025, 6:02 a.m. OK C++20 (GCC 13-64) TESTS 4 31 0

remove filters

Back to search problems