UESTC Winter Training #7 "2010-2011 petrozavodsk Winter Training Camp, Saratov State U Contest"

Source: Internet
Author: User

UESTC Winter Training #7

2010-2011 Petrozavodsk Winter Training Camp, Saratov state U Contest

It is said that this set of 3 titles is the Gold level ...

Problem D. Group Stage

Football game, there are now N (2<= n <=100) teams. To select m (1<= m <=n-1) teams, each team matches each other, that is, the match n (n-1)/2, winning 3 points and a draw of 1 points. Finally, from the big to the small list of rankings, if the team is exactly the same score, and must choose a few teams, then the use of the lottery to select the way. Ask:

    1. Team ranking in the last one (with lots of juxtaposition) still may be selected the smallest score
    2. The team is ranked in the first place (or there is a lot of juxtaposition) and may still not be selected for the maximum score.

The code is short, it's a formula, but the formula's been pushed for two hours.

The first question, ranked in the last, is still selected, that is, the score from the big to the small after the first group M to the nth team scored the same, and the score must be minimal. apparently they all lost to the former m-1 teams and then compete with each other for the smallest draw . Think about it, if one person wins the game, it will be divided into 3, which is more than the 1 draw score. Then we can output n-m.

Look at the second question, ranked in the first place, still not necessarily be selected, that is, the score from the big to small after the 1th to the M+1 team scored the same, and scored the most. for each team, to win the first m+2 Support to Nth team, score for (n-m-1) . In the former m+1 team each other game, each team, WINS M/2 field, if M is odd, then draws one, the score is m/2*3+m%2 then the highest score.

Problem E. Map Coloring

This question has not yet been written, it is said to use DP and maximum weight matching.

Problem J. Taxi

There are N boys, M girls (both less than 2011, of whom m<=3n) take a taxi back to their homes, each with a maximum of 4 people, and each taxi must have a boy (the boy can sit completely), they go home in the same direction, and home on the same street. Everyone's name and the distance from home have been given dis<=10000. Ask about the minimum total cost of taxis, and output the number of taxis required and any one of the minimum cost schemes.

Dynamic planning, the first boys and girls according to the distance from the home from the big to the small sort, set dp[i][j] for the first I boy and the first J Girl taxi minimum cost.

dp[i][j]=min{Dp[i-4][j] + 4 boys farthest away, dp[i-3][j-1] + 3 men and 1 women farthest away,

DP[I-2][J-2]+2 Male 2 Female The farthest distance, dp[i-1][j-3]+1 male 3 female's farthest distance}

The last taxi may be in the passenger's car, and a special judgment is required.

Each step of the DP record the precursor, and finally the output can be recursive.

UESTC Winter Training #7 "2010-2011 petrozavodsk Winter Training Camp, Saratov State U Contest"

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.