Squarepoint Challenge (Codeforces Round 1055, 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
2152 Squarepoint Challenge (Codeforces Round 1055, Div. 1 + Div. 2) FINISHED False 10800 16903523 Oct. 3, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 12783 ) B Catching the Krug PROGRAMMING games math

Doran and the Krug are playing a game on a grid consisting of ((n + 1) \times (n + 1)) cells whose coordinates are pairs of integers from (0) to (n), inclusive. The Krug's goal is not to be caught by Doran for as long as possible, while Doran's goal is to catch the Krug as early as possible. We say Doran caught the Krug if they stand on the same grid cell. To play the game, the Krug and Doran take turns alternately, starting from the Krug: The Krug can either stay in the same cell or move to a cell vertically or horizontally (but not diagonally) adjacent. Formally, if the Krug is currently at the cell ((a, b)), she can stay at ((a, b)) or move to either ((a-1, b), (a, b-1), (a, b+1), (a+1, b)). Doran can either stay in the same cell or move to a cell vertically, horizontally, or diagonally adjacent. Formally, if Doran is currently at the cell ((c, d)), he can stay at ((c, d)) or move to either ((c-1, d-1), (c-1, d), (c-1, d+1), (c, d-1), (c, d+1), (c+1, d-1), (c+1, d), (c+1, d+1)). Both players cannot go outside of the grid. The Krug's survival time is defined as the number of Doran's turns until Doran catches the Krug for the given starting cells of the players. Assuming that both players play optimally, find the Krug's survival time or report that the Krug can survive for infinite turns. 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. Each test case consists of a single line containing five integers (n), (r_K), (c_K), (r_D), and (c_D) ((1 \le n \le 10^9), (0 \le r_K, c_K, r_D, c_D \le n), ((r_K, c_K) \ne (r_D, c_D))) — (n) is the size of the grid, ((r_K, c_K)) represents the Krug's starting cell, and ((r_D, c_D)) represents Doran's starting cell. For each test case, output the Krug's survival time when both players play optimally. If the Krug can survive for i

Tutorials

