1218

简答题

对于当前点 判断每个点是否可达

 #include <iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<string>
using namespace std;
vector<int>ed[];
int w[][],vis[];
struct node
{
char s[];
int a,b,c;
}p[];
int judge(int x,int y)
{
int a1 = p[x].a,a2 = p[x].b,a3 = p[x].c;
int a4 = p[y].a,a5 = p[y].b,a6 = p[y].c;
int o=;
if(a1>a4)
o++;
if(a2>a5)
o++;
if(a3>a6)
o++;
if(o>=)
return ;
return ;
}
int spfa(int e,int s)
{
int i;
memset(vis,,sizeof(vis));
queue<int>q;
q.push(s);
vis[s] = ;
while(!q.empty())
{
int u = q.front();
w[u][s] = ;
q.pop();
for(i = ;i < (int)ed[u].size() ; i++)
{
int v = ed[u][i];
if(!vis[v])
{
vis[v] = ;
q.push(v);
}
}
}
if(w[e][s])
return ;
return ;
}
int main()
{
int i,j,n;
scanf("%d",&n);
for(i = ; i <= n ; i++)
{
cin>>p[i].s>>p[i].a>>p[i].b>>p[i].c;
}
for(i = ; i <= n ;i++)
{
for(j = ; j <= n ; j++)
{
if(i==j)
continue;
if(judge(i,j))
{
w[i][j] = ;
ed[j].push_back(i);
}
}
}
for(i = ; i <= n ;i++)
{
int flag = ;
for(j = ; j <= n ;j++)
{
if(i==j)
continue;
if(!w[i][j]&&!spfa(i,j))
{
flag = ;
break;
}
}
if(flag)
printf("%s\n",p[i].s);
}
return ;
}

1218. Episode N-th: The Jedi Tournament(bfs)的更多相关文章

  1. URAL 1218 Episode N-th: The Jedi Tournament(强连通分量)(缩点)

    Episode N-th: The Jedi Tournament Time limit: 1.0 secondMemory limit: 64 MB Decided several Jedi Kni ...

  2. D - Knight Tournament(set)

    Problem description Hooray! Berl II, the king of Berland is making a knight tournament. The king has ...

  3. 山东省第七届省赛 D题:Swiss-system tournament(归并排序)

    Description A Swiss-system tournament is a tournament which uses a non-elimination format. The first ...

  4. 【ZOJ4063】Tournament(构造)

    题意:n个人要打m轮比赛 每一轮每个人都要有一个对手.而且每个对手只能打一次.假设a与b打了,c与d打了, 那么后面的任意一轮如果a与c打了,那么b就必须和d打 问是否存在方案,输出字典序最小的一组, ...

  5. 1008. Image Encoding(bfs)

    1008 没营养的破题 #include <iostream> #include<cstdio> #include<cstring> #include<alg ...

  6. ural 1218. Episode N-th: The Jedi Tournament

    1218. Episode N-th: The Jedi Tournament Time limit: 1.0 secondMemory limit: 64 MB Decided several Je ...

  7. js进阶 12-18 jquery如何实现自定义右键菜单(把问题分细)

    js进阶 12-18  jquery如何实现自定义右键菜单(把问题分细) 一.总结 一句话总结:用鼠标右键事件contextmenu,阻止系统默认事件,让做好的右键菜单显示出来,并且显示在我们出现的位 ...

  8. 从零开始的Python学习Episode 20——面向对象(3)

    面向对象之封装 封装,即隐藏对象的属性和实现细节,仅对外公开接口,控制在程序中属性的读和修改的访问级别:将抽象得到的数据和行为(或功能)相结合,形成一个有机的整体. 隐藏 在python中用双下划线开 ...

  9. Episode 1:正视微信(试播)

    本期是 WEB VIEW 的第一期播客节目. 「不囿于 WEB,不止于 VIEW」,WEB VIEW 是由 yin 和敬礼主持的一档泛科技播客.节目中我们谨慎考量技术进步所带来的优缺点,提倡用「人治」 ...

随机推荐

  1. Scrum10-22

    Time:2013-10-22 Author:居玉皓 Things we have done since yesterday's meeting: 在今天的Scrum中,STORY1 开发前期准备工作 ...

  2. .net datatable 添加一列

    dt.Columns.Add("image", Type.GetType("System.String")); foreach (DataRow dr in d ...

  3. About the Storage allocation

    It doesn't matter what programming language u use,it's all about the usage of variable---storage man ...

  4. Codeforces Round #343 (Div. 2) E. Famil Door and Roads

    题目链接: http://www.codeforces.com/contest/629/problem/E 题解: 树形dp. siz[x]为x这颗子树的节点个数(包括x自己) dep[x]表示x这个 ...

  5. 修改tomcat 启动45秒

    当我们需要增加Tomcat的启动时间,修改方法如下:

  6. Roy Li的学习和成长自传

    我不知道自己是什么时候从哪里来到这个世界上的,也许是石头里蹦出来的,也许是女娲捏出来的,上帝造出来的.上溯到我记忆的最前端,抱着我的好象 是一个女人,穿着白衣服,白得象石灰一样的那种.以至于后来我被告 ...

  7. 【面试题002】java实现的单例模式,c++实现单例模式,实现禁止拷贝

    [面试题002]java实现的单例模式,c++实现单例模式,实现禁止拷贝  一 c++实现单例模式 保证一个类,在一个程序当中只有一个对象,只有一个实例,这个对象要禁止拷贝,注意这里要区别于java. ...

  8. IOS:利用dispatch_once创建单例

    在之前有一篇学习笔记中,记载了一篇如何在OC中实现单例的文章:<IOS学习笔记4—Objective C—创建单例>自苹果引入了Grand Central Dispatch (GCD)(M ...

  9. hdu1068 Girls and Boys

    题目:http://acm.hdu.edu.cn/showproblem.php?pid=1068 二分图的最大独立集数=节点数(n)— 最大匹配数(m) 另外需要注意的是: 本题求出的最大匹配数是实 ...

  10. nohup 程序名 & (使程序推到后台运行,即使终端关闭,该程序依然运行)

    IshallbeThatIshallbe:~ iamthat$ ps -ef |grep ping 502 450 1 0 9:30PM ?? 0:00.05 ping www.baidu.com 5 ...