Submission #500311

# Submission time Handle Problem Language Result Execution time Memory
500311 2021-12-30T17:03:47 Z kappa ZigZag (COCI17_zigzag) C++14
80 / 80
289 ms 12400 KB
#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
1 Correct 1 ms 284 KB Output is correct
2 Correct 1 ms 292 KB Output is correct
3 Correct 1 ms 292 KB Output is correct
4 Correct 1 ms 296 KB Output is correct
5 Correct 1 ms 296 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 264 ms 12328 KB Output is correct
8 Correct 289 ms 12352 KB Output is correct
9 Correct 268 ms 12300 KB Output is correct
10 Correct 285 ms 12400 KB Output is correct