# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1025820 |
2024-07-17T10:27:17 Z |
vjudge1 |
ZigZag (COCI17_zigzag) |
C++17 |
|
199 ms |
6420 KB |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int const N=2e5+5;
int const mod=1e9+7;
deque<string> wrd[26];
int main(){
int n,m;
cin>>n>>m;
for (int i = 0; i < n; ++i)
{
string s;
cin>>s;
wrd[s[0]-'a'].push_back(s);
}
for (int i = 0; i < 26; ++i)
sort(wrd[i].begin(),wrd[i].end());
for (int i = 0; i < m; ++i)
{
char c;
cin>>c;
string s=wrd[c-'a'][0];
wrd[c-'a'].pop_front();
wrd[c-'a'].push_back(s);
cout<<s<<endl;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
2 ms |
348 KB |
Output is correct |
5 |
Correct |
2 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
199 ms |
6420 KB |
Output is correct |
8 |
Correct |
162 ms |
6376 KB |
Output is correct |
9 |
Correct |
176 ms |
6184 KB |
Output is correct |
10 |
Correct |
179 ms |
6228 KB |
Output is correct |