# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
481210 | varungoyalbits | Tavan (COCI16_tavan) | C++17 | 1 ms | 292 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.
/*
https://oj.uz/problem/view/COCI16_tavan
*/
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,m,k,x;
cin>>n>>m>>k>>x;
x--;
string str;
cin>>str;
vector<string>vec(m,"");
for(int i=0;i<m;i++)
{
cin>>vec[i];
sort(vec[i].begin(),vec[i].end());
}
vector<int> pos(m,0);
int p=m-1;
while(x>0&&p>=0)
{
pos[p]=x%k;
p--;
x/=k;
}
p=0;
for(int i=0;i<n;i++)
{
if(str[i]=='#')
{
str[i]=vec[p][pos[p]];
p++;
}
}
cout<<str<<"\n";
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |