Codeforces Round #387 (Div 2)

Source: Internet
Author: User

A

=w=

B

VOV

C

QoQ

D

Test instructions: Beleriand winter is very cold, then the driver to change the winter special tires to drive. Suppose there is a total of n days in winter, a set of winter special tires, only can use K days, the tires no matter what temperature can be used, and the summer tires can only be used in the days of non-negative temperature, ask to safely open n days of the car need to change the minimum number of tires (put on and take off the count)

Analysis: Greed

Greedy idea is very good, according to the length of the successive summer to sort, small first to fill

But pay attention to two paragraphs.

If the first part of the summer is filled, the result is not optimal, so the beginning is assumed to be placed at the end of the interval array

As for the last summer, it is very awkward, that is, the other interval if filled, the contribution to the result is-2, and the last interval contribution is-1, which involves the value and cost problems, so there are two possibilities, one is to put the final interval in the front interval sort, One is to place the last interval in the penultimate (the first is the first interval), to compare the minimum output of the two cases

In a wonderful posture a this problem, looking forward to a more orthodox greedy

E

Test instructions: gives you a way to construct a tree that allows you to output the tree in depth

Analysis: Simulation

It's just a simulation, similar to manipulating infix expressions.

Codeforces Round #387 (Div 2)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.