#P812. OI狗仔队(dogs)
OI狗仔队(dogs)
题目描述:
OI江湖中新近崛起了一个神秘的组织:OI商店。传说中这个组织的核心成员个个武功高强,却行踪诡秘,见首不见尾。经过了一番艰苦卓绝的调查,你终于掌握了OI商店核心成员的名单,他们是:dd_engi、zroge、sky_wind、xiaokan、starforever(北极天南星)。而江湖中最有影响力的《OI八卦周刊》又特聘你为OI狗仔队,让你去调查这五人的详细资料,包括:来自哪里(包括Henan、Hunan、Hubei、Chongqing、Shanxi)、使用的兵器(包括C++、Java、Pascal、Ruby、Brainfuck)、擅长的武功(包括Search、DP、Greedy、Graphics、Maths)等信息。虽然没有两个人的哪项信息是相同的,但是你得到的线索只有类似“来自xx的人就是擅长yy的人”(The man from xx is the man who is good at yy),“使用zz的人不是叫做ww的人”(The man who uses zz isn’t the man named ww)这样一些零碎的信息……不过,根据这些信息,你完全可以推断出这五个人的详细资料,而且答案只有一个。
输入(dogs.in):
第一行有一个数字k,表示一下共有k句信息,每句1行。
每句合法的信息都由三部分组成:其中一和三部分表示一个具有某种属性的人,可能的情况有:the man named xx(xx是五个名字中的一个),the man from xx(xx是五个省份中的一个),the man who uses xx(xx是五种兵器中的一个),the man who is good at xx(xx是五种武功中的一个);第二部分只有可能是is或isn’t,表示第一部分和第三部分涉及的人是或不是同一个人;每个句子的句尾有一个句号,除了单词与单词之间没有多余的空格,所有的单词大小写无关。当然,也有可能出现不符合上面格式的句子,比如说Today is Sunday,这时你应该将这句话忽略。输入数据保证有且仅有一个答案。输入数据以一个回车/换行符结尾。
输出(dogs.out):
输出分五行,每行输出一个人的信息,注意顺序按照题目开始时的排序。每行格式如下:
xx is from yy, good at zz, uses ww.
需要注意的是:输出必须全为小写,每个逗号后有一个空格,最后有一个句号和一个回车/换行符。
示例
ThE MAN FroM HenAn is THe MAn nAMed STArforEVER.
The Man wHo IS gooD at gReedY is tHe mAn FROM hEnAn.
tHE man whO uSeS c++ iS thE MaN WHO Is GOoD aT Dp.
The MaN NAmed stARForEvER IS The MAn wHO UseS rUBY.
ThE maN NAMEd sky_WIND is tHe mAn whO UseS jAvA.
THE mAn naMED XIaokAN iS ThE mAn frOm HUNan.
The MaN WHo iS Good aT grEEDy iS The mAn wHo USEs ruBy.
the MaN WHO UsEs BRainFUcK IS the MAn nAmEd ZrOgE.
tHE man WHo is gooD at seArCh is ThE mAn Named xiaoKAN.
THE MAN wHo USEs pascAl is THE maN FroM hUnAN.
the mAN namEd ZRoge is the mAn FroM sHANxI.
the maN fRom HUbeI is the MAn WHO is gOOd at mAtHs.
tHe man who IS GoOd aT sEArCh iS THe man whO USES PascAl.
THE maN NaMeD skY_winD IS THe MaN WHO IS goOD at mAThS.
tHe MaN wHo iS GOod aT gRAPHICs is tHE maN FROM SHanxi.
tHe MaN WHo iS Good AT Dp Is thE mAn from chONGQING.
tHe MaN From hUNAn iS thE man wHO IS GOOd At SEARCh.
ThE mAn NamED DD_EnGi IS THE man frOm choNGQinG.
thE man FRom HuBEi iS thE Man whO USEs JavA.
dd_engi is from chongqing, good at dp, uses c++.
zroge is from shanxi, good at graphics, uses brainfuck.
sky_wind is from hubei, good at maths, uses java.
xiaokan is from hunan, good at search, uses pascal.
starforever is from henan, good at greedy, uses ruby.