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. 阅读http://zh.lucida.me/有感

    lucida大神本科毕业于大工,研究生毕业于北航,有这样的学历在社会上混就已经绰绰有余了,但是lucida神并不满足,刻苦努力,拼搏进取,最后进入google london工作,曾经一度在micros ...

  2. android应用开发小技巧

    1,实现应用可以安装到SD卡里面去:在AndroidManifest.xml文件的manifest里面添加下面一行: 1 android:installLocation="preferExt ...

  3. 《剑指Offer》算法题——二维数组查找

    题目:在一个二维数组中,每一行都按照从左到右递增的顺序排序,每一列都按照从上到下递增的顺序排序.请完成一个函数,输入这样的一个二维数组和一个整数,判断数组中是否含有该整数. class Solutio ...

  4. 理解VMware虚拟机下网络连接的三种模式(如何配置虚拟机上网)

    很多朋友都用vmware来测试不同的系统,我结合自己的经验谈一下对网络设置的理解,不对的地方请指正. bridge:这种方式最简单,直接将虚拟网卡桥接到一个物理网卡上面,和linux下一个网卡 绑定两 ...

  5. zen cart global $db 这噶哒

    zen cart $db变量是mysql数据库类的对象,是一个全局变量.在zen cart系统里面的任何一个地方都可以使用这个对象来查询数据库获取数据库的内容.只要需要用到查询数据库,都可以使用这个对 ...

  6. leetcode24,交换链表相邻的节点

    Given a linked list, swap every two adjacent nodes and return its head. For example, Given 1->2-& ...

  7. 第十一节,编辑器软件PyCharm 5.0.3

    编辑器软件PyCharm 5.0.3 设置 主题方案 字体大小 行距 文件模板 文件编码 版本切换

  8. mysql 数据表

    CREATE DATABASE IF NOT EXISTS  `shop`;USE `shop`; drop table if exists lidepeng; create table lidepe ...

  9. css字体设置

    css字体设置 .selector{ font-family:"Microsoft YaHei",微软雅黑,"MicrosoftJhengHei",华文细黑,S ...

  10. MC 在1分钟图拿出5分钟,15分钟,30分钟,1小时的K线

    using System; using System.Drawing; using System.Linq; using System.Collections; namespace PowerLang ...