#2. 石头剪刀布
石头剪刀布
说明
石头剪子布,是一种猜拳游戏。起源于中国,然后传到日本、朝鲜等地,随着亚欧贸易的不断发展它传到了欧洲,到了近现代逐渐风靡世界。简单明了的规则,使得石头剪子布没有任何规则漏洞可钻,单次玩法比拼运气,多回合玩法比拼心理博弈,使得石头剪子布这个古老的游戏同时用于“意外”与“技术”两种特性,深受世界人民喜爱。
游戏规则:石头打剪刀(用
G 表示石头),布包石头(用 C 表示布),剪刀剪布(用 P 表示剪刀)。
现在有 <math xmlns="http://www.w3.org/1998/Math/MathML">2n 名选手进行两两猜拳,一共进行 <math xmlns="http://www.w3.org/1998/Math/MathML">m 轮,选手编号为 <math xmlns="http://www.w3.org/1998/Math/MathML">1∼2n,初始时,所有选手的排名按照编号从小到大排列。小珅有预知未来的能力,知道第 <math xmlns="http://www.w3.org/1998/Math/MathML">j 轮中编号为 <math xmlns="http://www.w3.org/1998/Math/MathML">i 的选手出结果为 <math xmlns="http://www.w3.org/1998/Math/MathML">gi,j,其中 <math xmlns="http://www.w3.org/1998/Math/MathML">gi,j 为 <math xmlns="http://www.w3.org/1998/Math/MathML">G、C、P 三者之一。
每轮比赛中共会进行 <math xmlns="http://www.w3.org/1998/Math/MathML">n 场比赛,都是让最新的排名(按照分数从高到低排序,如果有分数相同的情况,则按编号从小到大排序)中的第 <math xmlns="http://www.w3.org/1998/Math/MathML">1 名与第 <math xmlns="http://www.w3.org/1998/Math/MathML">2 名比赛(第一场比赛)、第 <math xmlns="http://www.w3.org/1998/Math/MathML">3 名与第 <math xmlns="http://www.w3.org/1998/Math/MathML">4 名比赛(第二场比赛)、<math xmlns="http://www.w3.org/1998/Math/MathML">…、第 <math xmlns="http://www.w3.org/1998/Math/MathML">2k−1 名与第 <math xmlns="http://www.w3.org/1998/Math/MathML">2k 名比赛(第 <math xmlns="http://www.w3.org/1998/Math/MathML">k 场比赛,其中 <math xmlns="http://www.w3.org/1998/Math/MathML">1≤k≤n)。
每场比赛中的结果均为:
- 一名选手获胜,另一名选手输,获胜方选手得 <math xmlns="http://www.w3.org/1998/Math/MathML">1 分,输得一方选手不得分;
- 双方平局,双方选手均不得分。
小珅因为使用超能力预知每名选手出的结果,现在需要休息,所以请你计算并输出第 <math xmlns="http://www.w3.org/1998/Math/MathML">m 轮结束时所有人的排名,即按照分数从高到低输出每名选手的编号,如果有分数相同的情况,则优先输出编号更小的选手。
输入格式
第一行,包含两个整数 <math xmlns="http://www.w3.org/1998/Math/MathML">n,m。
接下来 <math xmlns="http://www.w3.org/1998/Math/MathML">2n 行,每行包含 <math xmlns="http://www.w3.org/1998/Math/MathML">m 个字符组成的字符串,其中第 <math xmlns="http://www.w3.org/1998/Math/MathML">i 行第 <math xmlns="http://www.w3.org/1998/Math/MathML">j 列的字符表示第 <math xmlns="http://www.w3.org/1998/Math/MathML">j 轮中第 <math xmlns="http://www.w3.org/1998/Math/MathML">i 名选手出的结果。
输出格式
共 <math xmlns="http://www.w3.org/1998/Math/MathML">2n 行,每行一个整数,其中第 <math xmlns="http://www.w3.org/1998/Math/MathML">i 行表示排名为 <math xmlns="http://www.w3.org/1998/Math/MathML">i 的选手的编号。2 3
GCP
PPG
PCC
GPC1
4
2
3