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. Xbox360自制系统GOD包安装教程

    1.准备工作 U盘或移动硬盘一个,已下载好的GOD包,本教程用一个32G的U盘和游戏<猎天使魔女>为例. 右击U盘,属性,查看你的U盘是否为FAT32格式. 如果是FAT32格式,则可直接 ...

  2. Soj题目分类

    -----------------------------最优化问题------------------------------------- ----------------------常规动态规划 ...

  3. 开源日志系统比较:scribe、chukwa、kafka、flume

    1. 背景介绍 许多公司的平台每天会产生大量的日志(一般为流式数据,如,搜索引擎的pv,查询等),处理这些日志需要特定的日志系统,一般而言,这些系统需要具有以下特征: (1) 构建应用系统和分析系统的 ...

  4. 让你瞬间萌比的35个python小技巧

    今天在看python算法的时候,看到一篇关于python的小技巧.瞬间萌比了,原来python也可以这样玩,太神奇了.萌比的是原来这么简单的东西自己都不知道,虽然会写.废话不多说了,开始上菜. 1.拆 ...

  5. first os

    Make your first OS. (MikeOS). check out here

  6. Github建站全攻略

    本系列为原创,发表在我的github主页,详细介绍了如何在github上建立个人网站,还包括域名绑定.评论功能.站内搜索等辅助功能的介绍,欢迎交流.   一步步在GitHub上创建博客主页(6) 本篇 ...

  7. 安卓四大组件的作用、安卓Service的作用

    Activity好像是应用程式的眼睛,提供与user互动之窗. BroadcastReceiver好像是耳朵,接收来自各方的Intent. Service是在后台运行的. 一个Service 是一段长 ...

  8. 线段树+dp+贪心 Codeforces Round #353 (Div. 2) E

    http://codeforces.com/contest/675/problem/E 题目大意:有n个车站,每个车站只能买一张票,这张票能从i+1到a[i].定义p[i][j]为从i到j所需要买的最 ...

  9. php 特定类型测试函数

    is_array() 检查变量是否是数组 is_double().is_float().is_real() 检查变量是否是浮点数 is_long().is_int().is_integer()检查变量 ...

  10. SQL SERVER中强制类型转换cast和convert的区别

    在SQL SERVER中,cast和convert函数都可用于类型转换,其功能是相同的, 只是语法不同. cast一般更容易使用,convert的优点是可以格式化日期和数值. 代码 select CO ...