# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
473264 | Ahmed57 | ZigZag (COCI17_zigzag) | C++14 | 67 ms | 11148 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;
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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |