Submission #473256

#TimeUsernameProblemLanguageResultExecution timeMemory
473256Ahmed57ZigZag (COCI17_zigzag)C++14
0 / 80
87 ms19052 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; vector<int> po(26,0); vector<string> v(n); for(int i = 0;i<n;i++)cin>>v[i]; sort(v.begin(),v.end()); 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<m;i++){ char z;cin>>z; int e = po[z]%mp[z].size(); cout<<mp[z][e]<<"\n"; po[z]++; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...