Submission #481210

# Submission time Handle Problem Language Result Execution time Memory
481210 2021-10-19T22:24:51 Z varungoyalbits Tavan (COCI16_tavan) C++17
80 / 80
1 ms 292 KB
/*
https://oj.uz/problem/view/COCI16_tavan
*/
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,m,k,x;
    cin>>n>>m>>k>>x;
    x--;
    string str;
    cin>>str;
    vector<string>vec(m,"");
    for(int i=0;i<m;i++)
    {
        cin>>vec[i];
        sort(vec[i].begin(),vec[i].end());
    }
    vector<int> pos(m,0);
    int p=m-1;
    while(x>0&&p>=0)
    {
        pos[p]=x%k;
        p--;
        x/=k;
    }
    p=0;
    for(int i=0;i<n;i++)
    {
        if(str[i]=='#')
        {
            str[i]=vec[p][pos[p]];
            p++;
        }
    }
    cout<<str<<"\n";
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 292 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct