# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
381411 | abzal028 | ZigZag (COCI17_zigzag) | C++14 | 327 ms | 6508 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;
vector<string>v[30];
long long cnt[100007];
int main()
{
int n,k;
cin>>k >>n;
string a;
for(int i=0;i<k;i++){
cin>>a;
v[a[0]-'a'].push_back(a);
}
for(int i=0;i<30;i++){
sort(v[i].begin(),v[i].end());
}
char c;
for(int i=0;i<n;i++)
{
cin>>c;
int s=cnt[c-'a'] % (v[c-'a'].size());
cout<<v[c-'a'][s]<<endl;
cnt[c-'a']++;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |