Ural 1218. Episode N-th:the Jedi Tournament

Source: Internet
Author: User

1218. Episode N-th:the Jedi Tournamenttime limit:1.0 Second
Memory limit:64 mbdecided Several Jedi Knights to organize a tournament once. To know, accumulates who the largest amount of force. Brought each Jedi he lightsaber with him to the tournament. Is 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 u Se. If in at least-parameters one Jedi than the other one stronger is, wins he. Is isn't possible a draw, because no Jedi any equal parameter could 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 are, when the last one remains he on th E Tournament, not looses any match. For example, if Anakin stronger than Luke by some-parameters are, and Luke stronger than Yoda by some , and Yoda stronger than Anakin, exists in the case a schedule for every Jedi to WIn the tournament. Inputin The first line there is a positive integer  N≤200, the total number of Jedi. After that follow NLines, 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 is different integers, not greater than 100000 by the absolute value. All names is sequences of not more than, small and capital letters. Outputyour program was to output the names of those Jedi, which has a possibility to win the tournament. Each name of the possible winner should is 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
5Solo 0 0 0Anakin 30Luke 25Kenobi 3 2Yoda 35 9 125
Anakinlukeyoda
problem Author:Leonid Volkov
problem Source:The seventh Ural state University Collegiate Programming contest Tags:Graph theory()difficulty:338 Test Instructions: Given n individuals, each has three attributes, one person A is better than the other, and only if a has at least two properties that are not less than B, there is no two draw. Ask who may laugh to the last? Note that a better than b,b is better than C, but C may also be better than a, at which point A, B, and C may laugh at the end. Analysis: is said to give n points, let you build a lot of i,j to the edge of the representative I better than J, finally asked how many points can access all points Floyd just fine
1#include <cstdio>2#include <cstring>3#include <cstdlib>4#include <cmath>5#include <deque>6#include <vector>7#include <queue>8#include <iostream>9#include <algorithm>Ten#include <map> One#include <Set> A#include <ctime> - using namespacestd; -typedefLong LongLL; thetypedefDoubleDB; - #defineFor (I, S, T) for (int i = (s); I <= (t); i++) - #defineFord (I, S, T) for (int i = (s); I >= (t); i--) - #defineRep (i, T) for (int i = (0); i < (t); i++) + #defineREPN (i, T) for (int i = (t)-1); I >= (0); i--) - #defineRep (i, X, T) for (int i = (x); i < (t); i++) + #defineMIT (2147483647) A #defineINF (1000000001) at #defineMLL (1000000000000000001LL) - #defineSZ (x) ((int) (x). Size ()) - #defineCLR (x, y) memset (x, y, sizeof (x)) - #definePUF Push_front - #definePub push_back - #definePOF Pop_front in #definePOB pop_back - #defineFT first to #defineSD Second + #defineMk Make_pair -InlinevoidSetio (stringName) { the     stringInput = name+". in", *Output = name+". out"; $Freopen (Input.c_str (),"R", stdin),Panax NotoginsengFreopen (Output.c_str (),"W", stdout); - } the  +InlineintGetint () { A     intRet =0; the     CharCh =' '; +      while(! (Ch >='0'&& Ch <='9')) Ch =GetChar (); -      while(Ch >='0'&& Ch <='9') { $Ret = ret*Ten+ch-'0'; $Ch =GetChar (); -     } -     returnRet; the } - Wuyi Const intN = About; the structJeditype { -     stringName; Wu     intA, B, C; -      AboutInlinevoidRead () { $Cin>>Name; -scanf"%d%d%d", &a, &b, &c); -     } -      AInlineBOOL operator> (ConstJeditype &t)Const { +         return((a >= t.a) + (b >= t.b) + (c >= t.c)) >=2; the     } - } Jedi[n]; $ intN; the BOOLF[n][n]; the  theInlinevoidInput () { thescanf"%d", &n); -for (I,1, N) Jedi[i]. Read (); in } the  theInlinevoidSolve () { Aboutfor (I,1, N) theFor (J,1, N) the             if(Jedi[i] >Jedi[j]) theF[I][J] =1; +      -For (K,1, N) thefor (I,1, N)BayiFor (J,1, N) theF[I][J] |= f[i][k]&F[k][j]; the      -for (I,1, N) { -         BOOLFlag =1; theFor (J,1, N) the             if(!F[i][j]) { theFlag =0; the                  Break; -             } the         if(Flag) Cout<<jedi[i]. name<<Endl; the     } the }94  the intMain () { the #ifndef Online_judge theSetio ("C");98     #endif  About Input (); - Solve ();101     return 0;102}
View Code

Ural 1218. Episode N-th:the Jedi Tournament

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.