Topcoder SRM646 DIV2 1000
題目大意:給你兩個vector,一個代表隊伍的得分,一個代表得分為這個得分的隊伍的個數,假設每支隊伍還有兩次比賽沒有進行,比賽的規則是贏一場得3分,輸一場得0分,沒有平的情況。已知這個隊伍的目前得分讓你求出來所有的球隊打完最後一場,這個球隊理論上的最好排名,注意可以和除了自己以外的任何一支隊伍進行比賽,次數任意。
解題思路:顯然排名高的話,這個球隊這兩次比賽一定得贏,所以主要分為3種情況:1,即使得分+6也不會超過的,這些球隊即使全輸也會在他們前面,所以我們讓他們全贏,2,低於m的,這些球隊即使贏了也就<= m+6,所以也沒有影響,就讓它們也贏,3,位於m+3< x <= m+6這些人贏一場就會超過m+6,先讓大於m+6與<=m的去贏他們,然後剩下的之間相互贏每個人都只贏兩場,就是對半分。再剩下的一定就會排在當前人的前面。
Problem Statement |
|||||||||||||
John and Brus are the managers of your football team. The team is taking part in a tournament. The tournament is almost over: each team still has exactly two matches to play (possibly both against the same opponent). Note that two different teams play in
each match. There are no ties in this tournament. Each match is played until one of the two teams wins. The winner of a match gets 3 points, the loser gets 0 points. You are given an int yourScore: the number of points your team has scored so far. You are also given two vector <int>s scores and numberOfTeams that describe the other teams. For each valid i, there are numberOfTeams[i] other teams that each have scored scores[i] points so far. Note that the total number of teams in the tournament is 1 + sum(numberOfTeams). At the end of the tournament, teams will be ranked by the total number of points. Teams with the same number of points will be ranked according to their total score. Given the above information, you are interested in the best possible (1-based) final rank of your team. Note that you do not know which matches are still to be played, so you assume the best possible combination of matches that is consistent with the given information. In other words, you want to find the smallest X such that there exists a valid set of future match results that causes your team to end in X-th place. Note that your team's score can be arbitrarily good, so you may always assume that your team is placed above all other teams that have the same score as you. Compute and return the X defined above. |
|||||||||||||
Definition |
|||||||||||||
|
|||||||||||||
Limits |
|||||||||||||
|
|||||||||||||
Notes |
|||||||||||||
- | The current scores given in yourScore and scores do not necessarily correspond to a valid game history. In particular, they do not have to be divisible by 3. | ||||||||||||
Constraints |
|||||||||||||
- | yourScore will be between 0 and 100,000, inclusive. | ||||||||||||
- | scores will contain between 1 and 47 elements, inclusive. | ||||||||||||
- | scores and numberOfTeams will contain the same number of elements. | ||||||||||||
- | Each element of scores will be between 0 and 100,000, inclusive. | ||||||||||||
- | Each element of numberOfTeams will be between 1 and 100,000, inclusive. | ||||||||||||
Examples |
|||||||||||||
0) | |||||||||||||
|
|||||||||||||
1) | |||||||||||||
|
|||||||||||||
2) | |||||||||||||
|
|||||||||||||
3) | |||||||||||||
|
#include <algorithm>
#include <iostream>
#include <stdlib.h>
#include <string.h>
#include <iomanip>
#include <stdio.h>
#include <string>
#include <queue>
#include <cmath>
#include <stack>
#include <map>
#include <set>
#define eps 1e-10
///#define M 1000100
///#define LL __int64
#define LL long long
#define INF 0x7fffffff
#define PI 3.1415926535898
#define zero(x) ((fabs(x)<eps)?0:x)
using namespace std;
const int maxn = 2010;
int mp[maxn][maxn];
class TheFootballDivTwo
{
public:
int find(int yourScore, vector <int> scores, vector <int> numberOfTeams)
{
int n = scores.size();
int Min = 0;
int Max = 0;
int m = yourScore;
int xp = 0;
for(int i = 0; i < n; i++)
{
int x = scores[i];
int y = numberOfTeams[i];
if(x > m+6)
{
Min += y;
xp += y;
}
if(x <= m) Min += y;
if(m+4 <= x && x <= m+6) Max += y;
}
Max -= Min;
Max -= 1;
if(Max <= 0) return xp+1;
Max += 1;
Max /= 2;
return xp+Max+1;
}
};
int main()
{
return 0;
}
相關文章
- topcoder SRM 592 DIV2 LittleElephantAndBooks
- topcoder SRM 593 DIV2 RaiseThisBarnAI
- topcoder 594 DIV2 foxandclassroomOOM
- topcoder SRM 593 DIV2 WolfDelaymasterAST
- topcoder SRM 591 DIV2 TheArithmeticProgression
- topcoder SRM 628 DIV2 BishopMove
- topcoder SRM 628 DIV2 BracketExpressionsRacketExpress
- topcoder SRM 610 DIV2 TheMatrix
- Topcoder SRM 626 DIV2 SumOfPower
- topcoder SRM 624 DIV2 CostOfDancing
- topcoder SRM 625 DIV2 AddMultiply
- topcoder SRM 625 DIV2 IncrementingSequenceREMGse
- topcoder SRM 623 DIV2 CatAndRat
- topcoder SRM 594 DIV2 AstronomicalRecordsEasyAST
- topcoder SRM 610 DIV2 DivideByZeroIDE
- topcoder SRM 624 DIV2 BuildingHeightsEasyUI
- topcoder SRM 618 DIV2 WritingWords
- topcoder SRM 623 DIV2 CatchTheBeatEasy
- topcoder SRM 592 DIV2 LittleElephantAndPermutationDiv2
- Topcoder SRM 626 DIV2 FixedDiceGameDiv2GAM
- topcoder SRM 617 DIV2 SlimeXSlimonadeTycoon
- topcoder SRM 618 DIV2 LongWordsDiv2
- topcoder SRM 619 DIV2 GoodCompanyDivTwoGo
- TopCoder SRM 588 DIV2 KeyDungeonDiv2
- Topcoder SRM 583 DIV2 SwappingDigitsAPPGit
- topcoder SRM 618 DIV2 MovingRooksDiv2
- topcoder SRM 622 DIV2 BoxesDiv2
- topcoder SRM 622 DIV2 FibonacciDiv2
- Codeforces #245(div2)
- BZOJ2454 : TopCoder SRM 463 RabbitPuzzle
- codeforces #197(div2)
- codeforces #198(div2)
- Topcoder SRM 638 DIV 2 (大力出奇跡)
- TopCoder SRM 639 Div.2 500 AliceGameEasyGAM
- Codeforces Round #470 div2 C
- Codeforces Round #FF(255) DIV2
- 958-round Div2比賽
- Codeforces #213 div2前三題