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 |
---|---|---|---|---|---|---|
1172 | Codeforces Round 564 (Div. 1) | FINISHED | False | 7200 | 177530087 | June 7, 2019, 12:05 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 323 ) | E | Nauuo and ODT | PROGRAMMING | data structures | 3300 |
B"Nauuo is a girl who loves traveling. One day she went to a tree, Old Driver Tree, literally, a tree with an old driver on it. The tree is a connected graph consisting of n nodes and n-1 edges. Each node has a color, and Nauuo will visit the ODT through a simple path on the tree in the old driver's car. Nauuo wants to visit see more different colors in her journey, but she doesn't know which simple path she will be traveling on. So, she wants to calculate the sum of the numbers of different colors on all different paths. Can you help her? What's more, the ODT is being redecorated, so there will be m modifications, each modification will change a single node's color. Nauuo wants to know the answer after each modification too. Note that in this problem, we consider the simple path from u to v and the simple path from v to u as two different simple paths if and only if u ne v . The first line contains two integers n and m ( 2 <= n <= 4 cdot 10^5 , 1 <= m <= 4 cdot 10^5 ) -- the number of nodes and the number of modifications. The second line contains n integers c_1,c_2, ldots,c_n ( 1 <= c_i <= n ), where c_i is the initial color of node i . Each of the next n-1 lines contains two integers u and v ( 1 <= u,v <= n ), denoting there is an edge between u and v . It is guaranteed that the given edges form a tree. Each of the next m lines contains two integers u and x ( 1 <= u,x <= n ), which means a modification that changes the color of node u into x . The output contains m+1 integers -- the first integer is the answer at the beginning, the rest integers are the answers after every modification in the given order. Example 1 The number of colors on each simple path at the beginning: "... |
Codeforces Round #564 Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
68717802 | Even_Bao | E | Jan. 13, 2020, 3:07 p.m. | OK | GNU C++11 | TESTS | 72 | 1964 | 63897600 | 3300 | |
58906313 | wibE | E | Aug. 16, 2019, 11:18 a.m. | OK | GNU C++11 | TESTS | 72 | 2027 | 80691200 | 3300 | |
55285974 | ouuan | E | June 8, 2019, 4:54 a.m. | OK | GNU C++11 | TESTS | 72 | 2277 | 70860800 | 3300 | |
55393582 | Camouflager | E | June 10, 2019, 10:50 a.m. | OK | GNU C++11 | TESTS | 72 | 2339 | 70860800 | 3300 | |
55393489 | Camouflager | E | June 10, 2019, 10:47 a.m. | OK | GNU C++11 | TESTS | 72 | 2339 | 70860800 | 3300 | |
55325284 | ErkkiErkko | E | June 9, 2019, 7:39 a.m. | OK | GNU C++11 | TESTS | 72 | 2339 | 70860800 | 3300 | |
55477865 | maxtir | E | June 12, 2019, 2:15 a.m. | OK | GNU C++11 | TESTS | 72 | 2355 | 73113600 | 3300 | |
56665358 | ivory-si | E | July 7, 2019, 11:03 a.m. | OK | GNU C++11 | TESTS | 72 | 2386 | 78643200 | 3300 | |
58792882 | refrain | E | Aug. 14, 2019, 3:21 a.m. | OK | GNU C++11 | TESTS | 72 | 2417 | 81715200 | 3300 | |
56950797 | tyler178 | E | July 13, 2019, 2:03 a.m. | OK | GNU C++11 | TESTS | 72 | 2418 | 66764800 | 3300 | |
59394428 | DoanPhuDuc | E | Aug. 24, 2019, 9:46 a.m. | OK | GNU C++14 | TESTS | 72 | 2355 | 112435200 | 3300 | |
62629858 | vjudge1 | E | Oct. 15, 2019, 3:06 p.m. | OK | GNU C++14 | TESTS | 72 | 2448 | 80384000 | 3300 | |
56269108 | yan-zp | E | June 29, 2019, 11:21 a.m. | OK | GNU C++14 | TESTS | 72 | 2557 | 89600000 | 3300 | |
66404683 | PengHanyi | E | Dec. 6, 2019, 1:20 p.m. | OK | GNU C++14 | TESTS | 72 | 2604 | 73625600 | 3300 | |
56820846 | yybyyb | E | July 10, 2019, 11:57 p.m. | OK | GNU C++14 | TESTS | 72 | 2698 | 73625600 | 3300 | |
55396871 | Narh | E | June 10, 2019, 12:10 p.m. | OK | GNU C++14 | TESTS | 72 | 2714 | 71065600 | 3300 | |
68635924 | luogu_bot1 | E | Jan. 12, 2020, 5:47 a.m. | OK | GNU C++14 | TESTS | 72 | 2745 | 73625600 | 3300 | |
57196421 | udit19 | E | July 17, 2019, 12:20 p.m. | OK | GNU C++14 | TESTS | 72 | 2761 | 71065600 | 3300 | |
58352245 | krijgertje | E | Aug. 5, 2019, 5:42 p.m. | OK | GNU C++14 | TESTS | 72 | 2776 | 80691200 | 3300 | |
55317241 | nhho | E | June 8, 2019, 11:54 p.m. | OK | GNU C++14 | TESTS | 72 | 2776 | 99430400 | 3300 | |
56509605 | Nakagawa.Kanon | E | July 4, 2019, 9:41 a.m. | OK | GNU C++17 | TESTS | 72 | 2339 | 92467200 | 3300 | |
56762669 | Nakagawa.Kanon | E | July 9, 2019, 4:38 p.m. | OK | GNU C++17 | TESTS | 72 | 2448 | 92467200 | 3300 | |
58659362 | tyk07tianxingjian | E | Aug. 12, 2019, 10:20 a.m. | OK | GNU C++17 | TESTS | 72 | 2495 | 71065600 | 3300 | |
55279738 | Benq | E | June 7, 2019, 11:01 p.m. | OK | GNU C++17 | TESTS | 72 | 2667 | 93184000 | 3300 | |
55335676 | GuessYCB | E | June 9, 2019, 1:36 p.m. | OK | GNU C++17 | TESTS | 72 | 2886 | 78643200 | 3300 | |
66017682 | Marckess | E | Nov. 30, 2019, 6:09 a.m. | OK | GNU C++17 | TESTS | 72 | 3166 | 109875200 | 3300 | |
59140863 | TianPingXing | E | Aug. 20, 2019, 2:22 p.m. | OK | GNU C++17 | TESTS | 72 | 3353 | 73318400 | 3300 | |
58808466 | SUDAL | E | Aug. 14, 2019, 9:49 a.m. | OK | GNU C++17 | TESTS | 72 | 3509 | 90419200 | 3300 | |
58798819 | SUDAL | E | Aug. 14, 2019, 6:50 a.m. | OK | GNU C++17 | TESTS | 72 | 3821 | 90521600 | 3300 | |
69830971 | gongsuidashen | E | Jan. 30, 2020, 10:27 a.m. | OK | GNU C++17 | TESTS | 72 | 3931 | 95846400 | 3300 |
Back to search problems