# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
242537 | VEGAnn | Tavan (COCI16_tavan) | C++14 | 5 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 all(x) x.begin(),x.end()
using namespace std;
const int N = 510;
int n, m, k, id[N], x;
string s[N], t;
int main(){
ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef _LOCAL
freopen("in.txt","r",stdin);
#endif // _LOCAL
cin >> n >> m >> k >> x;
cin >> t;
for (int i = 0; i < m; i++){
cin >> s[i];
sort(all(s[i]));
}
int lst = m - 1; x--;
while (x > 0){
id[lst--] = x % k;
x /= k;
}
lst = 0;
for (int i = 0; i < n; i++){
if (t[i] != '#') continue;
t[i] = s[lst][id[lst]];
lst++;
}
cout << t;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |