# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
475315 | Beboo44 | ZigZag (COCI17_zigzag) | C++14 | 2083 ms | 10988 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;
typedef long long ll;
#define fast_io ios_base::sync_with_stdio(0); cin.tie(0)
int main()
{
ios_base::sync_with_stdio(0) ;
cin.tie(0) ;
ll n,m;
cin>>n>>m;
map<char,vector<string>>mp;
string s;
vector<string>t(n);
for(int i=0; i<n; ++i){
cin>>t[i];
mp[t[i][0]].push_back(t[i]);
}
for(char i ='a'; i<'z'; ++i){
sort(mp[i].begin(),mp[i].end());
}
char y;
for(int i=0; i<n; ++i){
cin>>y;
cout<<mp[y][0]<<"\n";
mp[y].push_back(mp[y][0]);
mp[y].erase(mp[y].begin());
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |