# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
381391 |
2021-03-25T07:19:51 Z |
abzal028 |
ZigZag (COCI17_zigzag) |
C++14 |
|
323 ms |
6420 KB |
#include<bits/stdc++.h>
using namespace std;
int n,k;
vector<string>str[30];
long long cnt[100007];
int main()
{
cin>>k >>n;
string s;
for(int i=0;i<k;i++)
{
cin>>s;
str[s[0]-'a'].push_back(s);
}
for(int i=0;i<30;i++)
{
sort(str[i].begin(),str[i].end());
}
char c;
for(int i=0;i<n;i++)
{
cin>>c;
int st=cnt[c-'a'] % (str[c-'a'].size());
cout << str[c-'a'][st]<<endl;
cnt[st-'a']++;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
3 |
Incorrect |
2 ms |
364 KB |
Output isn't correct |
4 |
Incorrect |
2 ms |
364 KB |
Output isn't correct |
5 |
Incorrect |
2 ms |
364 KB |
Output isn't correct |
6 |
Incorrect |
3 ms |
364 KB |
Output isn't correct |
7 |
Incorrect |
321 ms |
6252 KB |
Output isn't correct |
8 |
Incorrect |
318 ms |
6252 KB |
Output isn't correct |
9 |
Incorrect |
318 ms |
6380 KB |
Output isn't correct |
10 |
Incorrect |
323 ms |
6420 KB |
Output isn't correct |