# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
170318 | ngmh | Tavan (COCI16_tavan) | C++11 | 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;
long long n, m, k, x, digits, mod, o;
string word, phrases[500];
int main(){
cin >> n >> m >> k >> x >> word;
x--;
for(int i = 0; i < m; i++){
cin >> phrases[i];
sort(phrases[i].begin(), phrases[i].end());
}
for(int i = 0; i < word.size(); i++){
if(word[i] == '#'){
word[i] = phrases[o][(long long) x/(pow(k,(m-1)))];
x %= (long long) pow(k, (m-1));
m--;
o++;
}
}
cout << word;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |