2016 Dalian online game Football Games

Source: Internet
Author: User
Tags gcd

Football Games

Time limit:2000/1000 MS (java/others) Memory limit:65536/65536 K (java/others)

Problem Descriptiona Mysterious country would hold a football world championships---Abnormal Cup, attracting football teams And fans from all around the world. This country are so mysterious that none of the information of the Games would be open to the public till the end of all the Matches. And finally only the score of each team would be announced.

At the first phase of the championships, teams is divided intoM groups using the single round robin rule where one and only one game would 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 was tied both score 1 point. The schedule of these games is unknown, only the scores of all team in each group is available.

When those games finished, some insider revealed the There were some false scores in some groups. This have aroused great concern among the pubic, so the the Association of Credits Management (ACM) asks you to judge which Groups ' scores must be false.

Inputmultiple test cases, process till end of the input.

The first line contains a positive integersM, which is the number of groups.
TheI-th of the nextMLines begins with a positive integerBi Representing the number of teams in the i-th Group, followed by Bi nonnegative integers representing the score of EA CH Team in this group.


Number of test Cases <= 10
m<= 100
b[i]<= 20000
Score of each team <= 20000

Outputfor each test case, output M lines. Output ' F ' (without quotes) if the scores in the I-th group must is false, output ' T ' (without quotes) otherwise. See samples for detail.

Sample Input23 0 5 12 1 1

Sample Outputf TAnalysis: Landau ' s theorem; reference Https://en.wikipedia.org/wiki/Tournament_%28graph_theory%29; Code:
#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>#defineRep (I,m,n) for (i=m;i<=n;i++)#defineRSP (It,s) for (Set<int>::iterator It=s.begin (); It!=s.end (); it++)#defineMoD 1000000007#defineINF 0x3f3f3f3f#defineVI vector<int>#definePB Push_back#defineMP Make_pair#defineFi first#defineSe Second#definell Long Long#definePi ACOs (-1.0)#definePII pair<int,int>#defineLson L, Mid, rt<<1#defineRson mid+1, R, rt<<1|1Const intmaxn=2e4+Ten;using namespacestd;ll gcd (ll p,ll q) {returnq==0? P:GCD (q,p%q);} ll Qpow (ll p,ll q) {ll F=1; while(q) {if(q&1) f=f*p;p=p*p;q>>=1;}returnF;}intn,m,k,t,a[maxn];ll sum;intMain () {inti,j;  while(~SCANF ("%d",&t)) { while(t--) {sum=0; scanf ("%d",&N); Rep (I,1, N) scanf ("%d",&A[i]); Sort (a+1, a+n+1); Rep (I,1, N) {Sum+=A[i]; if(sum< (LL) i* (i-1)) Break; }            if(i<=n| | sum!= (LL) n (n1)) puts ("F"); ElsePuts"T"); }    }    //System ("Pause");    return 0;}

2016 Dalian online game Football Games

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.