#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
tavan.cpp: In function 'int main()':
tavan.cpp:13:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 0; i < word.size(); i++){
~~^~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
504 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
504 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
380 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
2 ms |
376 KB |
Output is correct |
10 |
Correct |
2 ms |
376 KB |
Output is correct |