# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
80007 | pzdba | ZigZag (COCI17_zigzag) | C++14 | 242 ms | 13064 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;
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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |