# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
843054 | Elvin_Fritl | Zalmoxis (BOI18_zalmoxis) | C++17 | 170 ms | 8824 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>
using namespace std;
const int N = 505 , inf = 1e9 + 199;
int n,k;
vector<int>v;
void func(int ed)
{
if(ed == 0 || k == 0){
v.push_back(ed);
return;
}
k--;
func(ed - 1);
func(ed - 1);
}
int32_t main()
{
cin>>n>>k;
for(int i=0;i<n;i++){
int ed;
cin>>ed;
if(k > 0){
func(ed);
}
else{
v.push_back(ed);
}
}
for(int i=0;i<v.size();i++){
cout<<v[i]<<" ";
}
}
/*
1 1 2 2 3 3 4 4
1
*/
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |