CodeForce VKcup B

时间:2022-01-11 15:49:08

题目描述:给了n个单词和m,还有一堆YES和NO表示在序列1-m,2-(m+1),3-(m+2)......中是否存在重复的单词,没重复的是YES,有重复的是NO

题目链接:点我

如果是NO的话,就使最后一个单词和第一个单词相同,如果是YES的话就按照顺序添加

#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<queue>
#include<map>
using namespace std;
#define MOD 1000000007
const int INF=0x3f3f3f3f;
const double eps=1e-;
typedef long long ll;
#define cl(a) memset(a,0,sizeof(a))
#define ts printf("\n*****\n");
#define sc(a) scanf("%d",&a);
#define pt(a) printf("%d\n",a);
#define ptn printf("\n");
const int MAXN=;
int n,m,tt;
char s[MAXN][],ss[MAXN];
int main()
{
int i,j,k,ca=;
while(scanf("%d%d",&n,&m)!=EOF){
char sbegin[]="Aa";
strcpy(s[],"Aa");
char p1='A';
char p2='a';
for(i=;i<m-;i++){
p2++;
if(p2==('z'+)) p2='a',p1++;
s[i][]=p1;
s[i][]=p2;
}
for(i=-;i<n-m;i++){
scanf("%s",ss);
if(strcmp(ss,"YES")==){
p2++;
if(p2=='z'+) p2='a',p1++;
s[i+m][]=p1;
s[i+m][]=p2;
}
else if(strcmp(ss,"NO")==){
strcpy(s[i+m],sbegin);
}
strcpy(sbegin,s[i+]);
}
for(i=;i<n;i++){
printf("%s ",s[i]);
}
ptn
}
}