# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
949743 | penguinma | Tavan (COCI16_tavan) | C++17 | 1 ms | 432 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;
using ll=long long;
int main()
{
ll n,m,k,x;
cin>>n>>m>>k>>x;
string s;
cin>>s;
ll num=0;
char ans[m];
char c[m][k];
for(ll i=0;i<m;i++)
{
for(ll j=0;j<k;j++)
cin>>c[i][j];
}
x--;
for(ll i=0;i<m;i++)
{
sort(c[i],c[i]+k);
ans[i]=c[i][0];
}
for(ll i=m-1;i>=0;i--)
{
ans[i]=c[i][x%k];
x=x/k;
}
for(ll i=0;i<n;i++)
{
if(s[i]=='#')
{
s[i]=ans[num];
num++;
}
}
cout<<s;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |