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 |
|---|---|---|---|---|---|---|
| 833 | Codeforces Round 426 (Div. 1) | FINISHED | False | 7200 | 274980323 | July 30, 2017, 2:35 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 482 ) | D | Red-Black Cobweb | PROGRAMMING | data structures divide and conquer implementation trees | 2800 |
Slastyona likes to watch life of nearby grove's dwellers. This time she watches a strange red-black spider sitting at the center of a huge cobweb. The cobweb is a set of n nodes connected by threads, each of the treads is either red of black. Using these threads, the spider can move between nodes. No thread connects a node to itself, and between any two nodes there is a unique sequence of threads connecting them. Slastyona decided to study some special qualities of the cobweb. She noticed that each of the threads has a value of clamminess x . However, Slastyona is mostly interested in jelliness of the cobweb. Consider those of the shortest paths between each pair of nodes on which the numbers of red and black threads differ at most twice. For each such path compute the product of the clamminess of threads on the path.The jelliness of the cobweb is the product of all obtained values among all paths. Those paths that differ by direction only are counted only once. Of course, this number can be huge, so Slastyona asks you to compute the jelliness of the given cobweb and print the answer modulo 10 9 + 7 . The first line contains the number of nodes n (2 ≤ n ≤ 10 5 ) . The next n - 1 lines contain four integers each, denoting the i -th thread of the cobweb: the nodes it connects u i , v i (1 ≤ u i ≤ n , 1 ≤ v i ≤ n ) , the clamminess of the thread x i (1 ≤ x ≤ 10 9 + 6) , and the color of the thread c i ( ). The red color is denoted by 0 , and the black color is denoted by 1 . Print single integer the jelliness of the cobweb modulo 10 9 + 7 . If there are no paths such that the numbers of red and black threads differ at most twice, print 1 . In the first example there are 4 pairs of nodes such that the numbers of threads of both colors on them differ at most twice. There pairs are (1, 3) with product of clamminess equal to 45 , (1, 5) with product of clamminess equal to 45 , (3, 4) with product of clamminess equal to 25 and (4, 5) with product of clamminess equ |
| Codeforces Round #426 Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 29460490 | vjudge2 | D | Aug. 14, 2017, 2:51 p.m. | OK | GNU C++ | TESTS | 87 | 607 | 18124800 | 2800 | |
| 29460456 | Groexhy | D | Aug. 14, 2017, 2:50 p.m. | OK | GNU C++ | TESTS | 87 | 608 | 18124800 | 2800 | |
| 38794842 | Worldwide_D | D | May 31, 2018, 8:28 a.m. | OK | GNU C++ | TESTS | 87 | 685 | 17203200 | 2800 | |
| 42299398 | Scut82 | D | Aug. 31, 2018, 6:33 a.m. | OK | GNU C++ | TESTS | 87 | 717 | 30412800 | 2800 | |
| 42299299 | Scut82 | D | Aug. 31, 2018, 6:28 a.m. | OK | GNU C++ | TESTS | 87 | 873 | 30412800 | 2800 | |
| 29934276 | laofudasuan | D | Aug. 31, 2017, 3:44 a.m. | OK | GNU C++ | TESTS | 87 | 1138 | 28262400 | 2800 | |
| 34658205 | Scut82 | D | Jan. 29, 2018, 10:50 a.m. | OK | GNU C++ | TESTS | 87 | 1388 | 22528000 | 2800 | |
| 38708736 | Heaplax | D | May 29, 2018, 4:04 a.m. | OK | GNU C++ | TESTS | 87 | 1544 | 16998400 | 2800 | |
| 29618094 | DoanPhuDuc | D | Aug. 20, 2017, 10:15 a.m. | OK | GNU C++ | TESTS | 87 | 1902 | 33177600 | 2800 | |
| 29618112 | DoanPhuDuc | D | Aug. 20, 2017, 10:16 a.m. | OK | GNU C++ | TESTS | 87 | 1918 | 33177600 | 2800 | |
| 61808162 | songpengyu | D | Oct. 3, 2019, 11:43 p.m. | OK | GNU C++11 | TESTS | 87 | 374 | 27340800 | 2800 | |
| 61795897 | songpengyu | D | Oct. 3, 2019, 5:14 p.m. | OK | GNU C++11 | TESTS | 87 | 421 | 27238400 | 2800 | |
| 29016770 | Radewoosh | D | July 30, 2017, 4:23 p.m. | OK | GNU C++11 | TESTS | 87 | 545 | 75468800 | 2800 | |
| 29045193 | FizzyDavid | D | July 31, 2017, 10:27 a.m. | OK | GNU C++11 | TESTS | 87 | 623 | 22220800 | 2800 | |
| 29045856 | chitanda | D | July 31, 2017, 10:58 a.m. | OK | GNU C++11 | TESTS | 87 | 639 | 19865600 | 2800 | |
| 29358347 | vjudge4 | D | Aug. 11, 2017, 4:48 p.m. | OK | GNU C++11 | TESTS | 87 | 670 | 19865600 | 2800 | |
| 29358351 | vjudge1 | D | Aug. 11, 2017, 4:49 p.m. | OK | GNU C++11 | TESTS | 87 | 686 | 19865600 | 2800 | |
| 29218227 | Hank2006 | D | Aug. 5, 2017, 12:14 p.m. | OK | GNU C++11 | TESTS | 87 | 701 | 19660800 | 2800 | |
| 29065245 | Y_UME | D | July 31, 2017, 3:25 p.m. | OK | GNU C++11 | TESTS | 87 | 717 | 19660800 | 2800 | |
| 29044882 | rajat1603 | D | July 31, 2017, 10:11 a.m. | OK | GNU C++11 | TESTS | 87 | 764 | 19865600 | 2800 | |
| 29481371 | mengrao | D | Aug. 15, 2017, 12:35 p.m. | OK | GNU C++14 | TESTS | 87 | 483 | 11776000 | 2800 | |
| 29482765 | mengrao | D | Aug. 15, 2017, 1:36 p.m. | OK | GNU C++14 | TESTS | 87 | 514 | 11776000 | 2800 | |
| 40980403 | ReaLNero1 | D | July 30, 2018, 5:31 p.m. | OK | GNU C++14 | TESTS | 87 | 529 | 9932800 | 2800 | |
| 29122726 | hogloid | D | Aug. 2, 2017, 8:19 a.m. | OK | GNU C++14 | TESTS | 87 | 546 | 20070400 | 2800 | |
| 46757746 | I_love_Y_UME | D | Dec. 8, 2018, 12:31 p.m. | OK | GNU C++14 | TESTS | 87 | 732 | 16896000 | 2800 | |
| 51604204 | gtrhetr | D | March 21, 2019, 6:25 a.m. | OK | GNU C++14 | TESTS | 87 | 733 | 27443200 | 2800 | |
| 39273161 | pr3pony | D | June 15, 2018, 6:33 p.m. | OK | GNU C++14 | TESTS | 87 | 748 | 18636800 | 2800 | |
| 33855983 | abeker | D | Jan. 1, 2018, 11:44 p.m. | OK | GNU C++14 | TESTS | 87 | 748 | 27238400 | 2800 | |
| 29045918 | jtnydv25 | D | July 31, 2017, 11:01 a.m. | OK | GNU C++14 | TESTS | 87 | 841 | 85094400 | 2800 | |
| 69099338 | fstqaq | D | Jan. 19, 2020, 1:20 p.m. | OK | GNU C++14 | TESTS | 87 | 842 | 11673600 | 2800 | |
| 60720950 | kefaa2 | D | Sept. 17, 2019, 12:22 p.m. | OK | GNU C++17 | TESTS | 87 | 826 | 22732800 | 2800 | |
| 58568107 | vjudge4 | D | Aug. 11, 2019, 8:51 a.m. | OK | GNU C++17 | TESTS | 87 | 1169 | 23040000 | 2800 | |
| 58568068 | solaimanope | D | Aug. 11, 2019, 8:50 a.m. | OK | GNU C++17 | TESTS | 87 | 1169 | 23040000 | 2800 | |
| 58464684 | sincerity | D | Aug. 8, 2019, 6:40 p.m. | OK | GNU C++17 | TESTS | 87 | 1481 | 14438400 | 2800 | |
| 67042888 | AliShahali1382 | D | Dec. 16, 2019, 8:11 p.m. | OK | GNU C++17 | TESTS | 87 | 1482 | 28569600 | 2800 | |
| 48535366 | Rzepa | D | Jan. 18, 2019, 1:59 p.m. | OK | GNU C++17 | TESTS | 87 | 1560 | 125644800 | 2800 | |
| 58519407 | TianSunXing | D | Aug. 10, 2019, 3:19 a.m. | OK | GNU C++17 | TESTS | 87 | 1653 | 18227200 | 2800 | |
| 58519335 | TianZuiXing | D | Aug. 10, 2019, 3:15 a.m. | OK | GNU C++17 | TESTS | 87 | 1669 | 18227200 | 2800 | |
| 46012526 | Shayan.P | D | Nov. 20, 2018, 9:50 p.m. | OK | GNU C++17 | TESTS | 87 | 1871 | 75366400 | 2800 | |
| 58520969 | TianPingXing | D | Aug. 10, 2019, 4:37 a.m. | OK | GNU C++17 | TESTS | 87 | 2745 | 14950400 | 2800 | |
| 29026371 | uwi | D | July 30, 2017, 8:01 p.m. | OK | Java 8 | TESTS | 87 | 1263 | 94412800 | 2800 | |
| 29022821 | Petr | D | July 30, 2017, 6:12 p.m. | OK | Java 8 | TESTS | 87 | 1621 | 130457600 | 2800 | |
| 42755026 | vjudge4 | D | Sept. 11, 2018, 6:12 a.m. | OK | MS C++ | TESTS | 87 | 2558 | 37068800 | 2800 |
Back to search problems