Submission #949743

#TimeUsernameProblemLanguageResultExecution timeMemory
949743penguinmaTavan (COCI16_tavan)C++17
80 / 80
1 ms432 KiB
#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 timeMemoryGrader output
Fetching results...