# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
381327 |
2021-03-25T06:16:32 Z |
IldarKA |
ZigZag (COCI17_zigzag) |
C++14 |
|
462 ms |
12396 KB |
#include <bits/stdc++.h>
using namespace std;
int k, n;
set < pair < int, string > > s2[26];
int main(){
cin >> k >> n;
for(int i = 1; i <= k; i++){
string s;
cin >> s;
s2[int(s[0] - 'a')].insert({0, s});
}
for(int i = 1; i <= n; i++){
char a;
cin >> a;
int c = a - 'a';
string ans = s2[c].begin() -> second;
cout << ans << '\n';
int kol = s2[c].begin() -> first;
kol++;
s2[c].erase(s2[c].begin());
s2[c].insert({kol, ans});
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
2 ms |
364 KB |
Output is correct |
4 |
Correct |
2 ms |
364 KB |
Output is correct |
5 |
Correct |
3 ms |
364 KB |
Output is correct |
6 |
Correct |
2 ms |
364 KB |
Output is correct |
7 |
Correct |
462 ms |
12396 KB |
Output is correct |
8 |
Correct |
426 ms |
12396 KB |
Output is correct |
9 |
Correct |
433 ms |
12396 KB |
Output is correct |
10 |
Correct |
432 ms |
12396 KB |
Output is correct |