Submission #152822

#TimeUsernameProblemLanguageResultExecution timeMemory
152822phillipZigZag (COCI17_zigzag)C++14
80 / 80
435 ms8024 KiB
#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 timeMemoryGrader output
Fetching results...