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 = 1e6 + 66;
int n, k, v[N], ind = 0;
vector<int> res;
void func(int x){
if(ind > x || v[ind] > x)
{
res.push_back(x);
return;
}
if(v[ind] == x)
{
ind++;
res.push_back(x);
return;
}
func(x - 1);
func(x - 1);
}
int32_t main()
{
int n,k;
cin>>n>>k;
for(int i=0;i<n;i++){
cin>>v[i];
}
func(30);
for(auto &i:res){
cout<<i<<" ";
}
}
/*
1 1 2 2 3 3 4 4
1
*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |