# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
441658 | 2021-07-05T17:39:42 Z | rainboy | Tavan (COCI16_tavan) | C | 1 ms | 284 KB |
#include <stdio.h> #include <string.h> #define N 500 #define A 26 int main() { static char cc[N + 1], ok[N][A]; int n, m, k, x, l, g, h, i, a; scanf("%d%d%d%d%s", &n, &m, &k, &x, cc), x--; for (h = 0; h < m; h++) { static char s[A + 1]; scanf("%s", s), l = strlen(s); for (g = 0; g < l; g++) ok[h][s[g] - 'a'] = 1; } for (i = n - 1, h = m - 1; i >= 0; i--) if (cc[i] == '#') { int d = x % k; for (a = 0; a < A; a++) if (ok[h][a] && d-- == 0) { cc[i] = a + 'a'; break; } x /= k, h--; } printf("%s\n", cc); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 284 KB | Output is correct |
2 | Correct | 1 ms | 284 KB | Output is correct |
3 | Correct | 0 ms | 204 KB | Output is correct |
4 | Correct | 0 ms | 280 KB | Output is correct |
5 | Correct | 0 ms | 204 KB | Output is correct |
6 | Correct | 0 ms | 204 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 0 ms | 204 KB | Output is correct |
9 | Correct | 1 ms | 204 KB | Output is correct |
10 | Correct | 0 ms | 204 KB | Output is correct |