# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
133664 | forelax | Tavan (COCI16_tavan) | C++14 | 2 ms | 504 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;
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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |