#include<bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int n,m;
cin>>n>>m;
vector<int> po(26,0);
vector<string> v(n);
for(int i = 0;i<n;i++)cin>>v[i];
sort(v.begin(),v.end());
map<char,vector<string>> mp;
for(int i = 0;i<n;i++){
mp[v[i][0]].push_back(v[i]);
}
for(int i = 0;i<m;i++){
char z;cin>>z;
int e = po[z]%mp[z].size();
cout<<mp[z][e]<<"\n";
po[z]++;
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 11 |
2 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 11 |
3 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 11 |
4 |
Runtime error |
1 ms |
588 KB |
Execution killed with signal 11 |
5 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 11 |
6 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 11 |
7 |
Runtime error |
85 ms |
18988 KB |
Execution killed with signal 6 |
8 |
Runtime error |
80 ms |
19052 KB |
Execution killed with signal 6 |
9 |
Runtime error |
87 ms |
18672 KB |
Execution killed with signal 6 |
10 |
Runtime error |
82 ms |
18700 KB |
Execution killed with signal 6 |