Submission #473264

#TimeUsernameProblemLanguageResultExecution timeMemory
473264Ahmed57ZigZag (COCI17_zigzag)C++14
80 / 80
67 ms11148 KiB
#include<bits/stdc++.h> using namespace std; int main(){ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); int n,m; cin>>n>>m; int po[300]={0}; vector<string> v(n); for(int i = 0;i<n;i++)cin>>v[i]; map<char,vector<string>> mp; for(int i = 0;i<n;i++){ mp[v[i][0]].push_back(v[i]); }for(int i = 0;i<26;i++){ char q = ('a')+i; sort(mp[q].begin(),mp[q].end()); } for(int i = 0;i<m;i++){ char z;cin>>z; int q=z; int e = (po[q]%mp[z].size()); cout<<mp[z][e]<<"\n"; po[q]++; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...