# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
95560 | oolimry | Tavan (COCI16_tavan) | C++14 | 2 ms | 380 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>
using namespace std;
int main()
{
int n, m, k, x;
//freopen("i.txt","r",stdin);
scanf("%d %d %d %d",&n,&m,&k,&x);
string s;
cin >> s;
string arr[m];
for(int i = 0;i < m;i++){
cin >> arr[i];
}
reverse(arr, arr + m);
char carr[m][k];
for(int i= 0;i < m;i++){
for(int j = 0;j < k;j++){
carr[i][j] = arr[i].at(j);
}
}
for(int i =0;i < m;i++){
sort(carr[i], carr[i] + k);
}
int index = 0;
x--;
for(int i = n - 1;i >= 0 ;i--){
char c = s.at(i);
if(c != '#'){
continue;
}
s[i] = carr[index][x % k];
x /= k;
index++;
}
for(int i= 0;i < m;i++){
for(int j = 0;j < k;j++){
//printf("%c ",carr[i][j]);
}
// printf("\n");
}
cout << s;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |