# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
381391 | abzal028 | ZigZag (COCI17_zigzag) | C++14 | 323 ms | 6420 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 |
---|---|---|---|---|
Fetching results... |