Codeforces Round 1032 (Div. 3)

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
2121 Codeforces Round 1032 (Div. 3) FINISHED False 8100 26234723 June 17, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 39110 ) A Letter Home PROGRAMMING brute force math

You are given an array of distinct integers (x_1, x_2, \ldots, x_n) and an integer (s). Initially, you are at position (pos = s) on the (X) axis. In one step, you can perform exactly one of the following two actions: Move from position (pos) to position (pos + 1). Move from position (pos) to position (pos - 1). A sequence of steps will be considered successful if, during the entire journey, you visit each position (x_i) on the (X) axis at least once. Note that the initial position (pos = s) is also considered visited. Your task is to determine the minimum number of steps in any successful sequence of steps. Each test consists of multiple test cases. The first line contains a single integer (t) ((1 \leq t \leq 1000)) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers (n) and (s) ((1 \leq n \leq 10), (1 \leq s \leq 100)) — the number of positions to visit and the starting position. The second line of each test case contains (n) integers (x_1, x_2, \ldots, x_n) ((1 \leq x_i \leq 100)). It is guaranteed that for all (1 \leq i < n), it holds that (x_i < x_{i + 1}). For each test case, output the minimum number of steps in any successful sequence of steps. In the first test case, no steps need to be taken, so the only visited position will be (1). In the second test case, the following path can be taken: (2 \rightarrow 1). The number of steps is (1). In the third test case, the following path can be taken: (1 \rightarrow 2). The number of steps is (1). In the fifth test case, the following path can be taken: (2 \rightarrow 1 \rightarrow 2 \rightarrow 3). The number of steps is (3).

Tutorials

