#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fast_io ios_base::sync_with_stdio(0); cin.tie(0)
int main()
{
ios_base::sync_with_stdio(0) ;
cin.tie(0) ;
ll n,m;
cin>>n>>m;
map<char,vector<string>>mp;
string s;
vector<string>t(n);
for(int i=0; i<n; ++i){
cin>>t[i];
mp[t[i][0]].push_back(t[i]);
}
for(char i ='a'; i<'z'; ++i){
sort(mp[i].begin(),mp[i].end());
}
char y;
for(int i=0; i<n; ++i){
cin>>y;
cout<<mp[y][0]<<"\n";
mp[y].push_back(mp[y][0]);
mp[y].erase(mp[y].begin());
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
3 |
Incorrect |
1 ms |
332 KB |
Output isn't correct |
4 |
Incorrect |
1 ms |
332 KB |
Output isn't correct |
5 |
Incorrect |
1 ms |
332 KB |
Output isn't correct |
6 |
Incorrect |
1 ms |
332 KB |
Output isn't correct |
7 |
Execution timed out |
2083 ms |
10864 KB |
Time limit exceeded |
8 |
Execution timed out |
2065 ms |
10868 KB |
Time limit exceeded |
9 |
Execution timed out |
2074 ms |
10936 KB |
Time limit exceeded |
10 |
Execution timed out |
2070 ms |
10988 KB |
Time limit exceeded |