Submission #242537

#TimeUsernameProblemLanguageResultExecution timeMemory
242537VEGAnnTavan (COCI16_tavan)C++14
80 / 80
5 ms512 KiB
#include <bits/stdc++.h> #define all(x) x.begin(),x.end() using namespace std; const int N = 510; int n, m, k, id[N], x; string s[N], t; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); #ifdef _LOCAL freopen("in.txt","r",stdin); #endif // _LOCAL cin >> n >> m >> k >> x; cin >> t; for (int i = 0; i < m; i++){ cin >> s[i]; sort(all(s[i])); } int lst = m - 1; x--; while (x > 0){ id[lst--] = x % k; x /= k; } lst = 0; for (int i = 0; i < n; i++){ if (t[i] != '#') continue; t[i] = s[lst][id[lst]]; lst++; } cout << t; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...