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 |
---|---|---|---|---|---|---|
1254 | Codeforces Round 601 (Div. 1) | FINISHED | False | 7200 | 157649099 | Nov. 19, 2019, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 1258 ) | D | Tree Queries | PROGRAMMING | data structures probabilities trees | 2600 |
B"Hanh is a famous biologist. He loves growing trees and doing experiments on his own garden. One day, he got a tree consisting of n vertices. Vertices are numbered from 1 to n . A tree with n vertices is an undirected connected graph with n-1 edges. Initially, Hanh sets the value of every vertex to 0 . Now, Hanh performs q operations, each is either of the following types: Since Hanh is good at biology but not math, he needs your help on these operations. The first line contains two integers n and q ( 1 <= q n, q <= q 150 ,000 ) -- the number of vertices on Hanh's tree and the number of operations he performs. Each of the next n - 1 lines contains two integers u and v ( 1 <= q u, v <= q n ), denoting that there is an edge connecting two vertices u and v . It is guaranteed that these n - 1 edges form a tree. Each of the last q lines describes an operation in either formats: It is guaranteed that there is at least one query of the second type. For each operation of the second type, write the expected value on a single line. Let M = 998244353 , it can be shown that the expected value 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 <= x < M and x cdot q equiv p pmod{M} . The image below shows the tree in the example: For the first query, where v = 1 and d = 1 : Hence, the expected values of all vertices after this query are ( 1, 0.4, 0.8, 0.4, 0.4 ). For the second query, where v = 2 and d = 2 : Hence, the expected values of all vertices after this query are ( 2.2, 2.4, 2, 2, 2 ). "... |
Codeforces Round #601 Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
65473551 | Rivaille_Ackerman | D | Nov. 21, 2019, 9:13 a.m. | OK | GNU C++11 | TESTS | 113 | 140 | 14336000 | 2600 | |
65403262 | dqa2020 | D | Nov. 20, 2019, 12:51 a.m. | OK | GNU C++11 | TESTS | 111 | 140 | 16384000 | 2600 | |
66024785 | huanggs | D | Nov. 30, 2019, 8:23 a.m. | OK | GNU C++11 | TESTS | 113 | 140 | 20992000 | 2600 | |
65614047 | nantf | D | Nov. 24, 2019, 2:05 a.m. | OK | GNU C++11 | TESTS | 113 | 140 | 20992000 | 2600 | |
65512454 | tyler178 | D | Nov. 22, 2019, 4:57 a.m. | OK | GNU C++11 | TESTS | 113 | 155 | 15667200 | 2600 | |
65492209 | lyyyyy | D | Nov. 21, 2019, 3:07 p.m. | OK | GNU C++11 | TESTS | 113 | 171 | 13209600 | 2600 | |
65482665 | Imperfect | D | Nov. 21, 2019, 12:10 p.m. | OK | GNU C++11 | TESTS | 113 | 171 | 14336000 | 2600 | |
65492283 | lyyyyy | D | Nov. 21, 2019, 3:09 p.m. | OK | GNU C++11 | TESTS | 113 | 171 | 14438400 | 2600 | |
66400372 | ldxxx | D | Dec. 6, 2019, 12:06 p.m. | OK | GNU C++11 | TESTS | 113 | 186 | 12185600 | 2600 | |
65409237 | WZYYN | D | Nov. 20, 2019, 2:51 a.m. | OK | GNU C++11 | TESTS | 111 | 186 | 12185600 | 2600 | |
65497160 | yan-zp | D | Nov. 21, 2019, 5:05 p.m. | OK | GNU C++14 | TESTS | 113 | 265 | 15564800 | 2600 | |
65420889 | yan-zp | D | Nov. 20, 2019, 8:52 a.m. | OK | GNU C++14 | TESTS | 111 | 265 | 20172800 | 2600 | |
65490772 | SemonChan | D | Nov. 21, 2019, 2:34 p.m. | OK | GNU C++14 | TESTS | 113 | 280 | 15257600 | 2600 | |
65497110 | yan-zp | D | Nov. 21, 2019, 5:04 p.m. | OK | GNU C++14 | TESTS | 113 | 280 | 15564800 | 2600 | |
66048346 | oipotato | D | Nov. 30, 2019, 4:04 p.m. | OK | GNU C++14 | TESTS | 113 | 280 | 15769600 | 2600 | |
65508636 | PureWhite | D | Nov. 22, 2019, 1:43 a.m. | OK | GNU C++14 | TESTS | 113 | 280 | 18534400 | 2600 | |
65450718 | Devil | D | Nov. 20, 2019, 5:59 p.m. | OK | GNU C++14 | TESTS | 113 | 280 | 21299200 | 2600 | |
65496761 | yan-zp | D | Nov. 21, 2019, 4:55 p.m. | OK | GNU C++14 | TESTS | 113 | 296 | 15564800 | 2600 | |
65550509 | theodor.moroianu | D | Nov. 22, 2019, 6:43 p.m. | OK | GNU C++14 | TESTS | 113 | 296 | 15769600 | 2600 | |
65499016 | hellomath | D | Nov. 21, 2019, 5:54 p.m. | OK | GNU C++14 | TESTS | 113 | 296 | 20172800 | 2600 | |
65448275 | neal | D | Nov. 20, 2019, 4:53 p.m. | OK | GNU C++17 | TESTS | 113 | 124 | 16179200 | 2600 | |
65420220 | neal | D | Nov. 20, 2019, 8:39 a.m. | OK | GNU C++17 | TESTS | 111 | 156 | 14438400 | 2600 | |
65420506 | neal | D | Nov. 20, 2019, 8:45 a.m. | OK | GNU C++17 | TESTS | 111 | 171 | 14438400 | 2600 | |
65420496 | neal | D | Nov. 20, 2019, 8:45 a.m. | OK | GNU C++17 | TESTS | 111 | 171 | 14438400 | 2600 | |
65419809 | neal | D | Nov. 20, 2019, 8:29 a.m. | OK | GNU C++17 | TESTS | 111 | 171 | 41369600 | 2600 | |
65419466 | neal | D | Nov. 20, 2019, 8:22 a.m. | OK | GNU C++17 | TESTS | 111 | 186 | 41267200 | 2600 | |
65421529 | neal | D | Nov. 20, 2019, 9:06 a.m. | OK | GNU C++17 | TESTS | 111 | 187 | 14438400 | 2600 | |
65420340 | neal | D | Nov. 20, 2019, 8:42 a.m. | OK | GNU C++17 | TESTS | 111 | 187 | 14438400 | 2600 | |
65421428 | neal | D | Nov. 20, 2019, 9:04 a.m. | OK | GNU C++17 | TESTS | 111 | 202 | 15974400 | 2600 | |
65686447 | aryanc403 | D | Nov. 25, 2019, 12:05 a.m. | OK | GNU C++17 | TESTS | 113 | 218 | 56320000 | 2600 | |
65394364 | uwi | D | Nov. 19, 2019, 6:29 p.m. | OK | Java 11 | TESTS | 110 | 4461 | 522956800 | 2600 | |
65516959 | uwi | D | Nov. 22, 2019, 6:30 a.m. | OK | Java 8 | TESTS | 113 | 373 | 23347200 | 2600 | |
65399497 | fetetriste | D | Nov. 19, 2019, 8:55 p.m. | OK | Java 8 | TESTS | 111 | 482 | 29286400 | 2600 | |
65401379 | fetetriste | D | Nov. 19, 2019, 10:34 p.m. | OK | Java 8 | TESTS | 111 | 561 | 37888000 | 2600 | |
65412353 | dalt | D | Nov. 20, 2019, 5:04 a.m. | OK | Java 8 | TESTS | 111 | 811 | 90009600 | 2600 | |
65516820 | uwi | D | Nov. 22, 2019, 6:27 a.m. | OK | Java 8 | TESTS | 113 | 1263 | 23449600 | 2600 | |
65394018 | uwi | D | Nov. 19, 2019, 6:22 p.m. | OK | Java 8 | TESTS | 110 | 4118 | 528998400 | 2600 | |
65386581 | Egor | D | Nov. 19, 2019, 4:27 p.m. | OK | Java 8 | TESTS | 110 | 4882 | 50278400 | 2600 | |
65447578 | Harpae | D | Nov. 20, 2019, 4:36 p.m. | OK | Java 8 | TESTS | 113 | 4975 | 34611200 | 2600 | |
65764845 | aminul | D | Nov. 26, 2019, 5:26 p.m. | OK | Java 8 | TESTS | 113 | 4975 | 135475200 | 2600 | |
65764717 | aminul | D | Nov. 26, 2019, 5:22 p.m. | OK | Java 8 | TESTS | 113 | 4976 | 135475200 | 2600 | |
65436209 | sansen | D | Nov. 20, 2019, 1:28 p.m. | OK | Rust | TESTS | 111 | 264 | 22323200 | 2600 |
Back to search problems