# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
381420 | asqar | ZigZag (COCI17_zigzag) | C++14 | 338 ms | 6532 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[30];
string s;
int n, k, id[30];
char c;
main ()
{
cin >> k >> n;
for(int i = 0; i < k; i ++)
{
cin >> s;
v[s[0] - 'a'].push_back (s);
}
for(int i = 0; i < 30; i ++)
{
sort(v[i].begin (), v[i].end ());
}
while (n --)
{
cin >> c;
int x = c - 'a';
cout << v[x][id[x]] << "\n";
id[x] ++;
id[x] %= v[x].size ();
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |