# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
235354 | VEGAnn | ZigZag (COCI17_zigzag) | C++14 | 188 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>
#define MP make_pair
#define ft first
#define sd second
using namespace std;
set<pair<int, string> > st[26];
string s;
int n, k;
int main(){
ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef _LOCAL
freopen("in.txt","r",stdin);
#endif // _LOCAL
cin >> k >> n;
for (int i = 0; i < k; i++){
cin >> s;
st[s[0] - 'a'].insert(MP(0, s));
}
for (int i = 0; i < n; i++){
char c; cin >> c;
int ch = (c - 'a');
pair<int, string> cur = (*st[ch].begin());
cout << cur.sd << '\n';
st[ch].erase(cur);
cur.ft++;
st[ch].insert(cur);
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |