# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
559624 | Trunkty | ZigZag (COCI17_zigzag) | C++14 | 65 ms | 7988 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 <iostream>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
typedef long long ll;
#define DEBUG
#ifdef DEBUG
#define debug(x) cout << #x << ": " << x << endl
#else
#define debug(x)
#endif
int k,n;
deque<string> arr[205];
int main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
cin >> k >> n;
for(int i=1;i<=k;i++){
string s;
cin >> s;
arr[s[0]].push_back(s);
}
for(int i=1;i<=200;i++){
sort(arr[i].begin(),arr[i].end());
}
for(int i=1;i<=n;i++){
string s;
cin >> s;
string a = arr[s[0]].front();
arr[s[0]].pop_front();
arr[s[0]].push_back(a);
cout << a << "\n";
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |