# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
447313 |
2021-07-26T03:55:20 Z |
dvtd |
ZigZag (COCI17_zigzag) |
C++14 |
|
68 ms |
6336 KB |
#include <bits/stdc++.h>
using namespace std;
int n, m, c[26];
vector<string> oc[26];
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n >> m;
for (int i=0; i < n; ++i)
{
string s;
cin >> s;
oc[s[0]-'a'].push_back(s);
}
for (int i=0; i<26; ++i)
sort(oc[i].begin(), oc[i].end());
while(m--)
{
char a;
cin >> a;
int x=a-'a';
cout << oc[x][c[x]] << "\n";
c[x]=(c[x]+1)%oc[x].size();
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
1 ms |
332 KB |
Output is correct |
5 |
Correct |
1 ms |
332 KB |
Output is correct |
6 |
Correct |
1 ms |
332 KB |
Output is correct |
7 |
Correct |
68 ms |
6212 KB |
Output is correct |
8 |
Correct |
56 ms |
6336 KB |
Output is correct |
9 |
Correct |
57 ms |
6224 KB |
Output is correct |
10 |
Correct |
55 ms |
6200 KB |
Output is correct |