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. sqlserver mdf ldf文件导入

    EXEC  sp_attach_db  @dbname  =  '你的数据库名', @filename1  =  'mdf文件路径(包缀名)', @filename2  =  'Ldf文件路径(包缀名 ...

  2. uva 10626

    dp 记忆化搜索 3个1元和1个10元的情况不能少 #include <cstdio> #include <cstdlib> #include <cmath> #i ...

  3. struts2+hibernate+spring+jquery返回json List列表

    1.引入包:struts2-json-plugin-2.1.8.1.jar json-lib-2.1.jar commons-collections-3.2.1.jar commons-beanuti ...

  4. gcd 最大公约数 模版!

    1: #define ll long long ll gcd(ll a,ll b) { ) { return b; }else { return gcd(b % a,a); } } 2: int64 ...

  5. 0环境设置 - Statspack设置

    简单说明 Statspack主要用于永久存储performance statistics 信息 只有作为sysdba连接时才能安装Statspack. 然后改目录到#cd $ORACLE_HOME/r ...

  6. 自动装配【Spring autowire】

    public class AutoWiringDao { private String daoName; public void setDaoName(String daoName) { this.d ...

  7. lintcode :Ugly Numbers 丑数

    题目 丑数 设计一个算法,找出只含素因子3,5,7 的第 k 大的数. 符合条件的数如:3,5,7,9,15...... 样例 如果k=4, 返回 9 挑战 要求时间复杂度为O(nlogn)或者O(n ...

  8. 如何发布使用LGPL版Qt的商业软件

    最近做跨平台图形用户界面库选型,权衡很多因素后最终选择了Qt,其中一个重要因素就是Qt使用LGPL授权许可.由于本人对LGPL理解有限,始终对闭源商业软件如何发布Qt库存在疑问,其中最关心的是:发布的 ...

  9. Android:利用SharedPreferences实现自动登录

    主要代码: public class LoginActivity extends Activity { private EditText username; private EditText user ...

  10. Larave 多图片上传

    首先使用Dropzone.js前端组件 {{ HTML::style('css/basic.css');}} {{ HTML::script('js/dropzone.js') }} form部分只需 ...