Codeforces Global Round 17

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
1610 Codeforces Global Round 17 FINISHED False 10800 99501863 Nov. 23, 2021, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 515 ) H Squid Game PROGRAMMING data structures dfs and similar divide and conquer greedy trees

B'After watching the new over-rated series Squid Game, Mashtali and Soroush decided to hold their own Squid Games! Soroush agreed to be the host and will provide money for the winner 's prize, and Mashtali became the Front Man! m players registered to play in the games to win the great prize, but when Mashtali found out how huge the winner 's prize is going to be, he decided to kill eliminate all the players so he could take the money for himself! Here is how evil Mashtali is going to eliminate players: There is an unrooted tree with n vertices. Every player has 2 special vertices x_i and y_i . In one operation, Mashtali can choose any vertex v of the tree. Then, for each remaining player i he finds a vertex w on the simple path from x_i to y_i , which is the closest to v . If w ne x_i and w ne y_i , player i will be eliminated. Now Mashtali wondered: "What is the minimum number of operations I should perform so that I can remove every player from the game and take the money for myself?" Since he was only thinking about the money, he couldn 't solve the problem by himself and asked for your help! The first line contains 2 integer n and m (1 <= n, m <= 3 cdot 10^5) -- the number of vertices of the tree and the number of players. The second line contains n-1 integers par_2, par_3, ldots, par_n (1 <= par_i < i) -- denoting an edge between node i and par_i . The i -th of the following m lines contains two integers x_i and y_i (1 <= x_i, y_i <= n, x_i ne y_i) -- the special vertices of the i -th player. Print the minimum number of operations Mashtali has to perform. If there is no way for Mashtali to eliminate all the players, print -1 . Explanation for the first sample: In the second sample, Mashtali can 't eliminate the first player. '...

Tutorials

Codeforces Global Round 17 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
136677891 Radewoosh H Nov. 23, 2021, 5:27 p.m. OK GNU C++14 TESTS 82 1325 194048000
136700687 djq_cpp H Nov. 24, 2021, 3:23 a.m. OK GNU C++17 TESTS 82 327 29184000
136706753 tyler178 H Nov. 24, 2021, 5:30 a.m. OK GNU C++17 TESTS 82 421 20992000
136699742 Idris_Kamoliddinov H Nov. 24, 2021, 2:59 a.m. OK GNU C++17 TESTS 82 483 54784000
136677526 wish2lucky H Nov. 23, 2021, 5:25 p.m. OK GNU C++17 TESTS 82 483 73523200
136678538 Thunder__Su H Nov. 23, 2021, 5:31 p.m. OK GNU C++17 TESTS 82 545 73932800
136667890 Hartley H Nov. 23, 2021, 4:31 p.m. OK GNU C++17 TESTS 82 577 82739200
136667055 never_giveup H Nov. 23, 2021, 4:27 p.m. OK GNU C++17 (64) TESTS 82 373 55910400
136681110 tourist H Nov. 23, 2021, 5:58 p.m. OK GNU C++17 (64) TESTS 82 436 40038400
136677440 Petr H Nov. 23, 2021, 5:25 p.m. OK GNU C++17 (64) TESTS 82 530 68505600
136701749 Alan233 H Nov. 24, 2021, 3:46 a.m. OK GNU C++20 (64) TESTS 82 452 59187200
136680959 eatmore H Nov. 23, 2021, 5:56 p.m. OK Java 11 TESTS 82 857 75571200

remove filters

Back to search problems