# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
37976 | tmk | ZigZag (COCI17_zigzag) | C++14 | 226 ms | 6720 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;
#define st first
#define nd second
#define pb push_back
typedef long long LL;
vector<string>tab[26];
int pt[26];
int main()
{
ios_base::sync_with_stdio(0);
int k,n;
cin>>k>>n;
for(int i=0;i<k;i++)
{
string t;
cin>>t;
tab[(int)t[0]-'a'].pb(t);
}
for(int i=0;i<26;i++)
sort(tab[i].begin(),tab[i].end());
for(int i=0;i<n;i++)
{
char c;
cin>>c;
int kt=(int)c-'a';
cout<<tab[kt][pt[kt]]<<"\n";
if(++pt[kt]==(int)tab[kt].size())
pt[kt]=0;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |