Submission #94192

#TimeUsernameProblemLanguageResultExecution timeMemory
94192bkinikTavan (COCI16_tavan)C++14
80 / 80
2 ms404 KiB
#include<bits/stdc++.h> using namespace std; #define pob pop_back #define mp make_pair #define pb push_back #define mid (l+r)/2 #define test printf("test\n") #define st first #define nd second #define superman ios::sync_with_stdio(0);cin.tie(0); typedef long long ll; typedef pair<ll,ll> pll; ll INF = 1e9; ll mod = 1e9+7; double pi = acos(-1); ll l,k,m,n,r; ll x; vector<string> cs; string ans = ""; int main() { //freopen(".gir","r",stdin); //freopen(".cik","w",stdout); cin>>n>>m>>k>>x; /* n = length m = # of illegible letters k = # of candidates; x = alphabetical order */ string str; cin>>str; cs.resize(m); string tempstr; for(int i=0; i<m; i++) { cin>>cs[i]; sort(cs[i].begin(), cs[i].end()); } ll na; for(int i=0; i<m-1; i++) { na = pow(k,m-i-1); ans += cs[i][ll(x/na)]; x -= na * (x/na); } ans += cs[m-1][x-1]; ll left = 0; for(int i=0; i<n; i++) { if(str[i] != '#') cout<<str[i]; else cout<<ans[left++]; } cout<<endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...