Squarepoint Challenge (Codeforces Round 1055, Div. 1 + Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
341727692 mahmudur9 B Oct. 3, 2025, 5:02 p.m. OK C# 13 TESTS 2 109 3072000
341729300 saba.ent B Oct. 3, 2025, 5:07 p.m. OK C++17 (GCC 7-32) TESTS 2 15 0
341786730 QodeXpert B Oct. 4, 2025, 5:37 a.m. OK C++17 (GCC 7-32) TESTS 2 30 0
341780228 pinoely B Oct. 4, 2025, 4:19 a.m. OK C++17 (GCC 7-32) TESTS 2 30 0
341770461 KiNnT B Oct. 4, 2025, 2:04 a.m. OK C++17 (GCC 7-32) TESTS 2 30 0
341760102 invoker._ B Oct. 3, 2025, 9:35 p.m. OK C++17 (GCC 7-32) TESTS 2 30 0
341759610 Gononajontro_Biggani B Oct. 3, 2025, 9:25 p.m. OK C++17 (GCC 7-32) TESTS 2 30 0
341759413 kanishkjindal2006 B Oct. 3, 2025, 9:22 p.m. OK C++17 (GCC 7-32) TESTS 2 30 0
341749474 Hajime_Umemiya B Oct. 3, 2025, 7:20 p.m. OK C++17 (GCC 7-32) TESTS 2 30 0
341758329 mithilesh_19 B Oct. 3, 2025, 9:04 p.m. OK C++17 (GCC 7-32) TESTS 2 30 0
341786792 sabrek B Oct. 4, 2025, 5:37 a.m. OK C++17 (GCC 7-32) TESTS 2 30 0
341754771 saksham_2104 B Oct. 3, 2025, 8:17 p.m. OK C++20 (GCC 13-64) TESTS 2 30 0
341790179 Jonsnow_001 B Oct. 4, 2025, 6:05 a.m. OK C++20 (GCC 13-64) TESTS 2 30 0
341783936 HosseinMomeni B Oct. 4, 2025, 5:08 a.m. OK C++20 (GCC 13-64) TESTS 2 30 0
341769070 IanPardo B Oct. 4, 2025, 1:39 a.m. OK C++20 (GCC 13-64) TESTS 2 30 0
341749431 Vpinx B Oct. 3, 2025, 7:19 p.m. OK C++20 (GCC 13-64) TESTS 2 30 0
341749184 SakiBee B Oct. 3, 2025, 7:17 p.m. OK C++20 (GCC 13-64) TESTS 2 30 0
341731342 usedchang B Oct. 3, 2025, 5:14 p.m. OK C++20 (GCC 13-64) TESTS 2 30 0
341728915 Chhota-Bheem B Oct. 3, 2025, 5:06 p.m. OK C++20 (GCC 13-64) TESTS 2 30 0
341725862 NikhilRajG B Oct. 3, 2025, 4:57 p.m. OK C++20 (GCC 13-64) TESTS 2 30 0
341723902 UIT.NgocHung B Oct. 3, 2025, 4:51 p.m. OK C++20 (GCC 13-64) TESTS 2 30 0
341723559 i_am_pikachu B Oct. 3, 2025, 4:50 p.m. OK C++23 (GCC 14-64, msys2) TESTS 2 15 0
341781337 Hossain_Ahmed B Oct. 4, 2025, 4:35 a.m. OK C++23 (GCC 14-64, msys2) TESTS 2 15 0
341776981 HZH0821 B Oct. 4, 2025, 3:36 a.m. OK C++23 (GCC 14-64, msys2) TESTS 2 15 0
341769527 Fantasy_Blue B Oct. 4, 2025, 1:47 a.m. OK C++23 (GCC 14-64, msys2) TESTS 2 15 0
341736579 cymero B Oct. 3, 2025, 5:30 p.m. OK C++23 (GCC 14-64, msys2) TESTS 2 15 0
341735830 UK5 B Oct. 3, 2025, 5:28 p.m. OK C++23 (GCC 14-64, msys2) TESTS 2 15 0
341769941 exccc B Oct. 4, 2025, 1:55 a.m. OK C++23 (GCC 14-64, msys2) TESTS 2 30 0
341777157 Anuron_Das B Oct. 4, 2025, 3:38 a.m. OK C++23 (GCC 14-64, msys2) TESTS 2 30 0
341771160 Morisakikaf B Oct. 4, 2025, 2:15 a.m. OK C++23 (GCC 14-64, msys2) TESTS 2 30 0
341769173 atduskfallszijin B Oct. 4, 2025, 1:41 a.m. OK C++23 (GCC 14-64, msys2) TESTS 2 30 0
341729493 hollow_knight_14 B Oct. 3, 2025, 5:08 p.m. OK C# 8 TESTS 2 140 3481600
341749915 Abdullah_Fathi_ B Oct. 3, 2025, 7:24 p.m. OK GNU C11 TESTS 2 61 0
341720949 Sujal_Gound B Oct. 3, 2025, 4:42 p.m. OK GNU C11 TESTS 2 77 0
341731272 Alpha_Zeros B Oct. 3, 2025, 5:14 p.m. OK GNU C11 TESTS 2 77 102400
341735370 Raamki B Oct. 3, 2025, 5:26 p.m. OK GNU C11 TESTS 2 92 0
341736814 AldrinJ B Oct. 3, 2025, 5:31 p.m. OK GNU C11 TESTS 2 93 0
341731544 Hriday.Modi B Oct. 3, 2025, 5:14 p.m. OK GNU C11 TESTS 2 108 0
341724688 optimistic_Euler B Oct. 3, 2025, 4:53 p.m. OK Java 21 TESTS 2 171 0
341726188 shivansh_123 B Oct. 3, 2025, 4:58 p.m. OK Java 21 TESTS 2 171 0
341732675 Sagar_TH_45 B Oct. 3, 2025, 5:18 p.m. OK Java 21 TESTS 2 186 0
341726246 Sonmale25 B Oct. 3, 2025, 4:58 p.m. OK Java 21 TESTS 2 202 0
341773415 apchampion12 B Oct. 4, 2025, 2:49 a.m. OK Java 21 TESTS 2 202 0
341724799 winter262005 B Oct. 3, 2025, 4:53 p.m. OK Java 21 TESTS 2 217 0
341756341 Balu2907 B Oct. 3, 2025, 8:36 p.m. OK Java 21 TESTS 2 218 0
341721230 Azad_Singh B Oct. 3, 2025, 4:43 p.m. OK Java 21 TESTS 2 233 307200
341737864 jacksparrow53536 B Oct. 3, 2025, 5:33 p.m. OK Java 21 TESTS 2 234 102400
341730967 shhh_knight30 B Oct. 3, 2025, 5:13 p.m. OK Java 21 TESTS 2 234 204800
341724597 abbassnaim122 B Oct. 3, 2025, 4:53 p.m. OK Java 8 TESTS 2 108 0
341781531 lupunish B Oct. 4, 2025, 4:38 a.m. OK Java 8 TESTS 2 109 0
341778711 arnaw34 B Oct. 4, 2025, 4:01 a.m. OK Java 8 TESTS 2 233 0
341743584 pannalapranay1406 B Oct. 3, 2025, 6:33 p.m. OK Java 8 TESTS 2 249 0
341732239 dhruvv.j B Oct. 3, 2025, 5:17 p.m. OK Java 8 TESTS 2 281 0
341730804 yashjoshiatforces B Oct. 3, 2025, 5:12 p.m. OK Java 8 TESTS 2 312 0
341725889 L-S-S B Oct. 3, 2025, 4:57 p.m. OK Kotlin 2.2 TESTS 2 187 102400
341743543 malikquasran B Oct. 3, 2025, 6:32 p.m. OK Kotlin 2.2 TESTS 2 218 0
341725633 2310030053 B Oct. 3, 2025, 4:56 p.m. OK Kotlin 2.2 TESTS 2 374 0
341734148 Homka_666 B Oct. 3, 2025, 5:23 p.m. OK Node.js TESTS 2 202 7577600
341765958 swseverance B Oct. 4, 2025, 12:27 a.m. OK Node.js TESTS 2 202 9318400
341725192 jsaddict044 B Oct. 3, 2025, 4:55 p.m. OK PyPy 3 TESTS 2 249 10035200
341771932 mengjihua B Oct. 4, 2025, 2:26 a.m. OK PyPy 3 TESTS 2 280 42700800
341760964 morraconda B Oct. 3, 2025, 9:54 p.m. OK PyPy 3 TESTS 2 281 10444800
341728055 belote44 B Oct. 3, 2025, 5:03 p.m. OK PyPy 3 TESTS 2 530 9113600
341737212 sohamgupta.1515 B Oct. 3, 2025, 5:32 p.m. OK PyPy 3 TESTS 2 796 9932800
341764078 gardengnome B Oct. 3, 2025, 11:26 p.m. OK PyPy 3-64 TESTS 2 125 4710400
341727024 VSS103072_ChMSaad B Oct. 3, 2025, 5 p.m. OK PyPy 3-64 TESTS 2 125 9216000
341770060 LIKIPOPO B Oct. 4, 2025, 1:57 a.m. OK PyPy 3-64 TESTS 2 140 4812800
341766279 Little_Sheep_Yawn B Oct. 4, 2025, 12:36 a.m. OK PyPy 3-64 TESTS 2 140 7065600
341734740 apiitg B Oct. 3, 2025, 5:25 p.m. OK PyPy 3-64 TESTS 2 155 4403200
341725439 Alireza_Tofigh B Oct. 3, 2025, 4:55 p.m. OK PyPy 3-64 TESTS 2 155 5836800
341746220 jvatsal0709 B Oct. 3, 2025, 6:51 p.m. OK PyPy 3-64 TESTS 2 155 7987200
341742848 RobinFromTheHood B Oct. 3, 2025, 6:29 p.m. OK PyPy 3-64 TESTS 2 155 8704000
341756655 explainer B Oct. 3, 2025, 8:41 p.m. OK PyPy 3-64 TESTS 2 156 7987200
341731931 mkarami B Oct. 3, 2025, 5:16 p.m. OK PyPy 3-64 TESTS 2 171 4198400
341724750 hemantiitd B Oct. 3, 2025, 4:53 p.m. OK Python 2 TESTS 2 515 0
341728025 zbugaev0 B Oct. 3, 2025, 5:03 p.m. OK Python 3 TESTS 2 78 0
341724757 dhlinhdn00 B Oct. 3, 2025, 4:53 p.m. OK Python 3 TESTS 2 92 4915200
341756267 kodolskii B Oct. 3, 2025, 8:35 p.m. OK Python 3 TESTS 2 93 0
341747296 NoCodeNoLifeEz B Oct. 3, 2025, 7 p.m. OK Python 3 TESTS 2 93 0
341726785 shiva_sai_15 B Oct. 3, 2025, 4:59 p.m. OK Python 3 TESTS 2 93 0
341735987 MagicalShivam B Oct. 3, 2025, 5:28 p.m. OK Python 3 TESTS 2 93 102400
341737101 BEENAXIS-_- B Oct. 3, 2025, 5:31 p.m. OK Python 3 TESTS 2 93 204800
341754737 unnamedperson64 B Oct. 3, 2025, 8:17 p.m. OK Python 3 TESTS 2 108 0
341770339 Chanukya.palle B Oct. 4, 2025, 2:02 a.m. OK Python 3 TESTS 2 109 0
341746670 pikachar B Oct. 3, 2025, 6:54 p.m. OK Python 3 TESTS 2 124 0

remove filters

Back to search problems