Football Games

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)

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 into M
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.
 
Input
Multiple test cases, process till end of the input.
  
  For each case, the first line contains a positive integers M, which is the number of groups.
  The i-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

 
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
2
3 0 5 1
2 1 1
 
Sample Output
F T
分析:Landau's Theorem;
   参照https://en.wikipedia.org/wiki/Tournament_%28graph_theory%29;
代码:
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <climits>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <vector>
#include <list>
#define rep(i,m,n) for(i=m;i<=n;i++)
#define rsp(it,s) for(set<int>::iterator it=s.begin();it!=s.end();it++)
#define mod 1000000007
#define inf 0x3f3f3f3f
#define vi vector<int>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ll long long
#define pi acos(-1.0)
#define pii pair<int,int>
#define Lson L, mid, rt<<1
#define Rson mid+1, R, rt<<1|1
const int maxn=2e4+;
using namespace std;
ll gcd(ll p,ll q){return q==?p:gcd(q,p%q);}
ll qpow(ll p,ll q){ll f=;while(q){if(q&)f=f*p;p=p*p;q>>=;}return f;}
int n,m,k,t,a[maxn];
ll sum;
int main()
{
int i,j;
while(~scanf("%d",&t))
{
while(t--)
{
sum=;
scanf("%d",&n);
rep(i,,n)scanf("%d",&a[i]);
sort(a+,a+n+);
rep(i,,n)
{
sum+=a[i];
if(sum<(ll)i*(i-))break;
}
if(i<=n||sum!=(ll)n*(n-))puts("F");
else puts("T");
}
}
//system("Pause");
return ;
}

2016大连网络赛 Football Games的更多相关文章

  1. 2016大连网络赛 Different GCD Subarray Query

    Different GCD Subarray Query Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 65536/65536 K ( ...

  2. 2016大连网络赛 Function

    Function Time Limit: 7000/3500 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others) Probl ...

  3. 2016大连网络赛 Sparse Graph

    Sparse Graph Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others) P ...

  4. 2016大连网络赛 Weak Pair

    Weak Pair Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others) Prob ...

  5. HDU 5877 2016大连网络赛 Weak Pair(树状数组,线段树,动态开点,启发式合并,可持久化线段树)

    Weak Pair Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others) Tota ...

  6. HDU 5869 Different GCD Subarray Query(2016大连网络赛 B 树状数组+技巧)

    还是想不到,真的觉得难,思路太巧妙 题意:给你一串数和一些区间,对于每个区间求出区间内每段连续值的不同gcd个数(该区间任一点可做起点,此点及之后的点都可做终点) 首先我们可以知道每次添加一个值时gc ...

  7. 大连网络赛 1006 Football Games

    //大连网络赛 1006 // 吐槽:数据比较水.下面代码可以AC // 但是正解好像是:排序后,前i项的和大于等于i*(i-1) #include <bits/stdc++.h> usi ...

  8. HDU 5880 Family View (2016 青岛网络赛 C题,AC自动机)

    题目链接  2016 青岛网络赛  Problem C 题意  给出一些敏感词,和一篇文章.现在要屏蔽这篇文章中所有出现过的敏感词,屏蔽掉的用$'*'$表示. 建立$AC$自动机,查询的时候沿着$fa ...

  9. 16年大连网络赛 1006 Football Games

    题目链接:http://acm.hdu.edu.cn/contests/contest_showproblem.php?cid=725&pid=1006 Football Games Time ...

随机推荐

  1. 【转】解决Windows不能在本地计算机启动apache tomcat

    http://blog.163.com/ftskwsg@126/blog/static/5623853020094494117827/ 这个方法解决了我的问题. 在windows下以服务的方式启动时提 ...

  2. MFC通过ODBC连接Mysql程序

    分享到 一键分享 QQ空间 新浪微博 百度云收藏 人人网 腾讯微博 百度相册 开心网 腾讯朋友 百度贴吧 豆瓣网 搜狐微博 百度新首页 QQ好友 和讯微博 更多... 百度分享 MFC通过ODBC连接 ...

  3. svn rollback: 恢复到上一版本

    18:48:32svn的文件版本是168,我想用167的版本覆盖掉168的版本如何搞? 18:52:47先把本地的那个文件用rm命令删掉,然后,使用svn up -r 167 文件路径,UP下来的文件 ...

  4. 【转】虚拟机下安装小红帽Linux9.0图解

    http://blog.163.com/ly676830315@126/blog/static/10173372220119148583539/

  5. MySQL 的实时性能监控利器【转】

    操作系统及MySQL数据库的实时性能状态数据尤为重要,特别是在有性能抖动的时候,这些实时的性能数据可以快速帮助你定位系统或MySQL数据库的性能瓶颈,就像你在Linux系统上使用「top,sar,io ...

  6. 【重大bug】viewpager使用的时候加载数据应该在setOnPageChangeListener里加载

    [重大bug]viewpager使用的时候加载数据应该在setOnPageChangeListener里的onPageSelected里加载,我说怎么首页有数据,第二页就是空白,就是加载了但是数据不显 ...

  7. Android onTouchEvent方法

    onTouchEvent方法简介 前面已经介绍了手机键盘事件的处理方法,接下来将介绍手机屏幕事件的处理方法onTouchEvent.该方法在View类中的定义,并且所有的View子类全部重写了该方法, ...

  8. PHP文件相关函数试题

    一.问答题 1.返回路径中的文件名部分的函数是什么? 2.改变文件模式的函数是什么? 3.拷贝文件的函数是什么? 4.返回路径中的目录部分的函数是什么? 5.将上传的文件移动到指定位置的函数是? 6. ...

  9. vs当前不会命中断点,还没有为该文档加载任何符号

    今天发布网站之后,附加进程却怎么页不能命中断点,后来发现原来,我将发布的web.config文件覆盖掉了新生成的配置文件,其中一项:<compilation debug="false& ...

  10. centos7配置ip

    vi /etc/sysconfig/network-scripts/ifcfg-enp0s3 ONBOOT=yes 重启ip服务 systemctl restart network.service 开 ...