1218. Episode N-th: The Jedi Tournament

Time limit: 1.0 second
Memory limit: 64 MB
Decided several Jedi Knights to organize a tournament once. To know, accumulates who the largest amount of Force. Brought each Jedi his lightsaber with him to the tournament. Are different the lightsaber, and Jedi different are. Three parameters there are: length of the saber, Force of the Jedi and how good the Light side of the Force the Jedi can use. If in at least two parameters one Jedi than the other one stronger is, wins he. Is not possible a draw, because no Jedi any equal parameter may have. If looses a Jedi, must leave the tournament he.
To determine, which Jedi the tournament can win, your program is. Can win the tournament a Jedi, if at least one schedule for the tournament possible is, when the last one remains he on the tournament, not looses any match. For example, if Anakin stronger than Luke by some two parameters is, and Luke stronger than Yoda by some two parameters is, and Yoda stronger than Anakin, exists in this case a schedule for every Jedi to win the tournament.

Input

In the first line there is a positive integer N ≤ 200, the total number of Jedi. After that followN lines, each line containing the name of the Jedi and three parameters (length of the lightsaber, Force, Light side in this order) separated with a space. The parameters are different integers, not greater than 100000 by the absolute value. All names are sequences of not more than 30 small and capital letters.

Output

Your program is to output the names of those Jedi, which have a possibility to win the tournament. Each name of the possible winner should be written in a separate line. The order of the names in the output should correspond to the order of their appearance in the input data.

Sample

input output
5
Solo 0 0 0
Anakin 20 18 30
Luke 40 12 25
Kenobi 15 3 2
Yoda 35 9 125
Anakin
Luke
Yoda
Problem Author: Leonid Volkov
Problem Source: The Seventh Ural State University collegiate programming contest
Difficulty: 338
 
题意:给出n个人,每个人有三个属性,一个人A比另一个人B优当且仅当A有至少两种属性不小于B的这两种属性,不存在两个人平局。问谁可能笑到最后?
注意,A优于B,B优于C,但C也可能优于A,此时A、B、C都可能笑到最后。
分析:就是说给出n个点,让你建出很多有向边I,j代表i优于j,最后问有多少点能访问全部点
floyd就好
 #include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <ctime>