Codeforces Round 1032 (Div. 3) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
324929332 og.kostya A June 17, 2025, 5:33 p.m. OK C# 13 TESTS 2 77 0
324970862 nguoicatba A June 18, 2025, 3:29 a.m. OK C# 13 TESTS 2 77 409600
324938887 FrontierAlchemist A June 17, 2025, 5:58 p.m. OK C# 13 TESTS 2 78 102400
324919429 Ashraful00 A June 17, 2025, 4:47 p.m. OK C# 13 TESTS 2 93 307200
324952331 remantadin A June 17, 2025, 8:39 p.m. OK C# 13 TESTS 2 109 1024000
324944160 Lef_n_Right A June 17, 2025, 6:49 p.m. OK C++17 (GCC 7-32) TESTS 2 15 0
324948563 mulyam13986 A June 17, 2025, 7:42 p.m. OK C++17 (GCC 7-32) TESTS 2 15 102400
324941337 Maicol A June 17, 2025, 6:20 p.m. OK C++17 (GCC 7-32) TESTS 2 15 102400
324983490 RisingPhoenix A June 18, 2025, 5:46 a.m. OK C++17 (GCC 7-32) TESTS 2 30 0
324980060 __napa A June 18, 2025, 5:11 a.m. OK C++17 (GCC 7-32) TESTS 2 30 0
324978259 coordinatebash A June 18, 2025, 4:52 a.m. OK C++17 (GCC 7-32) TESTS 2 30 0
324977506 dubiouse A June 18, 2025, 4:44 a.m. OK C++17 (GCC 7-32) TESTS 2 30 0
324975650 LIIXI01 A June 18, 2025, 4:23 a.m. OK C++17 (GCC 7-32) TESTS 2 30 0
324973598 minhnguyenhanhat735 A June 18, 2025, 4:01 a.m. OK C++17 (GCC 7-32) TESTS 2 30 0
324970278 OCDA A June 18, 2025, 3:22 a.m. OK C++17 (GCC 7-32) TESTS 2 30 0
324963934 NomadOfNowhere A June 18, 2025, 1:46 a.m. OK C++20 (GCC 13-64) TESTS 2 0 0
324927958 H4B1B A June 17, 2025, 5:23 p.m. OK C++20 (GCC 13-64) TESTS 2 15 0
324920148 rosahood A June 17, 2025, 4:48 p.m. OK C++20 (GCC 13-64) TESTS 2 15 0
324983801 Altruistic_doom A June 18, 2025, 5:49 a.m. OK C++20 (GCC 13-64) TESTS 2 30 0
324983570 ma7m00d A June 18, 2025, 5:47 a.m. OK C++20 (GCC 13-64) TESTS 2 30 0
324982282 forge_iron A June 18, 2025, 5:34 a.m. OK C++20 (GCC 13-64) TESTS 2 30 0
324980825 Akaezist_23 A June 18, 2025, 5:20 a.m. OK C++20 (GCC 13-64) TESTS 2 30 0
324979339 nil_2000 A June 18, 2025, 5:04 a.m. OK C++20 (GCC 13-64) TESTS 2 30 0
324974149 khanhnghia A June 18, 2025, 4:07 a.m. OK C++20 (GCC 13-64) TESTS 2 30 0
324973326 mayankmanchanda2005 A June 18, 2025, 3:57 a.m. OK C++20 (GCC 13-64) TESTS 2 30 0
324981589 SkyLimit A June 18, 2025, 5:27 a.m. OK C++23 (GCC 14-64, msys2) TESTS 2 15 0
324974187 X_KIRA A June 18, 2025, 4:07 a.m. OK C++23 (GCC 14-64, msys2) TESTS 2 15 0
324973509 alisha1468 A June 18, 2025, 4 a.m. OK C++23 (GCC 14-64, msys2) TESTS 2 15 0
324967436 Ko.Tan.Dc.Crsh A June 18, 2025, 2:42 a.m. OK C++23 (GCC 14-64, msys2) TESTS 2 15 0
324962424 Spartyparty79 A June 18, 2025, 1:17 a.m. OK C++23 (GCC 14-64, msys2) TESTS 2 15 0
324960286 SHAKIL.INNOVATE A June 18, 2025, 12:27 a.m. OK C++23 (GCC 14-64, msys2) TESTS 2 15 0
324958988 RodTries A June 17, 2025, 11:41 p.m. OK C++23 (GCC 14-64, msys2) TESTS 2 15 0
324946314 pj17 A June 17, 2025, 7:15 p.m. OK C++23 (GCC 14-64, msys2) TESTS 2 15 0
324941251 tends.to.zero A June 17, 2025, 6:20 p.m. OK C++23 (GCC 14-64, msys2) TESTS 2 15 0
324930234 Devansh_011 A June 17, 2025, 5:40 p.m. OK C++23 (GCC 14-64, msys2) TESTS 2 15 0
324938454 vishnu888580 A June 17, 2025, 5:54 p.m. OK GNU C11 TESTS 2 30 102400
324922767 stranger_srh A June 17, 2025, 4:53 p.m. OK GNU C11 TESTS 2 30 102400
324979081 roy1012 A June 18, 2025, 5:01 a.m. OK GNU C11 TESTS 2 31 102400
324978818 yyaqx A June 18, 2025, 4:58 a.m. OK GNU C11 TESTS 2 31 102400
324963843 bt55555 A June 18, 2025, 1:44 a.m. OK GNU C11 TESTS 2 31 102400
324982389 ME_is_me A June 18, 2025, 5:35 a.m. OK GNU C11 TESTS 2 46 102400
324946595 fadeevich A June 17, 2025, 7:18 p.m. OK GNU C11 TESTS 2 46 102400
324969915 PrestonLXIX A June 18, 2025, 3:17 a.m. OK Go TESTS 2 46 102400
324977682 tekka_ity A June 18, 2025, 4:46 a.m. OK Java 21 TESTS 2 171 0
324940616 Divyesh_12 A June 17, 2025, 6:14 p.m. OK Java 21 TESTS 2 187 0
324949550 lakshya0808 A June 17, 2025, 7:55 p.m. OK Java 21 TESTS 2 187 921600
324981337 iamalizaidi A June 18, 2025, 5:25 a.m. OK Java 21 TESTS 2 202 0
324957582 gunjan31012003 A June 17, 2025, 10:47 p.m. OK Java 21 TESTS 2 202 204800
324924640 viswasriramani17 A June 17, 2025, 5:01 p.m. OK Java 21 TESTS 2 202 716800
324968676 Mitul11 A June 18, 2025, 3 a.m. OK Java 21 TESTS 2 217 0
324968681 Cartoonshow A June 18, 2025, 3 a.m. OK Java 21 TESTS 2 217 921600
324947607 imkrishnaaaaaaa A June 17, 2025, 7:30 p.m. OK Java 21 TESTS 2 217 1228800
324967688 DeepakKarthick A June 18, 2025, 2:46 a.m. OK Java 21 TESTS 2 218 0
324983556 hustlerZzZ A June 18, 2025, 5:47 a.m. OK Java 8 TESTS 2 140 0
324927252 navneet_404 A June 17, 2025, 5:18 p.m. OK Java 8 TESTS 2 140 0
324965471 bt22cse036 A June 18, 2025, 2:13 a.m. OK Java 8 TESTS 2 155 0
324943000 sandeepchandel A June 17, 2025, 6:37 p.m. OK Java 8 TESTS 2 156 0
324939864 coder2k24 A June 17, 2025, 6:07 p.m. OK Java 8 TESTS 2 156 0
324977364 skk_codes A June 18, 2025, 4:43 a.m. OK Java 8 TESTS 2 171 0
324952538 cAtSiN A June 17, 2025, 8:42 p.m. OK Java 8 TESTS 2 171 0
324952436 helloVaibhav A June 17, 2025, 8:41 p.m. OK Java 8 TESTS 2 171 0
324952211 helloVaibhav A June 17, 2025, 8:37 p.m. OK Java 8 TESTS 2 171 0
324946487 kalpesh05 A June 17, 2025, 7:16 p.m. OK Java 8 TESTS 2 171 0
324954517 akshaybhasin A June 17, 2025, 9:20 p.m. OK Node.js TESTS 2 93 1228800
324942854 illibio A June 17, 2025, 6:35 p.m. OK Node.js TESTS 2 93 1638400
324957599 WbxOne A June 17, 2025, 10:48 p.m. OK Node.js TESTS 2 93 1740800
324922211 Rehantropy56 A June 17, 2025, 4:51 p.m. OK PyPy 3 TESTS 2 93 1536000
324983616 ag5356 A June 18, 2025, 5:48 a.m. OK PyPy 3 TESTS 2 108 2252800
324971296 yiwangwuqian A June 18, 2025, 3:34 a.m. OK PyPy 3 TESTS 2 155 4198400
324954239 Struggle1259 A June 17, 2025, 9:14 p.m. OK PyPy 3 TESTS 2 156 4300800
324950579 cauchips A June 17, 2025, 8:11 p.m. OK PyPy 3 TESTS 2 187 4198400
324973121 Dias1177 A June 18, 2025, 3:55 a.m. OK PyPy 3 TESTS 2 187 4505600
324939898 gardengnome A June 17, 2025, 6:07 p.m. OK PyPy 3-64 TESTS 2 77 1331200
324944266 utsab77 A June 17, 2025, 6:50 p.m. OK PyPy 3-64 TESTS 2 77 1536000
324941839 Umaro A June 17, 2025, 6:25 p.m. OK PyPy 3-64 TESTS 2 77 1740800
324971087 maharaja A June 18, 2025, 3:32 a.m. OK PyPy 3-64 TESTS 2 77 2150400
324930077 FikreyohanesAbera A June 17, 2025, 5:39 p.m. OK PyPy 3-64 TESTS 2 77 2457600
324945409 fawnPersona A June 17, 2025, 7:03 p.m. OK PyPy 3-64 TESTS 2 77 2560000
324963443 hxu10 A June 18, 2025, 1:37 a.m. OK PyPy 3-64 TESTS 2 93 1433600
324947564 LeMih A June 17, 2025, 7:30 p.m. OK PyPy 3-64 TESTS 2 93 2150400
324928048 BlazeG1 A June 17, 2025, 5:24 p.m. OK PyPy 3-64 TESTS 2 93 2150400
324979865 rainbow777 A June 18, 2025, 5:09 a.m. OK PyPy 3-64 TESTS 2 93 2457600
324959779 biltharesatyendra A June 18, 2025, 12:11 a.m. OK Python 2 TESTS 2 77 0
324983802 NAVDEEP009 A June 18, 2025, 5:49 a.m. OK Python 3 TESTS 2 46 0
324983247 tygvi A June 18, 2025, 5:44 a.m. OK Python 3 TESTS 2 46 0
324944231 heisenberg441 A June 17, 2025, 6:49 p.m. OK Python 3 TESTS 2 46 0
324928755 subhash_01 A June 17, 2025, 5:29 p.m. OK Python 3 TESTS 2 46 0
324921101 venkatpavank A June 17, 2025, 4:49 p.m. OK Python 3 TESTS 2 46 0
324968954 inbaselvanayyanar A June 18, 2025, 3:03 a.m. OK Python 3 TESTS 2 46 102400
324982969 nuhanintekhab A June 18, 2025, 5:41 a.m. OK Python 3 TESTS 2 46 204800
324982155 229x1a05e1 A June 18, 2025, 5:33 a.m. OK Python 3 TESTS 2 46 204800
324980168 trupal_dholariya A June 18, 2025, 5:12 a.m. OK Python 3 TESTS 2 46 204800
324940818 rcd A June 17, 2025, 6:16 p.m. OK Python 3 TESTS 2 46 204800
324961844 dhattarwalmohit A June 18, 2025, 1:05 a.m. OK Rust 2021 TESTS 2 31 102400
324957353 0x81 A June 17, 2025, 10:40 p.m. OK Rust 2021 TESTS 2 46 0

remove filters

Back to search problems