# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
240036 | marlicu | ZigZag (COCI17_zigzag) | C++14 | 73 ms | 7928 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |