# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
166653 | Abdulaziz_Kazim | ZigZag (COCI17_zigzag) | C++17 | 449 ms | 8080 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>dizi[30];
long long int cnt[100007];
int main()
{
// freopen("a.gir","r",stdin);
// freopen("a.cik","w",stdout);
int n,k;
cin >> k >> n;
string a;
for(int i=0;i<k;i++)
{
cin >> a;
dizi[a[0]-'a'].push_back(a);
}
for(int i=0;i<30;i++)
{
sort(dizi[i].begin(),dizi[i].end());
}
char as;
for(int i=0;i<n;i++)
{
cin >> as;
int diz=cnt[as-'a']%(dizi[as-'a'].size());
cout << dizi[as-'a'][diz]<<endl;
cnt[as-'a']++;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |