Submission #133664

#TimeUsernameProblemLanguageResultExecution timeMemory
133664forelaxTavan (COCI16_tavan)C++14
80 / 80
2 ms504 KiB
#include<bits/stdc++.h> using namespace std; int main(){ int n,m,k,x; cin>>n>>m>>k>>x;x--; string r; cin>>r; vector<string> g(m); for(int i = 0 ; i < m ; i ++){ cin>>g[i]; sort(g[i].begin(),g[i].end()); // cout<<g[i]<<" "; } vector<int> t(m,0); long long psb=k; int i=m-1; // cout<<i<<" "; while(psb<x){ psb*=k; i--; } // cout<<i<<endl; psb/=k; while(i<m){ t[i]=x/psb; // cout<<i<<" "<<x<<" "<<psb<<" "<<t[i]<<" "<<x%psb<<endl; x%=psb; i++; psb/=k; } for(int i = 0,j=0 ; i < n ; i ++){ if(r[i]=='#'){ // cout<<endl<<j<<" "<<g[j]<<" "<<t[j]<<endl; cout<<g[j][t[j]]; j++; }else cout<<r[i]; } }
#Verdict Execution timeMemoryGrader output
Fetching results...