Submission #443160

#TimeUsernameProblemLanguageResultExecution timeMemory
443160penguinhackerTavan (COCI16_tavan)C++14
80 / 80
1 ms332 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define ar array int n, m, k, x; string s, cand[500]; int main() { ios::sync_with_stdio(0); cin.tie(0); cin >> n >> m >> k >> x >> s, --x; vector<int> d; for (int i=0; i<m; ++i) { cin >> cand[i]; sort(cand[i].begin(), cand[i].end()); d.push_back(x%k); x/=k; } reverse(d.begin(), d.end()); int seen=0; for (int i=0; i<n; ++i) if (s[i]=='#') s[i]=cand[seen][d[seen]], ++seen; cout << s; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...