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