Description

In the army, it isn't easy to form a group of soldiers that will be effective on the battlefield. The communication is crucial and thus no two soldiers should share a name (what would happen if they got an order that Bob is a scouter, if there are two Bobs?).

A group of soldiers is effective if and only if their names are different. For example, a group (John, Bob, Limak) would be effective, while groups (Gary, Bob, Gary) and (Alice, Alice) wouldn't.

You are a spy in the enemy's camp. You noticed n soldiers standing in a row, numbered 1 through n. The general wants to choose a group ofk consecutive soldiers. For every k consecutive soldiers, the general wrote down whether they would be an effective group or not.

You managed to steal the general's notes, with n - k + 1 strings s1, s2, ..., sn - k + 1, each either "YES" or "NO".

  • The string s1 describes a group of soldiers 1 through k ("YES" if the group is effective, and "NO" otherwise).
  • The string s2 describes a group of soldiers 2 through k + 1.
  • And so on, till the string sn - k + 1 that describes a group of soldiers n - k + 1 through n.

Your task is to find possible names of n soldiers. Names should match the stolen notes. Each name should be a string that consists of between 1 and 10 English letters, inclusive. The first letter should be uppercase, and all other letters should be lowercase. Names don't have to be existing names — it's allowed to print "Xyzzzdj" or "T" for example.

Find and print any solution. It can be proved that there always exists at least one solution.

Input

The first line of the input contains two integers n and k (2 ≤ k ≤ n ≤ 50) — the number of soldiers and the size of a group respectively.

The second line contains n - k + 1 strings s1, s2, ..., sn - k + 1. The string si is "YES" if the group of soldiers i through i + k - 1 is effective, and "NO" otherwise.

Output

Find any solution satisfying all given conditions. In one line print n space-separated strings, denoting possible names of soldiers in the order. The first letter of each name should be uppercase, while the other letters should be lowercase. Each name should contain English letters only and has length from 1 to 10.

If there are multiple valid solutions, print any of them.

Examples
input
8 3
NO NO YES YES YES NO
output
Adam Bob Bob Cpqepqwer Limak Adam Bob Adam
input
9 8
YES NO
output
R Q Ccccccccc Ccocc Ccc So Strong Samples Ccc
input
3 2
NO NO
output
Na Na Na
Note

In the first sample, there are 8 soldiers. For every 3 consecutive ones we know whether they would be an effective group. Let's analyze the provided sample output:

  • First three soldiers (i.e. Adam, Bob, Bob) wouldn't be an effective group because there are two Bobs. Indeed, the string s1 is "NO".
  • Soldiers 2 through 4 (Bob, Bob, Cpqepqwer) wouldn't be effective either, and the string s2 is "NO".
  • Soldiers 3 through 5 (Bob, Cpqepqwer, Limak) would be effective, and the string s3 is "YES".
  • ...,
  • Soldiers 6 through 8 (Adam, Bob, Adam) wouldn't be effective, and the string s6 is "NO".

题意:给出需要输出的字符个数,给出其每个区间范围,要我们构造符合要求的字符串输出,(NO表示区间内有相同字符串,YES表示都不相同)

解法:我们假设  12345

23456,如果区间为NO,最好的做法是将5改成1,这样不会影响到下一个区间的判断

12341

23416

我们打一个有大写字母开头的A-Z,小写字母a-z结尾的表,遇见NO就将区间最后一个字符串改成区间第一个

 #include<bits/stdc++.h>
using namespace std;
int ans[];
string name[];
int n,m;
string s;
void cmd()
{
int cot=;
for(int i=; i<; i++)
{
for(int j=; j<; j++)
{
string s="";
s+='A'+i;
s+='a'+j;
name[cot++]=s;
}
}
}
int main()
{
cmd();
cin>>n>>m;
for(int i=; i<=n; i++)
{
ans[i]=i;
}
for(int i=; i<n-m+; i++)
{
cin>>s;
if(s=="NO")
{
ans[i+m-]=ans[i];
}
}
cout<<name[];
for(int i=; i<n; i++) cout<<" "<<name[ans[i]];
cout<<endl;
return ;
}

Codeforces Round #405 (rated, Div. 2, based on VK Cup 2017 Round 1) C的更多相关文章

  1. Codeforces Round #405 (rated, Div. 2, based on VK Cup 2017 Round 1) 菜鸡只会ABC!

    Codeforces Round #405 (rated, Div. 2, based on VK Cup 2017 Round 1) 全场题解 菜鸡只会A+B+C,呈上题解: A. Bear and ...

  2. Codeforces Round #405 (rated, Div. 2, based on VK Cup 2017 Round 1) C. Bear and Different Names 贪心

    C. Bear and Different Names 题目连接: http://codeforces.com/contest/791/problem/C Description In the arm ...

  3. Codeforces Round #405 (rated, Div. 2, based on VK Cup 2017 Round 1) B - Bear and Friendship Condition 水题

    B. Bear and Friendship Condition 题目连接: http://codeforces.com/contest/791/problem/B Description Bear ...

  4. 【树形dp】Codeforces Round #405 (rated, Div. 1, based on VK Cup 2017 Round 1) B. Bear and Tree Jumps

    我们要统计的答案是sigma([L/K]),L为路径的长度,中括号表示上取整. [L/K]化简一下就是(L+f(L,K))/K,f(L,K)表示长度为L的路径要想达到K的整数倍,还要加上多少. 于是, ...

  5. Codeforces Round #405 (rated, Div. 2, based on VK Cup 2017 Round 1)

    A 模拟 B 发现对于每个连通块,只有为完全图才成立,然后就dfs C 构造 想了20分钟才会,一开始想偏了,以为要利用相邻NO YES的关系再枚举,其实不难.. 考虑对于顺序枚举每一个NO/YES, ...

  6. Codeforces Round #405 (rated, Div. 2, based on VK Cup 2017 Round 1)A B C 水 并查集 思路

    A. Bear and Big Brother time limit per test 1 second memory limit per test 256 megabytes input stand ...

  7. 【构造】Codeforces Round #405 (rated, Div. 1, based on VK Cup 2017 Round 1) A. Bear and Different Names

    如果某个位置i是Y,直接直到i+m-1为止填上新的数字. 如果是N,直接把a[i+m-1]填和a[i]相同即可,这样不影响其他段的答案. 当然如果前面没有过Y的话,都填上0就行了. #include& ...

  8. Codeforces Round #405 (rated, Div. 2, based on VK Cup 2017 Round 1) E

    Description Bear Limak prepares problems for a programming competition. Of course, it would be unpro ...

  9. Codeforces Round #405 (rated, Div. 2, based on VK Cup 2017 Round 1) D

    Description A tree is an undirected connected graph without cycles. The distance between two vertice ...

随机推荐

  1. openwrt gstreamer实例学习笔记(五. gstreamer BUS)

    1)概述 BUS(总线) 是一个简单的系统,它采用自己的线程机制将一个管道线程的消息分发到一个应用程序当中.总线的优势是:当使用GStreamer的时候,应用程序不需要线程识别,即便GStreamer ...

  2. archlinux yaourt安装 以及出错细节 database file for "archlinuxfr" does not exist.

    archlinux yaourt安装 但一直报错如下: :: Synchronizing package databases...      core is up to date extra is u ...

  3. Freemarker 中的哈希表(Map)和序列(List)

    freemarlker中的容器类型有: 哈希表:是实现了TemplateHashModel或者TemplateHashModelEx接口的java对象,经常使用的实现类是SimpleHash,该类实现 ...

  4. camus gobblin

    ####Camus is being phased out and replaced by Gobblin. For those using or interested in Camus, we su ...

  5. char* strcpy( char* dest, const char* src ), int binary_search(int *arr, int key, int n), 可能的实现

    #include <stdio.h> char* stringCopy( char* dest, const char* src ) { size_t i = 0; while (dest ...

  6. ubuntu gcc低版本过低引起错误

    错误内容: 正在读取软件包列表... 完成正在分析软件包的依赖关系树 正在读取状态信息... 完成 您可能需要运行“apt-get -f install”来纠正下列错误:下列软件包有未满足的依赖关系: ...

  7. Kafka在Windows安装运行

    摘要:本文主要说明了如何在Windows安装运行Kafka 一.安装JDK 过程比较简单,这里不做说明. 最后打开cmd输入如下内容,表示安装成功 二.安装zooeleeper 下载安装包:http: ...

  8. linux下自动创建设备文件节点---class

    在驱动模块初始化函数中实现设备节点的自动创建 我们在刚开始写Linux设备驱动程序的时候,很多时候都是利用mknod命令手动创建设备节点,实际上Linux内核为我们提供了一组函数,可以用来在模块加载的 ...

  9. 使用proc接口例子【转】

    本文转载自:http://blog.csdn.net/mike8825/article/details/52434666 版权声明:本文为博主原创文章,未经博主允许不得转载. 在上一篇的使用sys接口 ...

  10. Tomcat 系统架构与设计模式之二

    Tomcat 系统架构与设计模式,第 2 部分: 设计模式分析 来自:http://www.ibm.com/developerworks/cn/java/j-lo-tomcat2/ 这个分为两个部分的 ...