using namespace std;
typedef long long LL;
typedef double DB;
#define For(i, s, t) for(int i = (s); i <= (t); i++)
#define Ford(i, s, t) for(int i = (s); i >= (t); i--)
#define Rep(i, t) for(int i = (0); i < (t); i++)
#define Repn(i, t) for(int i = ((t)-1); i >= (0); i--)
#define rep(i, x, t) for(int i = (x); i < (t); i++)
#define MIT (2147483647)
#define INF (1000000001)
#define MLL (1000000000000000001LL)
#define sz(x) ((int) (x).size())
#define clr(x, y) memset(x, y, sizeof(x))
#define puf push_front
#define pub push_back
#define pof pop_front
#define pob pop_back
#define ft first
#define sd second
#define mk make_pair
inline void SetIO(string Name) {
string Input = Name+".in",
Output = Name+".out";
freopen(Input.c_str(), "r", stdin),
freopen(Output.c_str(), "w", stdout);
} inline int Getint() {
int Ret = ;
char Ch = ' ';
while(!(Ch >= '' && Ch <= '')) Ch = getchar();
while(Ch >= '' && Ch <= '') {
Ret = Ret*+Ch-'';
Ch = getchar();
}
return Ret;
} const int N = ;
struct JediType {
string Name;
int a, b, c; inline void Read() {
cin>>Name;
scanf("%d%d%d", &a, &b, &c);
} inline bool operator >(const JediType &T) const {
return ((a >= T.a)+(b >= T.b)+(c >= T.c)) >= ;
}
} Jedi[N];
int n;
bool F[N][N]; inline void Input() {
scanf("%d", &n);
For(i, , n) Jedi[i].Read();
} inline void Solve() {
For(i, , n)
For(j, , n)
if(Jedi[i] > Jedi[j])
F[i][j] = ; For(k, , n)
For(i, , n)
For(j, , n)
F[i][j] |= F[i][k]&F[k][j]; For(i, , n) {
bool Flag = ;
For(j, , n)
if(!F[i][j]) {
Flag = ;
break;
}
if(Flag) cout<<Jedi[i].Name<<endl;
}
} int main() {
#ifndef ONLINE_JUDGE
SetIO("C");
#endif
Input();
Solve();
return ;
}

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

  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. 1218. Episode N-th: The Jedi Tournament(bfs)

    1218 简答题 对于当前点 判断每个点是否可达 #include <iostream> #include<cstdio> #include<cstring> #i ...

  3. URAL 2027 URCAPL, Episode 1 (模拟)

    题意:给你一个HxW的矩阵,每个点是一个指令,根据指令进行一系列操作. 题解:模拟 #include<cstdio> #include<algorithm> using nam ...

  4. Educational Codeforces Round 13 E. Another Sith Tournament 概率dp+状压

    题目链接: 题目 E. Another Sith Tournament time limit per test2.5 seconds memory limit per test256 megabyte ...

  5. Ural 1079 - Maximum

    Consider the sequence of numbers ai, i = 0, 1, 2, …, which satisfies the following requirements: a0  ...

  6. Educational Codeforces Round 13 E. Another Sith Tournament 状压dp

    E. Another Sith Tournament 题目连接: http://www.codeforces.com/contest/678/problem/E Description The rul ...

  7. URAL 1873. GOV Chronicles

    唔 神题一道 大家感受一下 1873. GOV Chronicles Time limit: 0.5 secondMemory limit: 64 MB A chilly autumn night. ...

  8. Ural State University Internal Contest October'2000 Junior Session

    POJ 上的一套水题,哈哈~~~,最后一题很恶心,不想写了~~~ Rope Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 7 ...

  9. Codeforces CF#628 Education 8 A. Tennis Tournament

    A. Tennis Tournament time limit per test 1 second memory limit per test 256 megabytes input standard ...

随机推荐

  1. [置顶] Android应用开发之版本更新你莫愁

    传送门 ☞ 轮子的专栏 ☞ 转载请注明 ☞ http://blog.csdn.net/leverage_1229 今天我们学习如何实现Android应用的自动更新版本功能,这是在各种语言编写的应用中都 ...

  2. rubycas-client单点登录

    (文章是从我的个人主页上粘贴过来的,大家也可以访问我的主页 www.iwangzheng.com) 进行中,未完待续 Ruby 客户端 使用方法0. 在 Gemfile中,加入: gem 'rubyc ...

  3. [Android界面] 如何 去掉dialog的黑色背景和边框 DEMO

    android系统的默认对话框是黑色背景,白色边框的样式,对于android系统来说是相当漂亮的,可是与自己的项目风格不搭,所以只好想办法重写他的样式了,当然dialog是支持样式重写的 使用new ...

  4. ubuntu安装到选择位置时闪退

    转自:http://tieba.baidu.com/p/3020839207

  5. (int),Int32.Parse() 和 Convert.toInt32() 的区别

    在 C# 中,(int),Int32.Parse() 和 Convert.toInt32() 三种方法有何区别? int 关键字表示一种整型,是32位的,它的 .NET Framework 类型为 S ...

  6. linux ldconfig

    http://blog.csdn.net/dante_k7/article/details/7211868 ldconfig的主要用途: 默认搜寻/lilb和/usr/lib,以及配置文件/etc/l ...

  7. css样式自适应,支持数字

    td加上style="word-break: break-all;word-wrap: break-word;"样式即可

  8. CodeForces - 404A(模拟题)

    Valera and X Time Limit: 1000MS   Memory Limit: 262144KB   64bit IO Format: %I64d & %I64u Submit ...

  9. ubuntu 图形界面查看隐藏文件

    在 Linux 下以 . 开头的文件或文件夹为隐藏文件,在图形界面(nautilus)下可用 CTRL + H 显示隐藏文件,终端下者可以用 ls -a 显示所有文件.

  10. nodeJS文件路径总结

    文件夹目录F:* test1* tes2* test3* test4* a.html*//例句fs.readFile('../../../a.html', function (err, html) { ...