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 |
---|---|---|---|---|---|---|
1425 | 2020 ICPC, COMPFEST 12, Indonesia Multi-Provincial Contest (Unrated, Online Mirror, ICPC Rules, Teams Preferred) | FINISHED | False | 18000 | 130640399 | Sept. 27, 2020, 5 a.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 239 ) | I | Impressive Harvesting of The Orchard | PROGRAMMING | data structures | 2800 |
B'Mr. Chanek has an orchard structured as a rooted ternary tree with N vertices numbered from 1 to N . The root of the tree is vertex 1 . P_i denotes the parent of vertex i , for (2 <= i <= N) . Interestingly, the height of the tree is not greater than 10 . Height of a tree is defined to be the largest distance from the root to a vertex in the tree. There exist a bush on each vertex of the tree. Initially, all bushes have fruits. Fruits will not grow on bushes that currently already have fruits. The bush at vertex i will grow fruits after A_i days since its last harvest. Mr. Chanek will visit his orchard for Q days. In day i , he will harvest all bushes that have fruits on the subtree of vertex X_i . For each day, determine the sum of distances from every harvested bush to X_i , and the number of harvested bush that day. Harvesting a bush means collecting all fruits on the bush. For example, if Mr. Chanek harvests all fruits on subtree of vertex X , and harvested bushes [Y_1, Y_2, ... , Y_M] , the sum of distances is sum_{i = 1}^M text{distance}(X, Y_i) text{distance}(U, V) in a tree is defined to be the number of edges on the simple path from U to V . The first line contains two integers N and Q (1 <= N, Q, <= 5 cdot 10^4) , which denotes the number of vertices and the number of days Mr. Chanek visits the orchard. The second line contains N integers A_i (1 <= A_i <= 5 cdot 10^4) , which denotes the fruits growth speed on the bush at vertex i , for (1 <= i <= N) . The third line contains N-1 integers P_i (1 <= P_i <= N, P_i ne i) , which denotes the parent of vertex i in the tree, for (2 <= i <= N) . It is guaranteed that each vertex can be the parent of at most 3 other vertices. It is also guaranteed that the height of the tree is not greater than 10$$'... |
Tutorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
93958878 | 2016wudi | I | Sept. 27, 2020, 1:08 p.m. | OK | GNU C++11 | TESTS | 37 | 1263 | 2867200 | 2800 | |
93959400 | xblakioi | I | Sept. 27, 2020, 1:14 p.m. | OK | GNU C++11 | TESTS | 37 | 3837 | 2560000 | 2800 | |
93951632 | xblakioi | I | Sept. 27, 2020, 11:35 a.m. | OK | GNU C++11 | TESTS | 37 | 4056 | 30412800 | 2800 | |
93942342 | Kylin_ LiuYu_penguin xblakioi | I | Sept. 27, 2020, 9:30 a.m. | OK | GNU C++11 | TESTS | 37 | 4180 | 30412800 | 2800 | |
93955087 | lys013 | I | Sept. 27, 2020, 12:21 p.m. | OK | GNU C++11 | TESTS | 37 | 5053 | 6451200 | 2800 | |
93953755 | XiaoTaoTao | I | Sept. 27, 2020, 12:04 p.m. | OK | GNU C++11 | TESTS | 37 | 5054 | 7168000 | 2800 | |
93953190 | XiaoTaoTao | I | Sept. 27, 2020, 11:56 a.m. | OK | GNU C++11 | TESTS | 37 | 5131 | 7168000 | 2800 | |
93952971 | XiaoTaoTao | I | Sept. 27, 2020, 11:53 a.m. | OK | GNU C++11 | TESTS | 37 | 5148 | 7168000 | 2800 | |
93953753 | lys013 | I | Sept. 27, 2020, 12:04 p.m. | OK | GNU C++11 | TESTS | 37 | 5335 | 6451200 | 2800 | |
93953962 | lys013 | I | Sept. 27, 2020, 12:07 p.m. | OK | GNU C++11 | TESTS | 37 | 5350 | 6451200 | 2800 | |
93959549 | willingox | I | Sept. 27, 2020, 1:16 p.m. | OK | GNU C++14 | TESTS | 37 | 920 | 2560000 | 2800 | |
93951106 | noneTP | I | Sept. 27, 2020, 11:28 a.m. | OK | GNU C++14 | TESTS | 37 | 4492 | 4096000 | 2800 | |
94045267 | gongsuidashen | I | Sept. 28, 2020, 3:48 a.m. | OK | GNU C++17 | TESTS | 37 | 685 | 2867200 | 2800 | |
93953642 | MagicSpark | I | Sept. 27, 2020, 12:03 p.m. | OK | GNU C++17 | TESTS | 37 | 701 | 2867200 | 2800 | |
93941716 | wiwitrifai | I | Sept. 27, 2020, 9:23 a.m. | OK | GNU C++17 | TESTS | 37 | 701 | 2867200 | 2800 | |
93953565 | MagicSpark | I | Sept. 27, 2020, 12:02 p.m. | OK | GNU C++17 | TESTS | 37 | 717 | 2867200 | 2800 | |
93941953 | theodor.moroianu freak93 retrograd | I | Sept. 27, 2020, 9:26 a.m. | OK | GNU C++17 | TESTS | 37 | 841 | 2355200 | 2800 | |
94036953 | tdpencil | I | Sept. 27, 2020, 11:08 p.m. | OK | GNU C++17 | TESTS | 37 | 951 | 2969600 | 2800 | |
93926752 | ravik1 Sixpathsguy darklight13 | I | Sept. 27, 2020, 6:25 a.m. | OK | GNU C++17 | TESTS | 37 | 1934 | 4915200 | 2800 | |
93961395 | goudiman Chinchila felipe.fcw | I | Sept. 27, 2020, 1:38 p.m. | OK | GNU C++17 | TESTS | 37 | 2261 | 22220800 | 2800 | |
93950085 | MAOoo | I | Sept. 27, 2020, 11:14 a.m. | OK | GNU C++17 | TESTS | 37 | 3478 | 2662400 | 2800 | |
93942044 | theodor.moroianu freak93 retrograd | I | Sept. 27, 2020, 9:27 a.m. | OK | GNU C++17 | TESTS | 37 | 4086 | 2355200 | 2800 | |
93967282 | kutcoder | I | Sept. 27, 2020, 2:32 p.m. | OK | GNU C++17 (64) | TESTS | 37 | 670 | 3379200 | 2800 | |
94040397 | q234rty | I | Sept. 28, 2020, 1:34 a.m. | OK | GNU C++17 (64) | TESTS | 37 | 685 | 46592000 | 2800 | |
93967073 | q234rty | I | Sept. 27, 2020, 2:29 p.m. | OK | GNU C++17 (64) | TESTS | 37 | 686 | 48230400 | 2800 | |
93967342 | q234rty | I | Sept. 27, 2020, 2:33 p.m. | OK | GNU C++17 (64) | TESTS | 37 | 701 | 46694400 | 2800 | |
94040824 | q234rty | I | Sept. 28, 2020, 1:48 a.m. | OK | GNU C++17 (64) | TESTS | 37 | 702 | 46694400 | 2800 | |
94040777 | q234rty | I | Sept. 28, 2020, 1:47 a.m. | OK | GNU C++17 (64) | TESTS | 37 | 702 | 46694400 | 2800 | |
94040440 | q234rty | I | Sept. 28, 2020, 1:36 a.m. | OK | GNU C++17 (64) | TESTS | 37 | 702 | 46694400 | 2800 | |
93967253 | q234rty | I | Sept. 27, 2020, 2:32 p.m. | OK | GNU C++17 (64) | TESTS | 37 | 702 | 48230400 | 2800 | |
93966221 | q234rty | I | Sept. 27, 2020, 2:19 p.m. | OK | GNU C++17 (64) | TESTS | 37 | 717 | 48230400 | 2800 | |
93956742 | applese | I | Sept. 27, 2020, 12:41 p.m. | OK | GNU C++17 (64) | TESTS | 37 | 732 | 3379200 | 2800 |
Back to search problems