题目链接

Problem Description

It is well known that small groups are not conducive of the development of a team. Therefore, there shouldn’t be any small groups in a good team.

In a team with n members,if there are three or more members are not friends with each other or there are three or more members who are friends with each other. The team meeting the above conditions can be called a bad team.Otherwise,the team is a good team.

A company is going to make an assessment of each team in this company. We have known the team with n members and all the friend relationship among these n individuals. Please judge whether it is a good team.

Input

The first line of the input gives the number of test cases T; T test cases follow.(T<=15)

The first line od each case should contain one integers n, representing the number of people of the team.(n≤3000)

Then there are n-1 rows. The ith row should contain n-i numbers, in which number aij represents the relationship between member i and member j+i. 0 means these two individuals are not friends. 1 means these two individuals are friends.

Output

Please output ”Great Team!” if this team is a good team, otherwise please output “Bad Team!”.

Sample Input

1

4

1 1 0

0 0

1

Sample Output

Great Team!

题意:

有n个人组成的一个团队,彼此之间可能存在为朋友或者不为朋友的关系,如果其中的三个或三个以上的人彼此都不是朋友或则彼此都是朋友,则这个团队就是“Bad Team!”,否则的话这个团队就是”Great Team!” 。

给出这n个人彼此之间的关系(“1”代表两个人是朋友,“0”代表两个人不是朋友),判断这个团队是”Great Team!” 还是Bad Team!”。

分析:

我的天,刚开始想着用并查集写,有关系的放到一个集合里,没有关系的放到另外的一个集合里面,然后每次插入一条关系的时候,如果从对应的集合中能找到这两个人,那么肯定就是Bad Team!”

可能那个细节没有处理好,反正是w了。

后来发现完全暴力就可以过,真是不想说啥了。


#include<iostream>
#include<cstdio>
#include<string.h> using namespace std; bool con[3010][3010];
int n;
bool judge( )
{ for(int i=1; i<=n; i++)
{
for(int j=i+1; j<=n; j++)
{
for(int k=j+1; k<=n; k++)
{
///如果三个人之间彼此有相同的关系,就已经可以确定是一个Bad Team!
if(con[i][j]==con[i][k]&&con[j][i]==con[j][k]&&con[k][i]==con[k][j])
return false;
}
}
}
return true;
}
int main()
{
int T, num;
scanf("%d",&T);
while(T--)
{
scanf("%d",&n);
for(int i=1; i<n; i++)
{
for(int j=i+1; j<=n; j++)
{
scanf("%d",&num);
if(num==1)
con[i][j]=con[j][i]=false;///i与j之间有朋友关系
else
con[i][j]=con[j][i]=true;///i与j之间没有朋友关系
}
} if(judge())
printf("Great Team!\n");
else
printf("Bad Team!\n");
}
return 0;
}

