Submission #240036

#TimeUsernameProblemLanguageResultExecution timeMemory
240036marlicuZigZag (COCI17_zigzag)C++14
80 / 80
73 ms7928 KiB
#include <bits/stdc++.h> using namespace std; int k, n; int receno[26]; vector <string> rijeci[26]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> k >> n; char c; string s; for (int i = 0; i < k; i++) { cin >> s; c = s[0]; rijeci[c - 'a'].push_back(s); } for (int i = 0; i < 26; i++) { sort(rijeci[i].begin(), rijeci[i].end()); } int x, l, r; for (int i = 0; i < n; i++) { cin >> c; x = c - 'a'; r = receno[x]; l = rijeci[x].size(); cout << rijeci[x][r % l] << '\n'; receno[x]++; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...