# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
152822 | phillip | ZigZag (COCI17_zigzag) | C++14 | 435 ms | 8024 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];
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 |
---|---|---|---|---|
Fetching results... |