2016 ACM/ICPC Asia Regional Dalian Online 1006 /HDU 5873

Football Games

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 439    Accepted Submission(s): 157

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

Source

2016 ACM/ICPC Asia Regional Dalian Online

题意:足球比赛,获胜方得2分 失败方不得分 平局各得一分 给你一个小组中m支球队的最终得分  判断得分是否合法

题解:这个题目乱搞过的

m支球队得分为a1,a2.....am

a1=2*a11+1*a12+0*a13

a2=2*a21+1*a22+0*a23

...

...

am=2*am1+1*am2+0*am3

s1=a11+a21+.....am1

s2=a12+a22+.....am2

s3=a13+a23+.....am3

如果s1==s3&&s2%2==0则合法

下面有hack数据 这种方法错误

另外对于camp发出的正解 还是很好理解的

贴:

如果没有平手选项, 赢得加一分的话, 可以用Landau‘s Theorem判定, 这题稍微修改下这个定理就好了. 令s1,s2,...,sns_1,s_2,...,s_ns?1??,s?2??,...,s?n??是他们的得分序列, 从小到大拍个序, 使得s1≤s2≤...≤sns_1 \le s_2 \le ... \le s_ns?1??≤s?2??≤...≤s?n??, 那么这个序列合法, 当且仅当:

  1. s1+s2+...+si≥i(i−1)对于所有1≤i≤n−11 \le i \le n - 11≤i≤n−1
  2. s1+s2+...+sn=n(n−1)

错误代码

hack数据

1

4 0 0 6 6

 1 /******************************
 2 code by drizzle
 3 blog: www.cnblogs.com/hsd-/
 4 ^ ^    ^ ^
 5  O      O
 6 ******************************/
 7 #include<bits/stdc++.h>
 8 #include<iostream>
 9 #include<cstring>
10 #include<cstdio>
11 #include<map>
12 #include<algorithm>
13 #include<queue>
14 #define ll __int64
15 using namespace std;
16 int n;
17 int s1,s2,s3;
18 int exm;
19 int m;
20 int main()
21 {
22     while(scanf("%d",&n)!=EOF)
23     {
24     for(int i=1; i<=n; i++)
25     {
26         scanf("%d",&m);
27         s1=0;
28         s2=0;
29         s3=0;
30         for(int j=1; j<=m; j++)
31         {
32             scanf("%d",&exm);
33             int gg=0;
34             s1=s1+exm/2;
35             gg=gg+exm/2;
36             exm%=2;
37             s2=s2+exm;
38             gg=gg+exm;
39             exm=0;
40             if(gg<(m-1))
41                 s3=s3+m-1-gg;
42         }
43         if((s2%2)==0&&(s1==s3))
44             cout<<"T"<<endl;
45         else
46             cout<<"F"<<endl;
47     }
48     }
49     return 0;
50 }

正解代码

 1 #include<iostream>
 2 #include<cstdio>
 3 #include<cstring>
 4 #include<algorithm>
 5 #include<string>
 6 #include<vector>
 7 #include <ctime>
 8 #include<queue>
 9 #include<set>
10 #include<map>
11 #include<list>
12 #include<stack>
13 #include<iomanip>
14 #include<cmath>
15 #include<bitset>
16 #define mst(ss,b) memset((ss),(b),sizeof(ss))
17 ///#pragma comment(linker, "/STACK:102400000,102400000")
18 typedef long long ll;
19 typedef long double ld;
20 #define INF (1ll<<60)-1
21 #define Max 1e9
22 using namespace std;
23 int T;
24 int a[100100];
25 int main(){
26     while(scanf("%d",&T)!=EOF){
27         int n;
28         for(int cas=1;cas<=T;cas++){
29             scanf("%d",&n);
30             for(int i=1;i<=n;i++) scanf("%d",&a[i]);
31             sort(a+1,a+n+1);
32             ll sum=0;
33             int f=0;
34             for(int i=1;i<=n;i++){
35                 sum+=a[i];
36                 if(sum<1LL*(i-1)*i){
37                     f=1;
38                     break;
39                 }
40             }
41             if(sum!=1LL*(n-1)*n) f=1;
42             if(f) printf("F\n");
43             else printf("T\n");
44         }
45     }
46     return 0;
47 }
时间: 2024-10-04 16:29:27

2016 ACM/ICPC Asia Regional Dalian Online 1006 /HDU 5873的相关文章

2016 ACM/ICPC Asia Regional Dalian Online 1002/HDU 5869

Different GCD Subarray Query Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 681    Accepted Submission(s): 240 Problem Description This is a simple problem. The teacher gives Bob a list of prob

2016 ACM/ICPC Asia Regional Dalian Online 1006 Football Games

题目链接: http://acm.split.hdu.edu.cn/showproblem.php?pid=5873 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 t

hdu 5868 2016 ACM/ICPC Asia Regional Dalian Online 1001 (burnside引理 polya定理)

Different Circle Permutation Time Limit: 3000/1500 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 208    Accepted Submission(s): 101 Problem Description You may not know this but it's a fact that Xinghai Square is

HDU 5873 Football Games 【模拟】 (2016 ACM/ICPC Asia Regional Dalian Online)

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

HDU 5874 Friends and Enemies 【构造】 (2016 ACM/ICPC Asia Regional Dalian Online)

Friends and Enemies Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 291    Accepted Submission(s): 160 Problem Description On an isolated island, lived some dwarves. A king (not a dwarf) ruled t

HDU 5785 Function 【倍增】 (2016 ACM/ICPC Asia Regional Dalian Online)

Function Time Limit: 7000/3500 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 976    Accepted Submission(s): 375 Problem Description The shorter, the simpler. With this problem, you should be convinced of this tru

2016 ACM/ICPC Asia Regional Shenyang Online 1007/HDU 5898 数位dp

odd-even number Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 388    Accepted Submission(s): 212 Problem Description For a number,if the length of continuous odd digits is even and the length

2016 ACM/ICPC Asia Regional Shenyang Online 1003/HDU 5894 数学/组合数/逆元

hannnnah_j’s Biological Test Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 802    Accepted Submission(s): 269 Problem Description hannnnah_j is a teacher in WL High school who teaches biolog

2016 ACM/ICPC Asia Regional Shenyang Online 1009/HDU 5900 区间dp

QSC and Master Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 859    Accepted Submission(s): 325 Problem Description Every school has some legends, Northeastern University is the same. Enter