SWERC 2022-2023 - Online Mirror (Unrated, ICPC Rules, Teams Preferred)

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
1776 SWERC 2022-2023 - Online Mirror (Unrated, ICPC Rules, Teams Preferred) FINISHED False 18000 99600923 Feb. 19, 2023, 11:05 a.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 508 ) M Parmigiana With Seafood PROGRAMMING trees

The "Parmigiana di melanzane" is a typical Italian dish. Alessandro and Bianca have very different tastes when it comes to it: Alessandro loves to eat Parmigiana with seafood, but Bianca thinks it is an atrocity! To decide which ingredients to include in the dish they prepare, they play the following game. There are (n) possible ingredients, labeled from (1) to (n). The higher the label, the closer the ingredient is to being seafood. The ingredients are connected by (n - 1) edges, in such a way as to form a tree. Alessandro and Bianca take turns, with Alessandro going first. They alternately choose a terminal ingredient (x), that is an ingredient currently connected to at most one other ingredient, and remove it from the tree. If the terminal ingredient (x) was chosen by Alessandro, it goes in the recipe; if it was chosen by Bianca, it is discarded. The taste of the Parmigiana is measured as the maximum label of an ingredient in the recipe. Alessandro wants to maximize the taste, while Bianca wants to minimize the taste. If both play optimally, what is the taste of the Parmigiana? The first line contains an integer (n) ((2\le n \le 100\,000)) — the number of ingredients. Each of the following (n-1) lines contain two integers (u_i) and (v_i) ((1 \le u_i, v_i \le n), (u_i \ne v_i)) — the ingredients that the (i)-th edge connects. It is guaranteed that the edges form a tree (i.e., any pair of ingredients is connected by the edges, possibly indirectly). Print the value of the taste if both Alessandro and Bianca play optimally. In the first sample , Alessandro can choose terminal ingredient (4) in the first turn. This ingredient is added to the recipe. Since (4) is the maximum label of an ingredient, the taste is (4) regardless of the choices that follow. In the second sample , Bianca can make sure that neither ingredient (4) nor (5) are included in the recipe, in which case Alessandro

Tutorials

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
194308399 ybw051114 M Feb. 20, 2023, 4:41 a.m. OK GNU C++14 TESTS 26 108 9318400
194240170 hank55663 M Feb. 19, 2023, 2:15 p.m. OK GNU C++14 TESTS 26 187 8089600

remove filters

Back to search problems