Codeforces Round 1098 (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
2228 Codeforces Round 1098 (Div. 2) FINISHED False 8100 1437887 May 16, 2026, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 14546 ) B Remilia Plays Soku PROGRAMMING games implementation

Remilia is trying to escape, while Reimu wants to land the final hit. The playing field consists of (n) positions arranged in a circle. For each (1 \le i \lt n), positions (i) and (i+1) are adjacent, and positions (1) and (n) are also adjacent. Initially, at time (0), Reimu is at position (x_1) and Remilia is at position (x_2), where (x_1 \ne x_2). Each second, the following happens in order: Remilia either moves to an adjacent position or stays in place. Over the entire game, she may move to an adjacent position at most (k) times. After observing Remilia's action, Reimu either moves to an adjacent position or stays in place. If they are at the same position after both actions, Reimu catches Remilia and the game ends. Assuming both players play optimally, Reimu always tries to minimize the catching time, while Remilia tries to maximize it. Find the number of seconds until Reimu catches Remilia. Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 10^4)). The description of the test cases follows. The only line of each test case contains four integers (n), (x_1), (x_2) and (k) ((2\le n\le10^8), (1\le x_1,x_2\le n), (x_1\ne x_2), (0\le k\le 10^8)). For each test case, output the number of seconds until Reimu catches Remilia, assuming both players play optimally. In the first test case, one possible sequence of actions is: In the first second, Remilia stays in place, and then Reimu moves to (2) and catches Remilia. In the second test case, one possible sequence of actions is: In the first second, Remilia moves to (1), and then Reimu moves to (2). In the second second, Remilia cannot move and has to stay in place, and then Reimu moves to (1) and catches Remilia.

Tutorials

