Submission #481210

#TimeUsernameProblemLanguageResultExecution timeMemory
481210varungoyalbitsTavan (COCI16_tavan)C++17
80 / 80
1 ms292 KiB
/* 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 timeMemoryGrader output
Fetching results...