NC220830. “秃顶之奕”
描述
最近剪刀公司的一款名为“秃”顶之奕的自走棋游戏火爆,在“秃顶之奕”中,每局比赛由八名玩家共同进行一对一决斗,直到场上只剩下最后一名玩家。而英雄则是玩家所招募,合成,部署以及投入战斗的单位,一旦作战开始变回自主交战。上场相同的特质英雄可以触发特质增强战力,每个英雄都具有种族职业,这是所有的51个英雄所拥有的种族职业:
英雄名称 | 中文对照 | 种族职业 |
---|---|---|
Caitlyn | 凯特琳(1费) | Chrono+Sniper |
FioraLaurent | 菲奥娜(1费) | Cybernetic+Blademaster |
Graves | 格雷夫斯(1费) | SpacePriate+Blaster |
Jarvan | 嘉文四世(1费) | DarkStar+Protector |
KhaZix | 卡兹克(1费) | Void+Infiltrator |
Leona | 雷欧娜(1费) | Cybernetic+Vanguard |
Malphite | 墨菲特(1费) | Rebel+Brawler |
Poppy | 波比(1费) | StarGuardian+Vanguard |
TwistedFate | 崔斯特(1费) | Chrono+Sorcerer |
Xayah | 霞(1费) | Celestial+Blademaster |
Ziggs | 吉格斯(1费) | Rebel+Demolitionist |
Zoe | 佐伊(1费) | StarGuardian+Sorcerer |
Ahri | 阿狸(2费) | StarGuardian+Sorcerer |
Annie | 安妮(2费) | MechPilot+Sorcerer |
Blitzcrank | 布里茨(2费) | Chrono+Brawler |
Darius | 德莱厄斯(2费) | SpacePriate+ManaReaver |
KaiSa | 卡莎(2费) | Valkyrie+Infiltrator |
Lucian | 卢锡安(2费) | Cybernetic+Blaster |
Mordekaiser | 莫德凯撒(2费) | DarkStar+Vanguard |
Rakan | 洛(2费) | Celestial+Protector |
Shen | 慎(2费) | Chrono+Blademaster |
Sona | 娑娜(2费) | Rebel+Mystic |
XinZhao | 赵信(2费) | Celestial+Protector |
Yasuo | 亚索(2费) | Rebel+Blademaster |
Ashe | 艾希(3费) | Celestial+Sniper |
Ezreal | 伊泽瑞尔(3费) | Chrono+Blaster |
Jayce | 杰斯(3费) | SpacePriate+Vanguard |
Karma | 卡尔玛(3费) | DarkStar+Mystic |
Kassadin | 卡萨丁(3费) | Celestial+ManaReaver |
Lux | 拉克丝(3费) | DarkStar+Sorcerer |
MasterYi | 易(3费) | Rebel+Blademaster |
Neeko | 妮蔻(3费) | StarGuardian+Protector |
Rumble | 兰博(3费) | MechPilot+Demolitionist |
Shaco | 萨科(3费) | DarkStar+Infiltrator |
Syndra | 辛德拉(3费) | StarGuardian+Sorcerer |
Vi | 蔚(3费) | Cybernetic+Brawler |
Fizz | 菲兹(4费) | MechPilot+Infiltrator |
GhoGath | 科加斯(4费) | Void+Brawler |
Irelia | 艾瑞利亚(4费) | Cybernetic+ManaReaver+Blademaster |
Jhin | 烬(4费) | DarkStar+Sniper |
Jinx | 金克斯(4费) | Rebel+Blaster |
Kayle | 凯尔(4费) | Valkyrie+Blademaster |
Soraka | 索拉卡(4费) | StarGuardian+Mystic |
VelKoz | 维克兹(4费) | Void+Sorcerer |
Wukong | 孙悟空(4费) | Chrono+Vanguard |
AurelionSol | 奥瑞利安索尔(5费) | Rebel+Starship |
Ekko | 艾克(5费) | Cybernetic+Infiltrator |
Gangplank | 普朗克(5费) | SpacePriate+Mercenary+Demolitionist |
Lulu | 璐璐(5费) | Celestial+Mystic |
MissFortune | 厄运小姐(5费) | Valkyrie+Mercenary+Blaster |
Thresh | 锤石(5费) | Chrono+ManaReaver |
Xerath | 泽拉斯(5费) | DarkStar+Sorcerer |
以下则是23个种族职业的羁绊描述:
种族职业名称 | 中文对照 | 羁绊所需数量及等阶 |
---|---|---|
Blademaster | 剑士 | 3(铜),6(金),9(彩) |
Blaster | 强袭枪手 | 2(铜),4(金) |
Brawler | 斗士 | 2(铜),4(金) |
Celestial | 星神 | 2(铜),4(银),6(金) |
Chrono | 未来战士 | 2(铜),4(银),6(金) |
Cybernetic | 源计划 | 3(铜),6(金) |
DarkStar | 暗星 | 3(铜),6(金),9(彩) |
Demolitionist | 爆破专家 | 2(金) |
Infiltrator | 刺客 | 2(铜),4(金),6(彩) |
ManaReaver | 破法战士 | 2(金) |
MechPilot | 银河魔装机神 | 3(金) |
Mercenary | 雇佣兵 | 1(金) |
Mystic | 秘术 | 2(铜),4(金) |
Protector | 圣盾使 | 2(铜),4(金),6(彩) |
Rebel | 奥德赛 | 3(铜),6(金) |
Sniper | 狙神 | 2(金) |
Sorcerer | 法师 | 2(铜),4(银),6(金),8(彩) |
SpacePriate | 太空海盗 | 2(铜),4(金) |
StarGuardian | 星之守护者 | 3(银),6(金) |
Starship | 星舰 | 1(金) |
Valkyrie | 女武神 | 2(金) |
Vanguard | 重装战士 | 2(铜),4(金) |
Void | 虚空 | 3(金) |
而英雄的羁绊激活又遵循以下几点:
每个英雄具有2-3个种族职业。例如凯特琳具有“未来战士”和“狙神”2个种族职业,艾瑞利亚具有“源计划”、“破法战士”、“剑士”3个种族职业。
相同英雄的种族职业只记录一次。例如亚索具有“奥德赛”和“剑士”2个种族职业,但是如果场上具有三个亚索,并不能激活3“奥德赛”这个羁绊,也不能激活3“剑士”这个羁绊。
被激活的羁绊的想要达到相应的等阶,必须大于或等于所需的种族职业数量。例如格雷夫斯、德莱厄斯、杰斯这三位英雄都具有“太空海盗”,但是他们并不能激活4“太空海盗”这个羁绊,仅仅激活了2“太空海盗”这个羁绊(注意并不是3“太空海盗”,因为“太空海盗”这个羁绊只有2和4两个等阶),如果想要激活4“太空海盗”,还需要另一位具有“太空海盗”种族职业的普朗克。
输入描述
第一行给出一个整数 n (),代表玩家有 n 个英雄
下一行给出 n 个字符串,每个字符串用空格分隔,代表英雄名称。
保证所给出的所有英雄都出现在上述的表格内。
输出描述
先输出一个 m (),表示已经激活了的羁绊。
然后按羁绊等阶排序降序输出 m 行,先输出羁绊的等阶,再输出羁绊的名称,用空格分开。
必须保证每个羁绊都存在于上述表格内。
这里的等阶比较方法是指先彩色羁绊>金色羁绊>银色羁绊>铜色羁绊,如果有两个羁绊的等阶相同,则按照羁绊名称的字典序排序(本题的字典序即表格给出的顺序)
示例1
输入:
3 Yasuo Yasuo Yasuo
输出:
0
示例2
输入:
2 Annie TwistedFate
输出:
1 2 Sorcerer
示例3
输入:
3 Leona FioraLaurent Lucian
输出:
1 3 Cybernetic
示例4
输入:
8 AurelionSol Ekko Gangplank Lulu MissFortune Thresh Irelia Kayle
输出:
4 2 ManaReaver 1 Mercenary 1 Starship 2 Valkyrie
示例5
输入:
6 Annie Rumble Fizz Ahri Syndra Zoe
输出:
3 3 MechPilot 4 Sorcerer 3 StarGuardian
C++(clang++11) 解法, 执行用时: 5ms, 内存消耗: 464K, 提交时间: 2021-04-10 16:38:28
#include <iostream> #include <string> #include <algorithm> using namespace std; string namelist[52]={"Caitlyn","FioraLaurent","Graves","Jarvan","KhaZix","Leona","Malphite","Poppy","TwistedFate","Xayah","Ziggs","Zoe","Ahri","Annie","Blitzcrank","Darius","KaiSa","Lucian","Mordekaiser","Rakan","Shen","Sona","XinZhao","Yasuo","Ashe","Ezreal","Jayce","Karma","Kassadin","Lux","MasterYi","Neeko","Rumble","Shaco","Syndra","Vi","Fizz","GhoGath","Irelia","Jhin","Jinx","Kayle","Soraka","VelKoz","Wukong","AurelionSol","Ekko","Gangplank","Lulu","MissFortune","Thresh","Xerath"}; string nam2jb[52][3]={{"Chrono","Sniper",""},{"Cybernetic","Blademaster",""},{"SpacePriate","Blaster",""},{"DarkStar","Protector",""},{"Void","Infiltrator",""},{"Cybernetic","Vanguard",""},{"Rebel","Brawler",""},{"StarGuardian","Vanguard",""},{"Chrono","Sorcerer",""},{"Celestial","Blademaster",""},{"Rebel","Demolitionist",""},{"StarGuardian","Sorcerer",""},{"StarGuardian","Sorcerer",""},{"MechPilot","Sorcerer",""},{"Chrono","Brawler",""},{"SpacePriate","ManaReaver",""},{"Valkyrie","Infiltrator",""},{"Cybernetic","Blaster",""},{"DarkStar","Vanguard",""},{"Celestial","Protector",""},{"Chrono","Blademaster",""},{"Rebel","Mystic",""},{"Celestial","Protector",""},{"Rebel","Blademaster",""},{"Celestial","Sniper",""},{"Chrono","Blaster",""},{"SpacePriate","Vanguard",""},{"DarkStar","Mystic",""},{"Celestial","ManaReaver",""},{"DarkStar","Sorcerer",""},{"Rebel","Blademaster",""},{"StarGuardian","Protector",""},{"MechPilot","Demolitionist",""},{"DarkStar","Infiltrator",""},{"StarGuardian","Sorcerer",""},{"Cybernetic","Brawler",""},{"MechPilot","Infiltrator",""},{"Void","Brawler",""},{"Cybernetic","ManaReaver","Blademaster"},{"DarkStar","Sniper",""},{"Rebel","Blaster",""},{"Valkyrie","Blademaster",""},{"StarGuardian","Mystic",""},{"Void","Sorcerer",""},{"Chrono","Vanguard",""},{"Rebel","Starship",""},{"Cybernetic","Infiltrator",""},{"SpacePriate","Mercenary","Demolitionist"},{"Celestial","Mystic",""},{"Valkyrie","Mercenary","Blaster"},{"Chrono","ManaReaver",""},{"DarkStar","Sorcerer",""}}; string jibnlist[23]={"Blademaster","Blaster","Brawler","Celestial","Chrono","Cybernetic","DarkStar","Demolitionist","Infiltrator","ManaReaver","MechPilot","Mercenary","Mystic","Protector","Rebel","Sniper","Sorcerer","SpacePriate","StarGuardian","Starship","Valkyrie","Vanguard","Void"}; int jbqz[23][4]={{9,6,6,3},{10,4,4,2},{10,4,4,2},{10,6,4,2},{10,6,4,2},{10,6,6,3},{9,6,6,3},{10,2,2,2},{6,4,4,2},{10,2,2,2},{10,3,3,3},{10,1,1,1},{10,4,4,2},{6,4,4,2},{10,6,6,3},{10,2,2,2},{8,6,4,2},{10,4,4,2},{10,6,3,3},{10,1,1,1},{10,2,2,2},{10,4,4,2},{10,3,3,3}}; int cnt[51]={0},cnt2[23]={0},tot=0; struct P{ string name; int typ,cnt; bool operator<(P b){ if(typ==b.typ) return name<b.name; return typ<b.typ; } void out(){ cout<<cnt<<" "<<name<<endl; } }arr[23]; int main(){ int n; cin>>n; string s; while(n--){ cin>>s; for(int i=0;i<52;i++){ if(s==namelist[i]){ cnt[i]=1; break; } } } for(int i=0;i<52;i++){ if(cnt[i]==1){ for(int j=0;j<3;j++){ for(int k=0;k<23;k++){ if(nam2jb[i][j]==jibnlist[k]){ cnt2[k]++; break; } } } } } for(int i=0;i<23;i++){ for(int j=0;j<4;j++){ if(cnt2[i]>=jbqz[i][j]){ arr[tot].name=jibnlist[i]; arr[tot].cnt=jbqz[i][j]; arr[tot++].typ=j; break; } } } sort(arr,arr+tot); printf("%d\n",tot); for(int i=0;i<tot;i++){ arr[i].out(); } return 0; }
Python3 解法, 执行用时: 42ms, 内存消耗: 5076K, 提交时间: 2022-01-19 23:38:01
hero={"Caitlyn":['Chrono', 'Sniper'],"FioraLaurent":['Cybernetic', 'Blademaster'],"Graves":['SpacePriate', 'Blaster'],"Jarvan":['DarkStar', 'Protector'],"KhaZix":['Void', 'Infiltrator'],"Leona":['Cybernetic', 'Vanguard'],"Malphite":['Rebel', 'Brawler'],"Poppy":['StarGuardian', 'Vanguard'],"TwistedFate":['Chrono', 'Sorcerer'],"Xayah":['Celestial', 'Blademaster'],"Ziggs":['Rebel', 'Demolitionist'],"Zoe":['StarGuardian', 'Sorcerer'],"Ahri":['StarGuardian', 'Sorcerer'],"Annie":['MechPilot', 'Sorcerer'],"Blitzcrank":['Chrono', 'Brawler'],"Darius":['SpacePriate', 'ManaReaver'],"KaiSa":['Valkyrie', 'Infiltrator'],"Lucian":['Cybernetic', 'Blaster'],"Mordekaiser":['DarkStar', 'Vanguard'],"Rakan":['Celestial', 'Protector'],"Shen":['Chrono', 'Blademaster'],"Sona":['Rebel', 'Mystic'],"XinZhao":['Celestial', 'Protector'],"Yasuo":['Rebel', 'Blademaster'],"Ashe":['Celestial', 'Sniper'],"Ezreal":['Chrono', 'Blaster'],"Jayce":['SpacePriate', 'Vanguard'],"Karma":['DarkStar', 'Mystic'],"Kassadin":['Celestial', 'ManaReaver'],"Lux":['DarkStar', 'Sorcerer'],"MasterYi":['Rebel', 'Blademaster'],"Neeko":['StarGuardian', 'Protector'],"Rumble":['MechPilot', 'Demolitionist'],"Shaco":['DarkStar', 'Infiltrator'],"Syndra":['StarGuardian', 'Sorcerer'],"Vi":['Cybernetic', 'Brawler'],"Fizz":['MechPilot', 'Infiltrator'],"GhoGath":['Void', 'Brawler'],"Irelia":['Cybernetic', 'ManaReaver', 'Blademaster'],"Jhin":['DarkStar', 'Sniper'],"Jinx":['Rebel', 'Blaster'],"Kayle":['Valkyrie', 'Blademaster'],"Soraka":['StarGuardian', 'Mystic'],"VelKoz":['Void', 'Sorcerer'],"Wukong":['Chrono', 'Vanguard'],"AurelionSol":['Rebel', 'Starship'],"Ekko":['Cybernetic', 'Infiltrator'],"Gangplank":['SpacePriate', 'Mercenary', 'Demolitionist'],"Lulu":['Celestial', 'Mystic'],"MissFortune":['Valkyrie', 'Mercenary', 'Blaster'],"Thresh":['Chrono', 'ManaReaver'],"Xerath":['DarkStar', 'Sorcerer']} jiban={"Blademaster":[(3, 0), (6, 2), (9, 3)],"Blaster":[(2, 0), (4, 2)],"Brawler":[(2, 0), (4, 2)],"Celestial":[(2, 0), (4, 1), (6, 2)],"Chrono":[(2, 0), (4, 1), (6, 2)],"Cybernetic":[(3, 0), (6, 2)],"DarkStar":[(3, 0), (6, 2), (9, 3)],"Demolitionist":[(2, 2)],"Infiltrator":[(2, 0), (4, 2), (6, 3)],"ManaReaver":[(2, 2)],"MechPilot":[(3, 2)],"Mercenary":[(1, 2)],"Mystic":[(2, 0), (4, 2)],"Protector":[(2, 0), (4, 2), (6, 3)],"Rebel":[(3, 0), (6, 2)],"Sniper":[(2, 2)],"Sorcerer":[(2, 0), (4, 1), (6, 2), (8, 3)],"SpacePriate":[(2, 0), (4, 2)],"StarGuardian":[(3, 1), (6, 2)],"Starship":[(1, 2)],"Valkyrie":[(2, 2)],"Vanguard":[(2, 0), (4, 2)],"Void":[(3, 2)]} n=int(input()) a=list(set(input().split())) d={} flag=0 for i in range(len(a)): for j in hero[a[i]]: d[j]=d.get(j,0)+1 d=list(d.items()) num=0 result=[] for i in range(len(d)): max=0 for j in jiban[d[i][0]]: if d[i][1]>=j[0]: max=j if max!=0: num+=1 result.append([max,d[i][0]]) flag=1 result.sort(key=lambda x:x[1]) result.sort(key=lambda x:-x[0][1]) if flag==0: print(0) else: print(num) for i in result: print(i[0][0],i[1])