2017中国大学生程序设计竞赛 - 网络选拔赛 1003 HDU 6152 Friend-Graph (模拟)的更多相关文章

  1. 2017中国大学生程序设计竞赛 - 网络选拔赛 1004 HDU 6153 A Secret (字符串处理 KMP)

    题目链接 Problem Description Today is the birthday of SF,so VS gives two strings S1,S2 to SF as a presen ...

  2. 2017中国大学生程序设计竞赛 - 网络选拔赛 1005 HDU 6154 CaoHaha's staff (找规律)

    题目链接 Problem Description "You shall not pass!" After shouted out that,the Force Staff appe ...

  3. HDU 6154 - CaoHaha's staff | 2017 中国大学生程序设计竞赛 - 网络选拔赛

    /* HDU 6154 - CaoHaha's staff [ 构造,贪心 ] | 2017 中国大学生程序设计竞赛 - 网络选拔赛 题意: 整点图,每条线只能连每个方格的边或者对角线 问面积大于n的 ...

  4. HDU 6150 - Vertex Cover | 2017 中国大学生程序设计竞赛 - 网络选拔赛

    思路来自 ICPCCamp /* HDU 6150 - Vertex Cover [ 构造 ] | 2017 中国大学生程序设计竞赛 - 网络选拔赛 题意: 给了你一个贪心法找最小覆盖的算法,构造一组 ...

  5. HDU 6156 - Palindrome Function [ 数位DP ] | 2017 中国大学生程序设计竞赛 - 网络选拔赛

    普通的数位DP计算回文串个数 /* HDU 6156 - Palindrome Function [ 数位DP ] | 2017 中国大学生程序设计竞赛 - 网络选拔赛 2-36进制下回文串个数 */ ...

  6. HDU 6154 CaoHaha's staff(2017中国大学生程序设计竞赛 - 网络选拔赛)

    题目代号:HDU 6154 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6154 CaoHaha's staff Time Limit: 2000/1 ...

  7. 2017中国大学生程序设计竞赛 - 网络选拔赛 HDU 6155 Subsequence Count 矩阵快速幂

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6155 题意: 题解来自:http://www.cnblogs.com/iRedBean/p/73982 ...

  8. 2017中国大学生程序设计竞赛 - 网络选拔赛 HDU 6154 CaoHaha's staff(几何找规律)

    Problem Description "You shall not pass!"After shouted out that,the Force Staff appered in ...

  9. 2017中国大学生程序设计竞赛 - 网络选拔赛 HDU 6152 Friend-Graph(暴力搜索)

    题目传送:http://acm.hdu.edu.cn/showproblem.php?pid=6152 Problem Description It is well known that small ...

随机推荐

  1. 3dContactPointAnnotationTool开发日志(二六)

      之前给老师看了看我的毕设,老师觉得操作太复杂了,要能像3ds max里那样可以拖动物体的轴进行平移,沿着显示的圆圈旋转以及缩放啥的.说白了就是在Unity3d的Game视图显示出Scene视图里的 ...

  2. git因commit的记录太大导致push失败解决方法

    发现好像这个方法不好使.......~~!还是会失败 如果有人或者自己失误把不该同步的大文件如数据或日志或其他中间文件给commit了并且push了,然后你删掉了,但是其实他仍然在你的git记录中,你 ...

  3. v-for & duplicate key bug

    v-for & duplicate key bug vue warn & v-for & duplicate key bug <span class="audi ...

  4. utuntu 安装python3.5

    如果想要升级Utuntu系统中的python版本,请不要卸载原先的版本. 桌面环境中的需要依赖于python相关,卸载之后会出现意想不到问题. (1)sudo add-apt-repository p ...

  5. 【.Net】Net开发

    博客里的好多文章都是本人看着比较好,就转过来的,好少自己亲自去写点什么,也很少把自己学的一点心得于大家分享,今天特别想聊一下,关于本人做Net开发时的那段回忆! 一.关于知识的回忆 还记得Handle ...

  6. CODE FESTIVAL 2016 qualA Grid and Integers

    划年代久远的水 题意 有一个R*C的棋盘,要求在每个格子上填一个非负数,使得对任意一个2*2的正方形区域,左上角和右下角的数字之和等于左下角和右上角的数字之和.有一些格子已经被填上了数字,问现在能否满 ...

  7. 基于jwt的token验证

    一.什么是JWT Json web token (JWT), 是为了在网络应用环境间传递声明而执行的一种基于JSON的开放标准((RFC 7519). 该token被设计为紧凑且安全的,特别适用于分布 ...

  8. Day21-Cookie

    1. Cookie,有时也用其复数形式 Cookies,指某些网站为了辨别用户身份.进行 session 跟踪而储存在用户本地终端上的数据(通常经过加密).例如在某个网站上保存了用户名和密码,3个月内 ...

  9. Linux环境安装.NET运行环境

    Linux环境安装.NET运行环境 Linux环境安装.NET运行环境 1. 构建编译环境: (1) sudo apt-get install build-essential (2) sudo apt ...

  10. 【题解】NOIP2017时间复杂度

    对大模拟抱有深深的恐惧……不过这次写好像还好?拿个栈维护一下循环的嵌套,然后重定义一下读入即可.记得去年在考场上面死活调不粗来,代码也奇丑无比……希望今年能好一点吧! #include <bit ...