Submission #495463

#TimeUsernameProblemLanguageResultExecution timeMemory
495463niloyrootCryptography (NOI20_crypto)C++14
0 / 100
1 ms336 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; using vi = vector<ll>; using pl = pair<ll,ll>; #define pb push_back #define form(m,it) for(auto it=m.begin(); it!=m.end(); it++) #define forp(i,a,b) for(ll i=a; i<=b; i++) #define forn(i,a,b) for(ll i=a; i>=b; i--) #define newl '\n' #define ff first #define ss second const ll mod = 1000000007; void solve(){ ll n,k,x; cin>>n>>k>>x; string s; cin>>s; vi v; ll tmp=0; s='a'+s; s=s+'a'; forp(i,1,n+1){ if(s[i]=='*' && s[i-1]=='a'){ tmp=1; } else if(s[i]=='a' && s[i-1]=='*'){ v.pb(k*tmp+1); } else if(s[i]=='*'){ tmp++; } } ll pro=1; for(auto u:v){ pro=pro*u; } vi ans; x--; for(auto u:v){ pro/=u; ans.pb(x/(pro)); x=x%(pro); } ll ind=0; forp(i,1,n){ if(s[i]=='*' && s[i-1]=='a'){ forp(i,1,ans[ind]){ cout<<"b"; } ind++; } else if(s[i]=='a'){ cout<<"a"; } } cout<<newl; } int main(){ int t=1; cin>>t; while(t--)solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...