Submission #170318

#TimeUsernameProblemLanguageResultExecution timeMemory
170318ngmhTavan (COCI16_tavan)C++11
80 / 80
2 ms504 KiB
#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)

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++){
                    ~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...