Submission #500311

#TimeUsernameProblemLanguageResultExecution timeMemory
500311kappaZigZag (COCI17_zigzag)C++14
80 / 80
289 ms12400 KiB
#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 timeMemoryGrader output
Fetching results...