Codeforces Global Round 4

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
1178 Codeforces Global Round 4 FINISHED False 9000 173802287 July 20, 2019, 3:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 522 ) G The Awesomest Vertex PROGRAMMING data structures dfs and similar 2900

B'You are given a rooted tree on n vertices. The vertices are numbered from 1 to n ; the root is the vertex number 1 . Each vertex has two integers associated with it: a_i and b_i . We denote the set of all ancestors of v (including v itself) by R(v) . The awesomeness of a vertex v is defined as <= ft| sum_{w in R(v)} a_w right| cdot <= ft| sum_{w in R(v)} b_w right|, where |x| denotes the absolute value of x . Process q queries of one of the following forms: The first line contains two integers n and q ( 1 <= q n <= q 2 cdot 10^5, 1 <= q q <= q 10^5 ) -- the number of vertices in the tree and the number of queries, respectively. The second line contains n - 1 integers p_2, p_3, ... , p_n ( 1 <= q p_i < i ), where p_i means that there is an edge between vertices i and p_i . The third line contains n integers a_1, a_2, ... , a_n ( -5000 <= q a_i <= q 5000 ), the initial values of a_i for each vertex. The fourth line contains n integers b_1, b_2, ... , b_n ( -5000 <= q b_i <= q 5000 ), the values of b_i for each vertex. Each of the next q lines describes a query. It has one of the following forms: For each query of the second type, print a single line with the maximum awesomeness in the respective subtree. The initial awesomeness of the vertices is [100, 91, 57, 64, 57] . The most awesome vertex in the subtree of vertex 1 (the first query) is 1 , and the most awesome vertex in the subtree of vertex 2 (the second query) is 2 . After the first update (the third query), the awesomeness changes to [100, 169, 57, 160, 57] and thus the most awesome vertex in the whole tree (the fourth query) is now 2 . After the second update (the fifth query), the awesomeness becomes [100, 234, 57, 240, 152] , hence the most awesome vertex (the '...

Tutorials

E

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
57455648 eriksuenderhauf G July 21, 2019, 11:30 a.m. OK GNU C++11 TESTS 67 358 88166400 2900
59779891 foreverlasting G Aug. 31, 2019, 2:29 a.m. OK GNU C++11 TESTS 68 499 54579200 2900
59779799 foreverlasting G Aug. 31, 2019, 2:25 a.m. OK GNU C++11 TESTS 68 514 54579200 2900
62344051 Pigbrain G Oct. 11, 2019, 6:40 a.m. OK GNU C++11 TESTS 68 1544 51404800 2900
57434653 cuizhuyefei G July 21, 2019, 3:58 a.m. OK GNU C++11 TESTS 66 1731 33484800 2900
57434979 cuizhuyefei G July 21, 2019, 4:11 a.m. OK GNU C++11 TESTS 66 1950 33484800 2900
64371391 LJC00118 G Nov. 6, 2019, 2:26 p.m. OK GNU C++11 TESTS 68 2308 26624000 2900
64371219 LJC00118 G Nov. 6, 2019, 2:23 p.m. OK GNU C++11 TESTS 68 2386 26931200 2900
57731285 .ckodser. G July 25, 2019, 8:39 a.m. OK GNU C++11 TESTS 68 2417 55603200 2900
59777980 luogu_bot2 G Aug. 31, 2019, 1:06 a.m. OK GNU C++11 TESTS 68 2620 182681600 2900
57476946 nhho G July 21, 2019, 10:40 p.m. OK GNU C++14 TESTS 68 405 77926400 2900
57494477 atoiz G July 22, 2019, 8:07 a.m. OK GNU C++14 TESTS 68 858 77107200 2900
57492840 atoiz G July 22, 2019, 7:39 a.m. OK GNU C++14 TESTS 68 858 77107200 2900
57493484 atoiz G July 22, 2019, 7:50 a.m. OK GNU C++14 TESTS 68 904 77107200 2900
63928225 Toxel G Oct. 31, 2019, 1:36 p.m. OK GNU C++14 TESTS 68 1668 37273600 2900
63928015 Toxel G Oct. 31, 2019, 1:33 p.m. OK GNU C++14 TESTS 68 1793 34304000 2900
57538207 NDKhoa G July 22, 2019, 3:51 p.m. OK GNU C++14 TESTS 68 1840 57036800 2900
57553608 NDKhoa G July 22, 2019, 6:33 p.m. OK GNU C++14 TESTS 68 1856 57036800 2900
57552524 NDKhoa G July 22, 2019, 6:06 p.m. OK GNU C++14 TESTS 68 1856 57036800 2900
57538868 NDKhoa G July 22, 2019, 3:54 p.m. OK GNU C++14 TESTS 68 1856 57036800 2900
57814730 neal G July 26, 2019, 7:05 p.m. OK GNU C++17 TESTS 68 202 43827200 2900
57810096 neal G July 26, 2019, 4:53 p.m. OK GNU C++17 TESTS 68 202 43827200 2900
57810367 neal G July 26, 2019, 5:01 p.m. OK GNU C++17 TESTS 68 202 46182400 2900
60825513 nickluo G Sept. 19, 2019, 3:41 a.m. OK GNU C++17 TESTS 68 280 46387200 2900
57809854 neal G July 26, 2019, 4:47 p.m. OK GNU C++17 TESTS 68 343 43724800 2900
57809826 neal G July 26, 2019, 4:46 p.m. OK GNU C++17 TESTS 68 405 69632000 2900
57805535 Kmcode G July 26, 2019, 3:01 p.m. OK GNU C++17 TESTS 68 436 74956800 2900
57814699 neal G July 26, 2019, 7:04 p.m. OK GNU C++17 TESTS 68 451 69632000 2900
57423387 dragonslayerintraining G July 20, 2019, 7:16 p.m. OK GNU C++17 TESTS 63 529 74752000 2900
57423131 dragonslayerintraining G July 20, 2019, 7:11 p.m. OK GNU C++17 TESTS 63 529 139673600 2900
57428278 uwi G July 20, 2019, 10:08 p.m. OK Java 8 TESTS 64 3416 25600000 2900
57428243 uwi G July 20, 2019, 10:07 p.m. OK Java 8 TESTS 64 3883 25804800 2900

remove filters

Back to search problems