# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
102287 | SirCeness | Tavan (COCI16_tavan) | C++14 | 3 ms | 512 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>
#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 (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |