Submission #166653

#TimeUsernameProblemLanguageResultExecution timeMemory
166653Abdulaziz_KazimZigZag (COCI17_zigzag)C++17
80 / 80
449 ms8080 KiB
#include<bits/stdc++.h> using namespace std; vector<string>dizi[30]; long long int cnt[100007]; int main() { // freopen("a.gir","r",stdin); // freopen("a.cik","w",stdout); int n,k; cin >> k >> n; string a; for(int i=0;i<k;i++) { cin >> a; dizi[a[0]-'a'].push_back(a); } for(int i=0;i<30;i++) { sort(dizi[i].begin(),dizi[i].end()); } char as; for(int i=0;i<n;i++) { cin >> as; int diz=cnt[as-'a']%(dizi[as-'a'].size()); cout << dizi[as-'a'][diz]<<endl; cnt[as-'a']++; } }
#Verdict Execution timeMemoryGrader output
Fetching results...