#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);
}
// reverse(a.begin(), a.end());
f(30);
for(int x : ans) cout << x << ' ';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1046 ms |
8644 KB |
Time limit exceeded |
2 |
Execution timed out |
1080 ms |
10564 KB |
Time limit exceeded |
3 |
Execution timed out |
1039 ms |
9420 KB |
Time limit exceeded |
4 |
Execution timed out |
1065 ms |
10448 KB |
Time limit exceeded |
5 |
Execution timed out |
1042 ms |
10448 KB |
Time limit exceeded |
6 |
Execution timed out |
1024 ms |
9160 KB |
Time limit exceeded |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1045 ms |
9412 KB |
Time limit exceeded |
2 |
Execution timed out |
1079 ms |
8900 KB |
Time limit exceeded |
3 |
Execution timed out |
1066 ms |
9168 KB |
Time limit exceeded |
4 |
Execution timed out |
1041 ms |
9360 KB |
Time limit exceeded |
5 |
Execution timed out |
1063 ms |
9680 KB |
Time limit exceeded |
6 |
Execution timed out |
1035 ms |
10448 KB |
Time limit exceeded |
7 |
Execution timed out |
1061 ms |
9036 KB |
Time limit exceeded |
8 |
Execution timed out |
1077 ms |
8904 KB |
Time limit exceeded |
9 |
Execution timed out |
1077 ms |
9936 KB |
Time limit exceeded |
10 |
Execution timed out |
1057 ms |
6612 KB |
Time limit exceeded |
11 |
Execution timed out |
1060 ms |
5076 KB |
Time limit exceeded |
12 |
Execution timed out |
1022 ms |
344 KB |
Time limit exceeded |
13 |
Execution timed out |
1022 ms |
344 KB |
Time limit exceeded |
14 |
Incorrect |
1 ms |
344 KB |
Unexpected end of file - int32 expected |