代码
#include <iostream>
#include <cstdio>
#include <string>
#include <map>
using namespace std;
string name[1001];
int main()
{
int m,n,s;
int tmp=-9999;
map<string,int> mp;
cin>>m>>n>>s;
if(s>m){
cout<<"Keep going...";
return 0;
}
for(int i=0;i<m;i++){
cin>>name[i];
if(i+1==s){
cout<<name[i]<<endl;
mp[name[i]]=1;
tmp=i;
}
if(tmp!=-9999){
while(mp.find(name[tmp+n])!=mp.end()){
tmp++;
if(tmp+n>m){
return 0;
}
}
if(mp.find(name[tmp+n])==mp.end()){
if(i==tmp+n){
cout<<name[i]<<endl;
mp[name[i]]=1;
tmp=i;
}
}
}
}
return 0;
}