# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
208905 | MertD014 | Tavan (COCI16_tavan) | C++17 | 6 ms | 376 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define pob pop_back
using namespace std;
int n,m,k,x;
string s;
queue<int> q;
int main(){
cin>>n>>m>>k>>x;
cin>>s;
int cl=0;
while(pow(k,cl)<x) cl++;
for(int i=0;i<m-cl;i++) q.push(1);
int clc=cl;
cl=pow(k,cl-1);
for(int i=0;i<clc;i++){
for(int i=1;i<=k+1;i++){
if(i*cl>=x){
q.push(i);
x-=i*cl;
cl/=k;
break;
}
}
}
string ss;
for(int i=0;i<n;i++){
if(s[i]!='#') cout<<s[i];
else{
cin>>ss;
sort(ss.begin(),ss.end());
cout<<ss[q.front()-1];
q.pop();
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |