Submission #37979

#TimeUsernameProblemLanguageResultExecution timeMemory
37979tmkZigZag (COCI17_zigzag)C++14
72 / 80
206 ms7396 KiB
#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(move(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 timeMemoryGrader output
Fetching results...