Educational Codeforces Round 183 (Rated for 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
2145 Educational Codeforces Round 183 (Rated for Div. 2) FINISHED False 7200 16644323 Oct. 6, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 974 ) F Long Journey PROGRAMMING dfs and similar dp graphs matrices number theory shortest paths

There is a strip divided into cells, numbered from (0) to (m) from left to right. You are controlling a chip that is initially in the cell (0). There is a trap in each cell; they are activated according to the following rules: at the end of moves (1, (1+n), (1+2n), \dots), traps are activated in cells (x) where (x \bmod a_1 = b_1); at the end of moves (2, (2+n), (2+2n), \dots), traps are activated in cells (x) where (x \bmod a_2 = b_2); (\cdots) at the end of moves (n, (n+n), (n+2n), \dots), traps are activated in cells (x) where (x \bmod a_n= b_n). In one turn, you can either move from the current cell to the next or stay in place. Then all the traps for this turn are activated. If the chip is in a cell with an activated trap at the beginning of the turn, the game ends. Your task is to calculate the minimum number of turns to reach the cell (m), or report that it is impossible. If the chip reaches the cell (m) and at the end of the same turn, a trap in the cell (m) activates, it is not considered a valid way to reach the cell (m) . The first line contains a single integer (t) ((1 \le t \le 100)) — the number of test cases. The first line of each test case contains two integers (n) and (m) ((1 \le n \le 10); (1 \le m \le 10^{12})). The second line contains (n) integers (a_1, a_2, \dots, a_n) ((2 \le a_i \le 10)). The third line contains (n) integers (b_1, b_2, \dots, b_n) ((0 \le b_i < a_i)). For each test case, print a single integer — the minimum number of turns to reach cell (m). If it is impossible, print -1 .

Tutorials

Educational Codeforces Round 183 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
342441713 wabca F Oct. 7, 2025, 1:13 p.m. OK C++17 (GCC 7-32) TESTS 21 62 0
342404592 cxf2006 F Oct. 7, 2025, 8:15 a.m. OK C++17 (GCC 7-32) TESTS 21 77 1228800
342408490 ghc7hHx F Oct. 7, 2025, 8:45 a.m. OK C++17 (GCC 7-32) TESTS 21 93 0
342414756 OdtreeKing F Oct. 7, 2025, 9:37 a.m. OK C++17 (GCC 7-32) TESTS 21 109 73830400
342373257 Broder F Oct. 7, 2025, 2:06 a.m. OK C++17 (GCC 7-32) TESTS 21 124 0
342370594 numbertheorist17 F Oct. 7, 2025, 1:18 a.m. OK C++17 (GCC 7-32) TESTS 21 125 409600
342534996 Aile41 F Oct. 8, 2025, 5:12 a.m. OK C++17 (GCC 7-32) TESTS 21 171 0
342405573 fangzx F Oct. 7, 2025, 8:23 a.m. OK C++17 (GCC 7-32) TESTS 21 562 5017600
342405295 fangzx F Oct. 7, 2025, 8:21 a.m. OK C++17 (GCC 7-32) TESTS 21 608 5017600
342450646 gevak F Oct. 7, 2025, 2:11 p.m. OK C++17 (GCC 7-32) TESTS 21 609 409600
342350451 ALAov F Oct. 6, 2025, 7:10 p.m. OK C++20 (GCC 13-64) TESTS 21 77 0
342351246 maxplus F Oct. 6, 2025, 7:17 p.m. OK C++20 (GCC 13-64) TESTS 21 77 307200
342507391 maurine26 F Oct. 7, 2025, 8:29 p.m. OK C++20 (GCC 13-64) TESTS 21 92 0
342375598 OutsiderZz F Oct. 7, 2025, 2:47 a.m. OK C++20 (GCC 13-64) TESTS 21 92 102400
342508058 sho_eib_w_sho_msh_eib F Oct. 7, 2025, 8:38 p.m. OK C++20 (GCC 13-64) TESTS 21 93 102400
342349891 maxplus F Oct. 6, 2025, 7:04 p.m. OK C++20 (GCC 13-64) TESTS 21 93 204800
342348958 maxplus F Oct. 6, 2025, 6:56 p.m. OK C++20 (GCC 13-64) TESTS 21 93 204800
342509951 Shoeib F Oct. 7, 2025, 9:07 p.m. OK C++20 (GCC 13-64) TESTS 21 109 102400
342401314 monui F Oct. 7, 2025, 7:47 a.m. OK C++20 (GCC 13-64) TESTS 21 109 102400
342375744 YYC_CodeForces F Oct. 7, 2025, 2:50 a.m. OK C++20 (GCC 13-64) TESTS 21 109 102400
342426761 gooonn F Oct. 7, 2025, 11:13 a.m. OK C++23 (GCC 14-64, msys2) TESTS 21 62 0
342403969 Yuichiro17 F Oct. 7, 2025, 8:09 a.m. OK C++23 (GCC 14-64, msys2) TESTS 21 62 0
342401864 Swayyyy F Oct. 7, 2025, 7:51 a.m. OK C++23 (GCC 14-64, msys2) TESTS 21 77 0
342371175 shengdanbucuo F Oct. 7, 2025, 1:29 a.m. OK C++23 (GCC 14-64, msys2) TESTS 21 77 0
342473224 Galaxy_KW F Oct. 7, 2025, 4:15 p.m. OK C++23 (GCC 14-64, msys2) TESTS 21 77 102400
342357728 carboxylBase F Oct. 6, 2025, 8:28 p.m. OK C++23 (GCC 14-64, msys2) TESTS 21 93 307200
342470094 Galaxy_KW F Oct. 7, 2025, 3:57 p.m. OK C++23 (GCC 14-64, msys2) TESTS 21 109 0
342412450 saidqulovsarvar669 F Oct. 7, 2025, 9:18 a.m. OK C++23 (GCC 14-64, msys2) TESTS 21 124 0
342339955 KshitijxRex F Oct. 6, 2025, 5:51 p.m. OK C++23 (GCC 14-64, msys2) TESTS 21 171 0
342373071 Abilmansur-007 F Oct. 7, 2025, 2:03 a.m. OK C++23 (GCC 14-64, msys2) TESTS 21 186 33689600
342408663 gerkghdri F Oct. 7, 2025, 8:47 a.m. OK GNU C11 TESTS 21 62 819200
342412175 gerkghdri F Oct. 7, 2025, 9:16 a.m. OK GNU C11 TESTS 21 93 819200
342408291 gerkghdri F Oct. 7, 2025, 8:44 a.m. OK GNU C11 TESTS 21 468 18636800
342408110 gerkghdri F Oct. 7, 2025, 8:42 a.m. OK GNU C11 TESTS 21 530 18636800
342407673 gerkghdri F Oct. 7, 2025, 8:39 a.m. OK GNU C11 TESTS 21 796 12697600
342477250 zhozholong F Oct. 7, 2025, 4:39 p.m. OK PyPy 3-64 TESTS 21 311 8806400
342476278 zhozholong F Oct. 7, 2025, 4:33 p.m. OK PyPy 3-64 TESTS 21 342 8806400
342418978 smz.26 F Oct. 7, 2025, 10:12 a.m. OK PyPy 3-64 TESTS 21 687 34816000

remove filters

Back to search problems