# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
500311 | kappa | ZigZag (COCI17_zigzag) | C++14 | 289 ms | 12400 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 k, n;
map<char, set<pair<int, string> > > mp;
int main(){
cin >> k >> n;
for (int i = 0; i < k; i++)
{
string tmp;
cin >> tmp;
mp[tmp[0]].insert({0, tmp});
}
while(n--){
char a;
cin >> a;
pair<int, string> curr = *mp[a].begin();
curr.first++;
cout << curr.second << "\n";
mp[a].erase(mp[a].begin());
mp[a].insert(curr);
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |