SSL-OI Summer Camp 2020.08.21 Group A
I spent a lot of money on keyboards and keycaps these two days, because I drank too much? The F60 actually removed the Bluetooth module, although I don't use it much normally. The pink F60 paired with pure white keycaps still looks okay. Today I tried to get partial scores, it wasn't very smooth, but it was still a decent attempt. A Decisive Battle A small easy problem, but I still didn't think of the correct solution and went for partial scores. Problem Statement Given a graph with vertices and edges, ask: which vertex to delete so that the remaining graph becomes a tree. It is guaranteed that at least one vertex can be the answer. Story I chose a partial score for and a partial score for , and in the end
I spent a lot of money on keyboards and keycaps these two days, because I drank too much? The F60 actually removed the Bluetooth module (although I don't use it much normally), the pink F60 paired with pure white keycaps still looks okay. Today I tried to get partial scores, it wasn't very smooth, but it was still a decent attempt.
A Decisive Battle
A small easy problem, but I still didn't think of the correct solution and went for partial scores.
Problem Statement
Given a graph with vertices and edges, ask: which vertex to delete so that the remaining graph becomes a tree. It is guaranteed that at least one vertex can be the answer.
Story
I chose a partial score for and a partial score for , and in the end only the tree case was solved, 20pts.
Solution
First, the deleted vertex must not be a cut vertex, which can be found using tarjan. For a non-cut vertex , if deleting this vertex leaves a tree, then we must have . represents the degree of this vertex.
However, I don't know strongly connected components, so I can't judge the graph either
B The End
C Interpretation
Obviously this is a greedy problem, but I got the greedy wrong. As expected, people who don't usually do greedy problems won't do them in exams either.
Problem Statement
Given an array of length , merge two numbers in the form . There are queries, each query asks for the maximum value after merging in the interval .
, the answer is modulo .
Story
Obviously, since we need the maximum and also modulo, it can only be greedy. In the exam, I wrote an interval DP for the first subtask , and tried to write an brute force (but it was wrong).
Correct Solution
By intuitively understanding the solution, we can find that if for a given subsegment we have ,
It is easy to see that this problem is about multiplying each value by a coefficient and then summing. If it is a continuous segment (from back to front) merged, the exponent of the coefficients in the segment is increasing. For example:
To merge two consecutive segments, let the sums of the two segments be and respectively, after merging we have . (as in the problem)
Consider the case (Sub5). Obviously, the coefficient of is , and the coefficients of other numbers are at least . (They will be merged with at least once) If the added value is less than , we want its exponent to be as small as possible, so we set the exponent to . If the added value is greater than , it will definitely make a positive contribution, so we set its coefficient exponent to the coefficient exponent of the previous one . (Merge into the previous block) For example:
Comments
0No comments yet.