# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
235354 |
2020-05-28T06:31:55 Z |
VEGAnn |
ZigZag (COCI17_zigzag) |
C++14 |
|
188 ms |
12536 KB |
#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 |
1 |
Correct |
4 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
7 |
Correct |
182 ms |
12412 KB |
Output is correct |
8 |
Correct |
180 ms |
12408 KB |
Output is correct |
9 |
Correct |
183 ms |
12408 KB |
Output is correct |
10 |
Correct |
188 ms |
12536 KB |
Output is correct |