답안 #495463

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
495463 2021-12-18T17:33:06 Z niloyroot Cryptography (NOI20_crypto) C++14
0 / 100
1 ms 336 KB
#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();
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 336 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 336 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 296 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 208 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 208 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 336 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 208 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 336 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -