HDU 5873 Football Games 【模拟】 (2016 ACM/ICPC Asia Regional Dalian Online)
来源:互联网 发布:淘宝购物的步骤 编辑:程序博客网 时间:2024/06/05 15:09
Football Games
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 802 Accepted Submission(s): 309
Problem Description
A mysterious country will hold a football world championships---Abnormal Cup, attracting football teams and fans from all around the world. This country is so mysterious that none of the information of the games will be open to the public till the end of all the matches. And finally only the score of each team will be announced.
At the first phase of the championships, teams are divided intoM groups using the single round robin rule where one and only one game will be played between each pair of teams within each group. The winner of a game scores 2 points, the loser scores 0, when the game is tied both score 1 point. The schedule of these games are unknown, only the scores of each team in each group are available.
When those games finished, some insider revealed that there were some false scores in some groups. This has aroused great concern among the pubic, so the the Association of Credit Management (ACM) asks you to judge which groups' scores must be false.
At the first phase of the championships, teams are divided into
When those games finished, some insider revealed that there were some false scores in some groups. This has aroused great concern among the pubic, so the the Association of Credit Management (ACM) asks you to judge which groups' scores must be false.
Input
Multiple test cases, process till end of the input.
For each case, the first line contains a positive integersM , which is the number of groups.
Thei -th of the next M lines begins with a positive integer Bi representing the number of teams in the i -th group, followed by Bi nonnegative integers representing the score of each team in this group.
number of test cases <= 10
M<= 100
B[i]<= 20000
score of each team <= 20000
For each case, the first line contains a positive integers
The
number of test cases <= 10
M<= 100
B[i]<= 20000
score of each team <= 20000
Output
For each test case, output M lines. Output ``F" (without quotes) if the scores in the i-th group must be false, output ``T" (without quotes) otherwise. See samples for detail.
Sample Input
23 0 5 12 1 1
Sample Output
FT
Source
2016 ACM/ICPC Asia Regional Dalian Online
Recommend
wange2014 | We have carefully selected several similar problems for you: 5877 5875 5872 5871 5870
题目链接:
http://acm.hdu.edu.cn/showproblem.php?pid=5873
题目大意:
多组数据(<=10),每组数据有M(M<=100)个小组,每个小组有N(N<=20000)支球队,每个小组内有一轮单循环赛(一个队与其他所有队只比一次),赢得2分,平各得1分,输得0分。
现在给N个球队的最终得分,问是否合法。
题目思路:
【模拟】
因为一场比赛会使得得分之和+2,所以sum!=n*(n-1)的必然不合法。
接着考虑假设没有平局,得分最高的队最多得2*(N-1)分,第二高2*(N-2),将球队分数从小到打排序,从后往前做,记S为剩余可分配的分数。
S+=a[i]-2*(i-1)表示当前得分扣除最高得分还多余或缺少多少分(如果之前有平局会剩余分数加到后面由负变平的队伍),当S<0时说明前面剩余可分配的分数不够了,就不合法。
其他情况都是合法的。
////by coolxxx//#include<bits/stdc++.h>#include<iostream>#include<algorithm>#include<string>#include<iomanip>#include<map>#include<stack>#include<queue>#include<set>#include<bitset>#include<memory.h>#include<time.h>#include<stdio.h>#include<stdlib.h>#include<string.h>//#include<stdbool.h>#include<math.h>#define min(a,b) ((a)<(b)?(a):(b))#define max(a,b) ((a)>(b)?(a):(b))#define abs(a) ((a)>0?(a):(-(a)))#define lowbit(a) (a&(-a))#define sqr(a) ((a)*(a))#define swap(a,b) ((a)^=(b),(b)^=(a),(a)^=(b))#define mem(a,b) memset(a,b,sizeof(a))#define eps (1e-10)#define J 10000#define mod 1000000007#define MAX 0x7f7f7f7f#define PI 3.14159265358979323#pragma comment(linker,"/STACK:1024000000,1024000000")#define N 20004using namespace std;typedef long long LL;double anss;LL aans;int cas,cass;int n,m,lll,ans;int a[N];LL sum;bool cmp(int aa,int bb){return aa<bb;}bool judge(){int i;LL s=0;if(sum!=1LL*n*(n-1))return 1;sort(a,a+n,cmp);for(i=n-1;i>=0;i--){s+=i*2-a[i];if(s<0)return 1;}return 0;}int main(){#ifndef ONLINE_JUDGE//freopen("1.txt","r",stdin);//freopen("2.txt","w",stdout);#endifint i,j,k;int x,y,z;//init();//for(scanf("%d",&cass);cass;cass--)//for(scanf("%d",&cas),cass=1;cass<=cas;cass++)//while(~scanf("%s",s))//while(~scanf("%d",&n))while(~scanf("%d",&cas)){while(cas--){sum=cass=0;scanf("%d",&n);for(i=0;i<n;i++){scanf("%d",&a[i]);sum+=a[i];}if(judge())puts("F");else puts("T");}}return 0;}/*////*/
0 0
- HDU 5873 Football Games 【模拟】 (2016 ACM/ICPC Asia Regional Dalian Online)
- HDU 5873 2016 ACM/ICPC Asia Regional Dalian Online 1006 Football Games
- HDU 5873 Football Games(签到题)——2016 ACM/ICPC Asia Regional Dalian Online
- 2016 ACM/ICPC Asia Regional Dalian Online Football Games
- 2016 ACM/ICPC Asia Regional Dalian Online 1006 football game 1007 hdu 5873 hdu 5874
- hdu 5875 2016 ACM/ICPC Asia Regional Dalian Online 1008
- HDU 5875 Function 2016 ACM/ICPC Asia Regional Dalian Online
- HDU 5875 Function 2016 ACM/ICPC Asia Regional Dalian Online
- hdu 5875 2016 ACM/ICPC Asia Regional Dalian Online 1008
- 2016 ACM/ICPC Asia Regional Dalian Online
- 2016 ACM/ICPC Asia Regional Dalian Online
- Hdu 5873 2016 ACM/ICPC Asia Regional Dalian Online 1006(兰道定理)
- 2016 ACM/ICPC Dalian Online-1006 Football Games
- 2016 ACM/ICPC Asia Regional Dalian Online Sparse Graph(BFS)
- 2016 ACM/ICPC Asia Regional Dalian Online Friends and Enemies
- 2016 ACM/ICPC Asia Regional Dalian Online 1008 Function
- 2016 ACM/ICPC Asia Regional Dalian Online(2题)
- 2016 ACM/ICPC Asia Regional Dalian Online 1007
- 设计模式之观察者模式
- 操作系统μC/OS-Ⅱ读书笔记(2)
- 利用torque搭建分布式程序运行环境
- Timus Online Judge:2010. Sasha the Young Grandmaster
- 楼新闻
- HDU 5873 Football Games 【模拟】 (2016 ACM/ICPC Asia Regional Dalian Online)
- HDU1171-Big Event in HDU
- LibGdx文档译读(五)Graphics接口
- hdu 5877 Weak Pair(dfs+树状数组)
- Hibernate的HQL中in参数设置
- Android Studio常用快捷键
- 生成短信验证码的方法
- 【计算机视觉】<前景检测>非参数背景模型介绍<二>
- 《java多线程编程核心技术》读书笔记3:线程间的通信