Codeforces Round 1070 (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
2176 Codeforces Round 1070 (Div. 2) FINISHED False 7200 10941923 Dec. 11, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 5686 ) D Fibonacci Paths PROGRAMMING data structures dp geometry graphs sortings

You are given a directed graph consisting of (n) vertices and (m) edges. Each vertex (v) corresponds to a positive number (a_v). Count the number of distinct simple paths (^{\text{∗}}) consisting of at least two vertices, such that the sequence of numbers written at the vertices along the path forms a generalized Fibonacci sequence. In this problem, we will consider that the sequence of numbers (x_0, x_1, \ldots, x_k) forms a generalized Fibonacci sequence if: (x_0, x_1) are arbitrary natural numbers. (x_i = x_{i - 2} + x_{i - 1}) for all (2 \le i \le k). Note that a generalized Fibonacci sequence consists of at least two numbers. Since the answer may be large, output it modulo (998\,244\,353). (^{\text{∗}})A simple path in a directed graph is a sequence of vertices (v_1, v_2, \ldots, v_k) such that each vertex in the graph appears in the path at most once and there is a directed edge from (v_i) to (v_{i+1}) for all (i < k). 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 first line of each test case contains two numbers (n), (m) ((2 \le n \le 2 \cdot 10^5), (1 \le m \le 2 \cdot 10^5)) — the number of vertices and the number of edges in the graph, respectively. The second line of each test case contains (n) natural numbers (a_1, a_2, \ldots, a_n) ((1 \le a_i \le 10^{18})) — the numbers written at the vertices. The next (m) lines contain the edges of the graph; each edge is defined by two natural numbers (v, u) ((1 \le v, u \le n), (u \neq v)), denoting a directed edge from (v) to (u). It is guaranteed that there are no multiple edges in the graph. It is guaranteed that the sum of (n) and the sum of (m) across all test cases do not exceed (2 \cdot 10^5). For each test case, output the number of paths that form a gen

Tutorials

