# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
82064 | heon | Tavan (COCI16_tavan) | C++11 | 2 ms | 704 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;
string pretvori(int num, int base){
string t;
while(num){
t += (num % base) + '0';
num /= base;
}
return t;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int n,m,k,x;
cin >> n >> m >> k >> x;
string s;
cin >> s;
vector <string> v(m);
for(int i = 0; i < m; i++){
cin >> v[i];
sort(v[i].begin(), v[i].end());
}
string rj = pretvori(x - 1, k);
int lj = 0;
for(auto x : s) if(x == '#') lj++;
while(rj.size() != lj) rj.push_back('0');
reverse(rj.begin(), rj.end());
int ind = 0;
for(auto x : rj){
s[s.find('#')] = v[ind++][x - '0'];
}
cout << s;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |