# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
381420 | 2021-03-25T07:46:41 Z | asqar | ZigZag (COCI17_zigzag) | C++14 | 338 ms | 6532 KB |
#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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 2 ms | 364 KB | Output is correct |
4 | Correct | 2 ms | 364 KB | Output is correct |
5 | Correct | 2 ms | 364 KB | Output is correct |
6 | Correct | 2 ms | 364 KB | Output is correct |
7 | Correct | 333 ms | 6508 KB | Output is correct |
8 | Correct | 321 ms | 6252 KB | Output is correct |
9 | Correct | 338 ms | 6532 KB | Output is correct |
10 | Correct | 330 ms | 6292 KB | Output is correct |