#include "bits/stdc++.h"
using namespace std;
#define int long long
int n, cnt;
int k;
vector <int> ans;
vector <int> a;
int cur;
void f(int x) {
if(x < 0) return;
if(cur >= n or a[cur] >= x){
ans.push_back(x);
if(cur < n && a[cur] == x) cur++;
}else{
f(x-1);
f(x-1);
}
//// if(a.size() == 0) {
//// ans.push_back({v, 1});
//// return;
//// }
//// if(v == a.back()) {
//// ans.push_back({v,0});
//// a.pop_back();
//// return;
//// }
//// if(a.back() > v) {
//// ans.push_back({v,1});
//// return;
//// }
// f(v-1);
// f(v-1);
}
signed main () {
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin >> n >> k;
for(int i = 0; i < n; i ++) {
int x;
cin >> x;
a.push_back(x);
}
cur = 0;
// reverse(a.begin(), a.end());
f(30);
for(int x : ans) cout << x << ' ';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
108 ms |
23472 KB |
Output is correct |
2 |
Correct |
110 ms |
23740 KB |
Output is correct |
3 |
Correct |
105 ms |
22192 KB |
Output is correct |
4 |
Correct |
110 ms |
22968 KB |
Output is correct |
5 |
Correct |
107 ms |
23296 KB |
Output is correct |
6 |
Correct |
105 ms |
23480 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
105 ms |
22736 KB |
Unexpected end of file - int32 expected |
2 |
Correct |
122 ms |
22252 KB |
Output is correct |
3 |
Incorrect |
105 ms |
22716 KB |
Unexpected end of file - int32 expected |
4 |
Incorrect |
107 ms |
22964 KB |
Unexpected end of file - int32 expected |
5 |
Incorrect |
110 ms |
21868 KB |
Unexpected end of file - int32 expected |
6 |
Incorrect |
104 ms |
22196 KB |
Unexpected end of file - int32 expected |
7 |
Incorrect |
105 ms |
23224 KB |
Unexpected end of file - int32 expected |
8 |
Incorrect |
107 ms |
22448 KB |
Unexpected end of file - int32 expected |
9 |
Incorrect |
93 ms |
21684 KB |
Unexpected end of file - int32 expected |
10 |
Incorrect |
51 ms |
12136 KB |
Unexpected end of file - int32 expected |
11 |
Incorrect |
66 ms |
15164 KB |
Unexpected end of file - int32 expected |
12 |
Incorrect |
0 ms |
348 KB |
Unexpected end of file - int32 expected |
13 |
Incorrect |
0 ms |
344 KB |
Unexpected end of file - int32 expected |
14 |
Incorrect |
0 ms |
344 KB |
Unexpected end of file - int32 expected |