Codeforces Round 1070 (Div.2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
353148260 216master D Dec. 12, 2025, 6:05 a.m. OK C++17 (GCC 7-32) TESTS 30 187 14131200
353090863 aoprpl D Dec. 11, 2025, 4:30 p.m. OK C++17 (GCC 7-32) TESTS 30 203 9420800
353107808 random_1_guy D Dec. 11, 2025, 6:37 p.m. OK C++17 (GCC 7-32) TESTS 30 203 11571200
353142826 shivanisaini D Dec. 12, 2025, 5:15 a.m. OK C++17 (GCC 7-32) TESTS 30 203 12492800
353085317 krkavindra04 D Dec. 11, 2025, 4:18 p.m. OK C++17 (GCC 7-32) TESTS 30 203 13004800
353141841 shree__ D Dec. 12, 2025, 5:04 a.m. OK C++17 (GCC 7-32) TESTS 30 203 14131200
353136590 sonthaile2002 D Dec. 12, 2025, 3:51 a.m. OK C++17 (GCC 7-32) TESTS 30 203 14848000
353086789 siam__007 D Dec. 11, 2025, 4:22 p.m. OK C++17 (GCC 7-32) TESTS 30 218 6963200
353084728 BohirBagsh D Dec. 11, 2025, 4:17 p.m. OK C++17 (GCC 7-32) TESTS 30 218 10035200
353144792 rpmforrotationsperminute D Dec. 12, 2025, 5:26 a.m. OK C++17 (GCC 7-32) TESTS 30 218 10137600
353141534 ZnZrYb D Dec. 12, 2025, 5 a.m. OK C++20 (GCC 13-64) TESTS 30 156 25804800
353117198 kareemabdelrhman D Dec. 11, 2025, 8:11 p.m. OK C++20 (GCC 13-64) TESTS 30 171 21504000
353115956 rand10202 D Dec. 11, 2025, 7:57 p.m. OK C++20 (GCC 13-64) TESTS 30 171 22220800
353088903 d4rw1n D Dec. 11, 2025, 4:26 p.m. OK C++20 (GCC 13-64) TESTS 30 171 24883200
353083327 JesterKing D Dec. 11, 2025, 4:14 p.m. OK C++20 (GCC 13-64) TESTS 30 171 24883200
353117194 christopherbitti9 D Dec. 11, 2025, 8:11 p.m. OK C++20 (GCC 13-64) TESTS 30 171 30003200
353098324 Quanlehaui D Dec. 11, 2025, 5:37 p.m. OK C++20 (GCC 13-64) TESTS 30 187 12288000
353091564 fk_ D Dec. 11, 2025, 4:32 p.m. OK C++20 (GCC 13-64) TESTS 30 187 19148800
353115383 DaniloLMD D Dec. 11, 2025, 7:50 p.m. OK C++20 (GCC 13-64) TESTS 30 187 22323200
353086356 Graduation D Dec. 11, 2025, 4:21 p.m. OK C++20 (GCC 13-64) TESTS 30 187 24064000
353084985 csp1025 D Dec. 11, 2025, 4:18 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 140 124825600
353145271 shaileshmishra D Dec. 12, 2025, 5:32 a.m. OK C++23 (GCC 14-64, msys2) TESTS 30 156 17715200
353128368 April_sakura D Dec. 12, 2025, 12:25 a.m. OK C++23 (GCC 14-64, msys2) TESTS 30 156 25190400
353086972 GTNewHorizons D Dec. 11, 2025, 4:22 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 171 12390400
353091496 fullflex D Dec. 11, 2025, 4:32 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 171 15667200
353128016 hungchi17 D Dec. 12, 2025, 12:11 a.m. OK C++23 (GCC 14-64, msys2) TESTS 30 171 15974400
353120700 PokemonMasterDad D Dec. 11, 2025, 9:02 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 171 15974400
353148655 HelloJoanna D Dec. 12, 2025, 6:09 a.m. OK C++23 (GCC 14-64, msys2) TESTS 30 171 19558400
353117149 gleb.astashkin D Dec. 11, 2025, 8:11 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 171 21401600
353135889 samotar D Dec. 12, 2025, 3:39 a.m. OK C++23 (GCC 14-64, msys2) TESTS 30 171 22528000
353088699 noob_komder D Dec. 11, 2025, 4:26 p.m. OK Java 21 TESTS 30 437 39628800
353138735 NanDemo D Dec. 12, 2025, 4:24 a.m. OK Java 21 TESTS 30 484 44441600
353084571 Jathinsahu D Dec. 11, 2025, 4:17 p.m. OK Java 21 TESTS 30 718 42393600
353144897 Krishna_1107 D Dec. 12, 2025, 5:28 a.m. OK Java 21 TESTS 30 750 77824000
353132440 kartik__sethi D Dec. 12, 2025, 2:28 a.m. OK Java 21 TESTS 30 828 59187200
353102199 codrrr32 D Dec. 11, 2025, 5:58 p.m. OK Java 21 TESTS 30 859 120524800
353088677 BurnerAce D Dec. 11, 2025, 4:26 p.m. OK Java 21 TESTS 30 875 88780800
353106131 xmjlove D Dec. 11, 2025, 6:25 p.m. OK Java 21 TESTS 30 1218 82329600
353107060 xmjlove D Dec. 11, 2025, 6:31 p.m. OK Java 21 TESTS 30 1250 82636800
353148128 DJ1007 D Dec. 12, 2025, 6:03 a.m. OK Java 21 TESTS 30 1500 31027200
353093153 public-static-void-main D Dec. 11, 2025, 4:34 p.m. OK Java 8 TESTS 30 515 89907200
353091903 Ado90 D Dec. 11, 2025, 4:32 p.m. OK Java 8 TESTS 30 546 45363200
353148052 kamranm D Dec. 12, 2025, 6:02 a.m. OK Java 8 TESTS 30 625 226304000
353085481 code_manik D Dec. 11, 2025, 4:19 p.m. OK Java 8 TESTS 30 640 37171200
353083537 Goku_Kakarot D Dec. 11, 2025, 4:14 p.m. OK Java 8 TESTS 30 718 48844800
353090132 PrathmeshCodess D Dec. 11, 2025, 4:29 p.m. OK Java 8 TESTS 30 1343 56012800
353099816 kevin_0911 D Dec. 11, 2025, 5:44 p.m. OK Java 8 TESTS 30 1656 59187200
353091938 SalicylicAcid D Dec. 11, 2025, 4:32 p.m. OK PyPy 3 TESTS 30 1109 264908800
353129272 kaedeeeee D Dec. 12, 2025, 12:57 a.m. OK PyPy 3 TESTS 30 1484 80588800
353083061 keshavgoelkg25 D Dec. 11, 2025, 4:13 p.m. OK PyPy 3 TESTS 30 1843 68198400
353110620 Akshar_7 D Dec. 11, 2025, 7:01 p.m. OK PyPy 3-64 TESTS 30 406 47104000
353086176 grecil D Dec. 11, 2025, 4:20 p.m. OK PyPy 3-64 TESTS 30 421 65536000
353092419 nitish_biswas01 D Dec. 11, 2025, 4:33 p.m. OK PyPy 3-64 TESTS 30 562 55705600
353112126 OAY71011 D Dec. 11, 2025, 7:16 p.m. OK PyPy 3-64 TESTS 30 562 77312000
353147116 dyuthi.vivek D Dec. 12, 2025, 5:52 a.m. OK PyPy 3-64 TESTS 30 609 48640000
353090276 CodaCoder D Dec. 11, 2025, 4:29 p.m. OK PyPy 3-64 TESTS 30 609 119910400
353085476 ishaanmc D Dec. 11, 2025, 4:19 p.m. OK PyPy 3-64 TESTS 30 671 55296000
353118855 mega_mango D Dec. 11, 2025, 8:33 p.m. OK PyPy 3-64 TESTS 30 671 76185600
353124757 isa773 D Dec. 11, 2025, 10:23 p.m. OK PyPy 3-64 TESTS 30 671 144691200
353086910 botrez669 D Dec. 11, 2025, 4:22 p.m. OK PyPy 3-64 TESTS 30 687 112128000
353111850 vedjaw D Dec. 11, 2025, 7:13 p.m. OK Python 2 TESTS 30 781 76390400
353084184 jayesh_codes D Dec. 11, 2025, 4:16 p.m. OK Python 3 TESTS 30 578 107315200
353101145 aashu.patidar9876 D Dec. 11, 2025, 5:52 p.m. OK Python 3 TESTS 30 593 107212800
353087959 chenyiquan23 D Dec. 11, 2025, 4:24 p.m. OK Python 3 TESTS 30 1203 89804800
353085954 michaelzhan1 D Dec. 11, 2025, 4:20 p.m. OK Python 3 TESTS 30 1812 161587200
353085599 ChanTP D Dec. 11, 2025, 4:19 p.m. OK Python 3 TESTS 30 2000 73523200
353131206 macaroni5708 D Dec. 12, 2025, 1:56 a.m. OK Rust 2021 TESTS 30 109 29388800
353098996 NagisaF D Dec. 11, 2025, 5:40 p.m. OK Rust 2021 TESTS 30 265 54272000
353127714 despair D Dec. 11, 2025, 11:59 p.m. OK Rust 2024 TESTS 30 203 24064000

remove filters

Back to search problems