-
Notifications
You must be signed in to change notification settings - Fork 2
/
B1069.cpp
44 lines (42 loc) · 1.08 KB
/
B1069.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*************************************************************************
> File Name: B1069.cpp
> Author: bumzy
> Mail: [email protected]
> Created Time: Tue 01 Aug 2017 08:18:25 PM CST
************************************************************************/
#include <iostream>
#include <string>
#include <unordered_map>
using namespace std;
static const int MAXM = 1000 + 10;
string name[MAXM];
unordered_map<string, int> M;
int main() {
int m, n, s;
cin >> m >> n >> s;
for (int i = 0; i < m; ++i) {
cin >> name[i];
M[name[i]] = 0;
}
bool flag = false;
for (int i = s - 1; i < m; i += n) {
if (M[name[i]] == 0) {
cout << name[i] << endl;
M[name[i]] = 1;
flag = true;
} else {
while (i < m && M[name[i]] == 1) {
i++;
}
if (i < m) {
cout << name[i] << endl;
M[name[i]] = 1;
flag = true;
}
}
}
if (flag == false) {
cout << "Keep going..." << endl;
}
return 0;
}