Submission #102287

#TimeUsernameProblemLanguageResultExecution timeMemory
102287SirCenessTavan (COCI16_tavan)C++14
80 / 80
3 ms512 KiB
#include <bits/stdc++.h> #define mod 1000000007 typedef long long ll; using namespace std; int n, m, k, x; string ss[500]; string str; int main(){ //freopen("baskent.gir", "r", stdin); cin >> n >> m >> k >> x; x--; cin >> str; for (int i = 0; i < m; i++){ string s; cin >> s; int *arr = (int *)malloc(sizeof(int)*s.size()); for (int j = 0; j < s.size(); j++) arr[j] = s[j]; sort(arr, arr+s.size()); for (int j = 0; j < s.size(); j++) s[j] = arr[j]; ss[i] = s; } int next = m; for (int i = 0; i < n; i++){ if (str[i] == '#'){ next--; int ind = 0; int ch = pow(k, next); while (x-ch >= 0){ x -= ch; ind++; } str[i] = ss[m-next-1][ind]; } } cout << str << endl; }

Compilation message (stderr)

tavan.cpp: In function 'int main()':
tavan.cpp:23:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int j = 0; j < s.size(); j++) arr[j] = s[j];
                   ~~^~~~~~~~~~
tavan.cpp:25:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int j = 0; j < s.size(); j++) s[j] = arr[j];
                   ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...