# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
102287 | 2019-03-24T06:45:40 Z | SirCeness | Tavan (COCI16_tavan) | C++14 | 3 ms | 512 KB |
#include <bits/stdc++.h> #define mod 1000000007 typedef long long ll; using namespace std; int n, m, k, x; string ss[500]; string str; int main(){ //freopen("baskent.gir", "r", stdin); cin >> n >> m >> k >> x; x--; cin >> str; for (int i = 0; i < m; i++){ string s; cin >> s; int *arr = (int *)malloc(sizeof(int)*s.size()); for (int j = 0; j < s.size(); j++) arr[j] = s[j]; sort(arr, arr+s.size()); for (int j = 0; j < s.size(); j++) s[j] = arr[j]; ss[i] = s; } int next = m; for (int i = 0; i < n; i++){ if (str[i] == '#'){ next--; int ind = 0; int ch = pow(k, next); while (x-ch >= 0){ x -= ch; ind++; } str[i] = ss[m-next-1][ind]; } } cout << str << endl; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 512 KB | Output is correct |
2 | Correct | 3 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 3 ms | 384 KB | Output is correct |
7 | Correct | 3 ms | 384 KB | Output is correct |
8 | Correct | 3 ms | 384 KB | Output is correct |
9 | Correct | 3 ms | 384 KB | Output is correct |
10 | Correct | 2 ms | 384 KB | Output is correct |