| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 97826 | dalgerok | ZigZag (COCI17_zigzag) | C++17 | 193 ms | 12536 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 k, n;
    cin >> k >> n;
    multiset < pair < int, string > > q[26];
    for(int i = 1; i <= k; i++){
        string s;
        cin >> s;
        q[s[0] - 'a'].insert(make_pair(0, s));
    }
    while(n--){
        char c;
        cin >> c;
        auto it = *q[c - 'a'].begin();
        cout << it.second << "\n";
        q[c - 'a'].erase(q[c - 'a'].find(it));
        it.first += 1;
        q[c - 'a'].insert(it);
    }
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
