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 |
|---|---|---|---|---|---|---|
| 2040 | Codeforces Round 992 (Div. 2) | FINISHED | False | 7200 | 42737123 | Dec. 8, 2024, 2:35 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 2656 ) | E | Control of Randomness | PROGRAMMING | combinatorics dfs and similar graphs greedy math probabilities trees |
You are given a tree with (n) vertices. Let's place a robot in some vertex (v \ne 1), and suppose we initially have (p) coins. Consider the following process, where in the (i)-th step (starting from (i = 1)): If (i) is odd, the robot moves to an adjacent vertex in the direction of vertex (1); Else, (i) is even. You can either pay one coin (if there are some left) and then the robot moves to an adjacent vertex in the direction of vertex (1), or not pay, and then the robot moves to an adjacent vertex chosen uniformly at random . The process stops as soon as the robot reaches vertex (1). Let (f(v, p)) be the minimum possible expected number of steps in the process above if we spend our coins optimally. Answer (q) queries, in the (i)-th of which you have to find the value of (f(v_i, p_i)), modulo(^{\text{∗}}) (998\,244\,353). (^{\text{∗}}) Formally, let (M = 998\,244\,353). It can be shown that the answer can be expressed as an irreducible fraction (\frac{p}{q}), where (p) and (q) are integers and (q \not \equiv 0 \pmod{M}). Output the integer equal to (p \cdot q^{-1} \bmod M). In other words, output such an integer (x) that (0 \le x < M) and (x \cdot q \equiv p \pmod{M}). Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 10^3)). The description of the test cases follows. The first line of each test case contains two integers (n) and (q) ((2 \le n \le 2 \cdot 10^3); (1 \le q \le 2 \cdot 10^3)) — the number of vertices in the tree and the number of queries. The next (n - 1) lines contain the edges of the tree, one edge per line. The (i)-th line contains two integers (u_i) and (v_i) ((1 \le u_i, v_i \le n); (u_i \neq v_i)), denoting the edge between the nodes (u_i) and (v_i). The next (q) lines contain two integers (v_i) and (p_i) ($$$2 |
| Codeforces Round #992 (Div.2) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 295695017 | ac2u | E | Dec. 9, 2024, 4:10 a.m. | OK | C++17 (GCC 7-32) | TESTS | 33 | 46 | 0 | ||
| 295657630 | TZC-CHsurpass | E | Dec. 8, 2024, 7:11 p.m. | OK | C++17 (GCC 7-32) | TESTS | 33 | 46 | 0 | ||
| 295692965 | MaxDYF | E | Dec. 9, 2024, 3:52 a.m. | OK | C++17 (GCC 7-32) | TESTS | 33 | 46 | 102400 | ||
| 295688336 | reincarnated_again | E | Dec. 9, 2024, 3:01 a.m. | OK | C++17 (GCC 7-32) | TESTS | 33 | 46 | 102400 | ||
| 295656495 | Alpha_Q | E | Dec. 8, 2024, 7 p.m. | OK | C++17 (GCC 7-32) | TESTS | 33 | 46 | 102400 | ||
| 295699167 | gs20036 | E | Dec. 9, 2024, 5:03 a.m. | OK | C++17 (GCC 7-32) | TESTS | 33 | 61 | 102400 | ||
| 295693929 | daud04 | E | Dec. 9, 2024, 4 a.m. | OK | C++17 (GCC 7-32) | TESTS | 33 | 61 | 102400 | ||
| 295690740 | Mio0222 | E | Dec. 9, 2024, 3:32 a.m. | OK | C++17 (GCC 7-32) | TESTS | 33 | 62 | 102400 | ||
| 295679813 | byebye10000 | E | Dec. 9, 2024, 1:37 a.m. | OK | C++17 (GCC 7-32) | TESTS | 33 | 62 | 102400 | ||
| 295662616 | abeot | E | Dec. 8, 2024, 8:08 p.m. | OK | C++17 (GCC 7-32) | TESTS | 33 | 62 | 102400 | ||
| 295700661 | SCUTkk | E | Dec. 9, 2024, 5:23 a.m. | OK | C++20 (GCC 13-64) | TESTS | 33 | 46 | 102400 | ||
| 295688230 | Mkswll | E | Dec. 9, 2024, 3 a.m. | OK | C++20 (GCC 13-64) | TESTS | 33 | 46 | 102400 | ||
| 295686859 | Ichinoseyang | E | Dec. 9, 2024, 2:48 a.m. | OK | C++20 (GCC 13-64) | TESTS | 33 | 46 | 102400 | ||
| 295675968 | a_little_cute | E | Dec. 9, 2024, 12:30 a.m. | OK | C++20 (GCC 13-64) | TESTS | 33 | 46 | 102400 | ||
| 295657962 | dalgu | E | Dec. 8, 2024, 7:15 p.m. | OK | C++20 (GCC 13-64) | TESTS | 33 | 46 | 102400 | ||
| 295644767 | JanBobi | E | Dec. 8, 2024, 5:24 p.m. | OK | C++20 (GCC 13-64) | TESTS | 33 | 46 | 102400 | ||
| 295631283 | El_Medonho | E | Dec. 8, 2024, 4:18 p.m. | OK | C++20 (GCC 13-64) | TESTS | 33 | 46 | 102400 | ||
| 295675905 | daoqi | E | Dec. 9, 2024, 12:28 a.m. | OK | C++20 (GCC 13-64) | TESTS | 33 | 61 | 0 | ||
| 295691714 | Jiangnan111 | E | Dec. 9, 2024, 3:41 a.m. | OK | C++20 (GCC 13-64) | TESTS | 33 | 61 | 102400 | ||
| 295677001 | enslaved | E | Dec. 9, 2024, 1:02 a.m. | OK | C++20 (GCC 13-64) | TESTS | 33 | 61 | 102400 | ||
| 295681976 | AKStream | E | Dec. 9, 2024, 1:58 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 33 | 46 | 102400 | ||
| 295691099 | rgrgtgrf | E | Dec. 9, 2024, 3:35 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 33 | 61 | 102400 | ||
| 295643151 | mnbvcxz123_long_dick | E | Dec. 8, 2024, 5:14 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 33 | 61 | 102400 | ||
| 295702155 | hzk_cpp | E | Dec. 9, 2024, 5:42 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 33 | 61 | 16076800 | ||
| 295632567 | friedel | E | Dec. 8, 2024, 4:21 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 33 | 62 | 0 | ||
| 295690885 | Empty_Dust | E | Dec. 9, 2024, 3:33 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 33 | 62 | 102400 | ||
| 295683646 | LNian | E | Dec. 9, 2024, 2:13 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 33 | 62 | 102400 | ||
| 295665775 | automac | E | Dec. 8, 2024, 8:45 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 33 | 62 | 102400 | ||
| 295665378 | Pashteticus | E | Dec. 8, 2024, 8:39 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 33 | 62 | 102400 | ||
| 295660606 | Shu.Rong | E | Dec. 8, 2024, 7:44 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 33 | 62 | 102400 | ||
| 295635423 | arvindf232 | E | Dec. 8, 2024, 4:28 p.m. | OK | Kotlin 1.9 | TESTS | 33 | 249 | 16691200 | ||
| 295631518 | tcltk | E | Dec. 8, 2024, 4:18 p.m. | OK | PyPy 3 | TESTS | 33 | 1171 | 9932800 | ||
| 295636018 | x_n | E | Dec. 8, 2024, 4:30 p.m. | OK | PyPy 3-64 | TESTS | 33 | 171 | 10956800 | ||
| 295649336 | jvatsal0709 | E | Dec. 8, 2024, 5:57 p.m. | OK | PyPy 3-64 | TESTS | 33 | 187 | 5632000 | ||
| 295636700 | Proelectro_Cpp | E | Dec. 8, 2024, 4:31 p.m. | OK | PyPy 3-64 | TESTS | 33 | 202 | 5734400 | ||
| 295635381 | Haire | E | Dec. 8, 2024, 4:28 p.m. | OK | PyPy 3-64 | TESTS | 33 | 217 | 5017600 | ||
| 295634560 | TOMATO_MAT_TO | E | Dec. 8, 2024, 4:26 p.m. | OK | PyPy 3-64 | TESTS | 33 | 217 | 8396800 | ||
| 295631818 | tassei903 | E | Dec. 8, 2024, 4:19 p.m. | OK | PyPy 3-64 | TESTS | 33 | 218 | 6758400 | ||
| 295640041 | hxu10 | E | Dec. 8, 2024, 4:58 p.m. | OK | PyPy 3-64 | TESTS | 33 | 218 | 9011200 | ||
| 295631217 | OpKos | E | Dec. 8, 2024, 4:17 p.m. | OK | PyPy 3-64 | TESTS | 33 | 234 | 7884800 | ||
| 295664276 | _Aditya_Jain_ | E | Dec. 8, 2024, 8:25 p.m. | OK | PyPy 3-64 | TESTS | 33 | 234 | 8294400 | ||
| 295631668 | motsuni04 | E | Dec. 8, 2024, 4:19 p.m. | OK | PyPy 3-64 | TESTS | 33 | 265 | 40755200 |
Back to search problems