Submission #170318

# Submission time Handle Problem Language Result Execution time Memory
170318 2019-12-24T19:55:50 Z ngmh Tavan (COCI16_tavan) C++11
80 / 80
2 ms 504 KB
#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++){
                    ~~^~~~~~~~~~~~~
# Verdict Execution time Memory 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