Submission #1299975

#TimeUsernameProblemLanguageResultExecution timeMemory
1299975tabTavan (COCI16_tavan)C++20
80 / 80
1 ms580 KiB
#include "bits/stdc++.h" using namespace std; #define intt long long #define fi first #define se second const intt mxN = 2e5 + 5; const intt LG = 20; const intt inf = 1e18; intt n, m, k, x; string s; void _() { cin >> n >> m >> k >> x; cin >> s; intt tot = 1; vector<string> a; x--; for(intt i = 0; i < m; i++) { string BO; cin >> BO; a.push_back(BO); sort(a[i].begin(), a[i].end()); } vector<char>ans; for(intt i = 0; i < m; i++) { intt total = 1; for(intt j = i + 1; j < m; j++) { total = min(total * k, inf); } ans.push_back(a[i][x/total]); x %= total; } intt idx=0; for(intt i = 0; i < (intt)s.size(); i++) { if(s[i] == '#') { s[i] = ans[idx]; idx++; } } cout << s << endl; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); intt t = 1, buu = 1; // cin >> t; while(t--){ // cout << "Case #" << buu++ << ": "; _(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...