Submission #105873

#TimeUsernameProblemLanguageResultExecution timeMemory
105873leonardaTavan (COCI16_tavan)C++14
80 / 80
3 ms512 KiB
#include<bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define F first #define S second typedef pair<int, int> pi; typedef long long int lint; const int inf = 0x3f3f3f3f; const int maxn = 500 + 5; int n, m, k, x; string s; string v[maxn]; string switchBase(int num, int base) { string t; while(num) { t += (num % base) + '0'; num /= base; } return t; } int main () { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> m >> k >> x; cin >> s; for(int i = 0; i < m; ++i) { cin >> v[i]; sort(v[i].begin(), v[i].end()); } string rj = switchBase(x - 1, k); while(rj.size() != m) rj.pb('0'); reverse(rj.begin(), rj.end()); int indeks = 0; for(auto x : rj) s[s.find('#')] = v[indeks++][x - '0']; cout << s; return 0; }

Compilation message (stderr)

tavan.cpp: In function 'int main()':
tavan.cpp:38:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  while(rj.size() != m) 
        ~~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...