Codeforces Round 1098 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
374894420 farjyt61 B May 17, 2026, 4:12 a.m. OK C++17 (GCC 7-32) TESTS 7 31 0
374903776 365KW B May 17, 2026, 5:57 a.m. OK C++17 (GCC 7-32) TESTS 7 31 0
374903488 rishav_yadav B May 17, 2026, 5:54 a.m. OK C++17 (GCC 7-32) TESTS 7 31 0
374903014 Akshat_cp B May 17, 2026, 5:49 a.m. OK C++17 (GCC 7-32) TESTS 7 31 0
374901096 Mperorrrc B May 17, 2026, 5:30 a.m. OK C++17 (GCC 7-32) TESTS 7 31 0
374900908 amitommiter B May 17, 2026, 5:28 a.m. OK C++17 (GCC 7-32) TESTS 7 31 0
374896485 cmbk1337 B May 17, 2026, 4:40 a.m. OK C++17 (GCC 7-32) TESTS 7 31 0
374895869 forrealtho B May 17, 2026, 4:32 a.m. OK C++17 (GCC 7-32) TESTS 7 31 0
374895681 Mohammad_Hifzaan123 B May 17, 2026, 4:30 a.m. OK C++17 (GCC 7-32) TESTS 7 31 0
374894494 HeetShah_456 B May 17, 2026, 4:13 a.m. OK C++17 (GCC 7-32) TESTS 7 31 0
374888878 oneoneone1 B May 17, 2026, 3:25 a.m. OK C++20 (GCC 13-64) TESTS 7 31 0
374902181 GoshaLaz B May 17, 2026, 5:41 a.m. OK C++20 (GCC 13-64) TESTS 7 31 0
374900820 Zakaria_Morshed B May 17, 2026, 5:27 a.m. OK C++20 (GCC 13-64) TESTS 7 31 0
374899825 psyop B May 17, 2026, 5:16 a.m. OK C++20 (GCC 13-64) TESTS 7 31 0
374897571 Luban B May 17, 2026, 4:52 a.m. OK C++20 (GCC 13-64) TESTS 7 31 0
374896561 v31 B May 17, 2026, 4:41 a.m. OK C++20 (GCC 13-64) TESTS 7 31 0
374894601 kevin_0911 B May 17, 2026, 4:15 a.m. OK C++20 (GCC 13-64) TESTS 7 31 0
374894138 jack061206 B May 17, 2026, 4:08 a.m. OK C++20 (GCC 13-64) TESTS 7 31 0
374893886 mdammar9891 B May 17, 2026, 4:05 a.m. OK C++20 (GCC 13-64) TESTS 7 31 0
374890118 sunny_04 B May 17, 2026, 3:44 a.m. OK C++20 (GCC 13-64) TESTS 7 31 0
374874423 vishesh1139p B May 16, 2026, 9:04 p.m. OK C++23 (GCC 14-64, msys2) TESTS 7 15 0
374884896 Qubit26 B May 17, 2026, 2:11 a.m. OK C++23 (GCC 14-64, msys2) TESTS 7 15 102400
374877863 mkamal1234 B May 16, 2026, 10:23 p.m. OK C++23 (GCC 14-64, msys2) TESTS 7 15 102400
374868891 aryanc403 B May 16, 2026, 7:42 p.m. OK C++23 (GCC 14-64, msys2) TESTS 7 15 102400
374900825 Kartik24116 B May 17, 2026, 5:27 a.m. OK C++23 (GCC 14-64, msys2) TESTS 7 31 0
374904250 sairaj2k05 B May 17, 2026, 6:01 a.m. OK C++23 (GCC 14-64, msys2) TESTS 7 31 0
374903897 Elvryn B May 17, 2026, 5:58 a.m. OK C++23 (GCC 14-64, msys2) TESTS 7 31 0
374903586 kabanovrk B May 17, 2026, 5:55 a.m. OK C++23 (GCC 14-64, msys2) TESTS 7 31 0
374902504 cpr_123 B May 17, 2026, 5:44 a.m. OK C++23 (GCC 14-64, msys2) TESTS 7 31 0
374901592 pushkarparakh B May 17, 2026, 5:35 a.m. OK C++23 (GCC 14-64, msys2) TESTS 7 31 0
374873928 Enthusiast_123 B May 16, 2026, 8:55 p.m. OK C# 8 TESTS 7 78 3174400
374900086 pmculer26 B May 17, 2026, 5:19 a.m. OK GNU C11 TESTS 7 46 0
374896637 Sajib1127 B May 17, 2026, 4:42 a.m. OK GNU C11 TESTS 7 46 0
374901350 SeekerOfTruth B May 17, 2026, 5:33 a.m. OK GNU C11 TESTS 7 62 0
374850589 argusvan B May 16, 2026, 4:42 p.m. OK GNU C11 TESTS 7 62 0
374846858 allabhyap B May 16, 2026, 4:35 p.m. OK GNU C11 TESTS 7 62 0
374846493 avtscf B May 16, 2026, 4:34 p.m. OK GNU C11 TESTS 7 62 0
374853356 mexxxxi B May 16, 2026, 4:47 p.m. OK GNU C11 TESTS 7 78 0
374854521 happy032 B May 16, 2026, 4:48 p.m. OK GNU C11 TESTS 7 93 0
374847016 aristrogate B May 16, 2026, 4:35 p.m. OK GNU C11 TESTS 7 93 0
374853938 HashMallow B May 16, 2026, 4:48 p.m. OK Go TESTS 7 171 1126400
374868238 divyaHAVES_71 B May 16, 2026, 7:34 p.m. OK Java 21 TESTS 7 203 102400
374902558 Aswin_V B May 17, 2026, 5:45 a.m. OK Java 21 TESTS 7 203 614400
374866489 madhu.korada131 B May 16, 2026, 7:19 p.m. OK Java 21 TESTS 7 203 1638400
374887828 brutus_7 B May 17, 2026, 3:07 a.m. OK Java 21 TESTS 7 203 1843200
374894078 Dan1c B May 17, 2026, 4:07 a.m. OK Java 21 TESTS 7 203 1945600
374878809 Ayushman01 B May 16, 2026, 10:51 p.m. OK Java 21 TESTS 7 218 102400
374849964 dxtmanav B May 16, 2026, 4:41 p.m. OK Java 21 TESTS 7 218 307200
374898705 AK1117 B May 17, 2026, 5:05 a.m. OK Java 21 TESTS 7 218 819200
374899016 learnerview B May 17, 2026, 5:08 a.m. OK Java 21 TESTS 7 218 921600
374864918 AviNlogN B May 16, 2026, 7:05 p.m. OK Java 21 TESTS 7 218 1126400
374871989 harsh08 B May 16, 2026, 8:25 p.m. OK Java 8 TESTS 7 109 0
374846381 thunder_deba B May 16, 2026, 4:34 p.m. OK Java 8 TESTS 7 109 0
374877377 Jawdat8 B May 16, 2026, 10:09 p.m. OK Java 8 TESTS 7 125 0
374864598 2manas1 B May 16, 2026, 7:03 p.m. OK Java 8 TESTS 7 125 0
374895930 ajinkya222 B May 17, 2026, 4:33 a.m. OK Java 8 TESTS 7 187 0
374846736 aashishkr9931 B May 16, 2026, 4:34 p.m. OK Java 8 TESTS 7 218 0
374904477 mrmohancmk447799 B May 17, 2026, 6:03 a.m. OK JavaScript TESTS 7 78 2560000
374876545 Fegom B May 16, 2026, 9:49 p.m. OK Kotlin 2.2 TESTS 7 187 204800
374900229 eigen_loop B May 17, 2026, 5:21 a.m. OK PyPy 3 TESTS 7 156 4096000
374851226 chitoglt B May 16, 2026, 4:43 p.m. OK PyPy 3 TESTS 7 187 6348800
374853133 Yolanesso B May 16, 2026, 4:46 p.m. OK PyPy 3 TESTS 7 203 7884800
374879839 MadhavK2007 B May 16, 2026, 11:24 p.m. OK PyPy 3 TESTS 7 218 8089600
374854280 ujjwaladitya01 B May 16, 2026, 4:48 p.m. OK PyPy 3 TESTS 7 234 7372800
374903010 itscris7777777 B May 17, 2026, 5:49 a.m. OK PyPy 3 TESTS 7 234 7577600
374881208 Codingsfan B May 17, 2026, 12:09 a.m. OK PyPy 3 TESTS 7 234 8089600
374887084 Charandeep23 B May 17, 2026, 2:54 a.m. OK PyPy 3 TESTS 7 250 7680000
374871479 scooley B May 16, 2026, 8:17 p.m. OK PyPy 3-64 TESTS 7 78 5222400
374898411 RankOneTensor B May 17, 2026, 5:02 a.m. OK PyPy 3-64 TESTS 7 93 4608000
374889914 Jayling B May 17, 2026, 3:41 a.m. OK PyPy 3-64 TESTS 7 93 4915200
374852455 Z_i_a_d_M_G_25 B May 16, 2026, 4:45 p.m. OK PyPy 3-64 TESTS 7 93 5120000
374898457 LUNAA B May 17, 2026, 5:02 a.m. OK PyPy 3-64 TESTS 7 93 5427200
374888217 SsyHow B May 17, 2026, 3:14 a.m. OK PyPy 3-64 TESTS 7 93 5529600
374850202 Atharva2710 B May 16, 2026, 4:41 p.m. OK PyPy 3-64 TESTS 7 93 6348800
374851431 Anton_Igorevich B May 16, 2026, 4:43 p.m. OK PyPy 3-64 TESTS 7 109 3993600
374886770 AAE B May 17, 2026, 2:48 a.m. OK PyPy 3-64 TESTS 7 109 4915200
374847138 skylarkr B May 16, 2026, 4:35 p.m. OK PyPy 3-64 TESTS 7 109 4915200
374881782 chmpro B May 17, 2026, 12:29 a.m. OK Python 3 TESTS 7 62 1228800
374873635 Abhay_2812 B May 16, 2026, 8:50 p.m. OK Python 3 TESTS 7 62 1536000
374851824 2410030376 B May 16, 2026, 4:44 p.m. OK Python 3 TESTS 7 62 4198400
374854457 0xtsama B May 16, 2026, 4:48 p.m. OK Python 3 TESTS 7 62 4300800
374850495 sandeepkumar2005 B May 16, 2026, 4:42 p.m. OK Python 3 TESTS 7 62 4300800
374896259 ToxicRabbittt B May 17, 2026, 4:37 a.m. OK Python 3 TESTS 7 78 0
374879744 crazy_bitch_03 B May 16, 2026, 11:21 p.m. OK Python 3 TESTS 7 78 0
374847688 IIITian_A.R B May 16, 2026, 4:36 p.m. OK Python 3 TESTS 7 78 204800
374899321 gooonn B May 17, 2026, 5:11 a.m. OK Python 3 TESTS 7 78 1331200
374881723 chmpro B May 17, 2026, 12:27 a.m. OK Python 3 TESTS 7 78 1331200
374852694 hatshotpamthi B May 16, 2026, 4:45 p.m. OK Rust 2024 TESTS 7 46 0

remove filters

Back to search problems