题意:给定n个人的关系,若存在三个及以上的人两两友好或两两不友好,则"Bad Team!",否则"Great Team!"。

分析:3000*3000内存10000+,因此存关系要用bool数组,否则mle。

#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cctype>
#include<cmath>
#include<iostream>
#include<sstream>
#include<iterator>
#include<algorithm>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<deque>
#include<queue>
#include<list>
#define Min(a, b) ((a < b) ? a : b)
#define Max(a, b) ((a < b) ? b : a)
const double eps = 1e-12;
inline int dcmp(double a, double b)
{
if(fabs(a - b) < eps) return 0;
return a > b ? 1 : -1;
}
typedef long long LL;
typedef unsigned long long ULL;
const int INT_INF = 0x3f3f3f3f;
const int INT_M_INF = 0x7f7f7f7f;
const LL LL_INF = 0x3f3f3f3f3f3f3f3f;
const LL LL_M_INF = 0x7f7f7f7f7f7f7f7f;
const int dr[] = {0, 0, -1, 1, -1, -1, 1, 1};
const int dc[] = {-1, 1, 0, 0, -1, 1, -1, 1};
const int MOD = 1e9 + 7;
const double pi = acos(-1.0);
const int MAXN = 3000 + 10;
const int MAXT = 3025 + 10;
using namespace std;
bool pic[MAXN][MAXN];
int main(){
int T;
scanf("%d", &T);
while(T--){
memset(pic, 0, sizeof pic);
int n;
scanf("%d", &n);
int x;
for(int i = 1; i <= n; ++i){
for(int j = i + 1; j <= n; ++j){
scanf("%d", &x);
if(x) pic[j][i] = pic[i][j] = true;
else pic[j][i] = pic[i][j] = false;
}
}
bool ok = true;
for(int i = 1; i <= n; ++i){
for(int j = i + 1; j <= n; ++j){
for(int k = j + 1; k <= n; ++k){
if((pic[i][j] && pic[i][k] && pic[j][k]) || (!pic[i][j] && !pic[i][k] && !pic[j][k])){
ok = false;
break;
}
}
if(!ok) break;
}
if(!ok) break;
}
if(ok) printf("Great Team!\n");
else printf("Bad Team!\n");
}
return 0;
}

  

最新文章

  1. tp生成验证码
  2. dispatch_sync may result in dead-lock
  3. hadoop开发环境-----eclipse
  4. ios开发--集成银联3.3.0
  5. Side by Side Assembly介绍--manifest文件的使用
  6. Sending e-mail with Spring MVC---reference
  7. Gym 100187B-A Lot of Joy
  8. Log4j2 简明教程
  9. Java 9 揭秘全目录汇总
  10. php写一个简洁的登录页面
  11. 手推C3算法
  12. JavaScrpt常用的封装方法
  13. mysql 高版本only_full_group_by 错误
  14. C语言setjmp用法解析
  15. 【待完成】[MapReduce_9] MapReduce 的 Shuffle 机制
  16. 基于jQuery+HTML5加入购物车代码
  17. JavaScript学习第一天(一)
  18. JMS学习(三)ActiveMQ Message Persistence
  19. JAVASCRIPT开发HTML5游戏--斗地主(网络对战PART4)
  20. HDU 4497 GCD and LCM(数论+容斥原理)

热门文章

  1. 学习不一样的vue实战(2): 项目分析
  2. 使用oracle 的 PL/Sql 定时执行一个存储过程
  3. 编写跨平台Java程序注意事项
  4. target信息异常
  5. 集合set() 二
  6. python生成器三元表达式
  7. 一个Win32程序的进化------转载
  8. 安装 primecoin 矿池
  9. Firefox中有时使用window.close()脚本无法关闭当前窗口
  10. ActivePerl 安装