Submission #80007

#TimeUsernameProblemLanguageResultExecution timeMemory
80007pzdbaZigZag (COCI17_zigzag)C++14
80 / 80
242 ms13064 KiB
#include <bits/stdc++.h> using namespace std; vector<string> v[26]; int idx[26]; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int k, n; cin >> k >> n; for(int i=1;i<=k;i++){ string s; cin >> s; v[s[0]-'a'].emplace_back(s); } for(int i=0;i<26;i++) sort(v[i].begin(), v[i].end()); for(int i=1;i<=n;i++){ char s[2]; cin >> s; int x = s[0]-'a'; cout << v[x][idx[x]] << endl; idx[x] = (idx[x]+1)%v[x].size(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...