# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
152822 |
2019-09-09T16:57:00 Z |
phillip |
ZigZag (COCI17_zigzag) |
C++14 |
|
435 ms |
8024 KB |
#include <bits/stdc++.h>
using namespace std;
vector<string>v[30];
string s;
int n,k,id[30];
char c;
int main()
{
cin>>k>>n;
for(int i=0;i<k;i++)
{
cin>>s;
v[s[0]-'a'].push_back(s);
}
for(int i=0;i<30;i++)
{
sort(v[i].begin(),v[i].end());
}
while(n--)
{
cin>>c;
int x=c-'a';
cout<<v[x][id[x]]<<"\n";
id[x]++;
id[x]%=v[x].size();
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
3 ms |
376 KB |
Output is correct |
4 |
Correct |
4 ms |
376 KB |
Output is correct |
5 |
Correct |
4 ms |
376 KB |
Output is correct |
6 |
Correct |
4 ms |
400 KB |
Output is correct |
7 |
Correct |
434 ms |
8024 KB |
Output is correct |
8 |
Correct |
435 ms |
8000 KB |
Output is correct |
9 |
Correct |
434 ms |
7892 KB |
Output is correct |
10 |
Correct |
432 ms |
7808 KB |
Output is correct |