#include "bits/stdc++.h"
using namespace std;
#define int long long
int n;
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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1071 ms |
9936 KB |
Time limit exceeded |
2 |
Execution timed out |
1041 ms |
10436 KB |
Time limit exceeded |
3 |
Execution timed out |
1044 ms |
10448 KB |
Time limit exceeded |
4 |
Execution timed out |
1066 ms |
10448 KB |
Time limit exceeded |
5 |
Execution timed out |
1063 ms |
9936 KB |
Time limit exceeded |
6 |
Execution timed out |
1045 ms |
9408 KB |
Time limit exceeded |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1073 ms |
9680 KB |
Time limit exceeded |
2 |
Execution timed out |
1073 ms |
9936 KB |
Time limit exceeded |
3 |
Execution timed out |
1020 ms |
9412 KB |
Time limit exceeded |
4 |
Execution timed out |
1074 ms |
10448 KB |
Time limit exceeded |
5 |
Execution timed out |
1063 ms |
9424 KB |
Time limit exceeded |
6 |
Execution timed out |
1056 ms |
8888 KB |
Time limit exceeded |
7 |
Execution timed out |
1031 ms |
10468 KB |
Time limit exceeded |
8 |
Execution timed out |
1088 ms |
9384 KB |
Time limit exceeded |
9 |
Execution timed out |
1048 ms |
8912 KB |
Time limit exceeded |
10 |
Execution timed out |
1070 ms |
5588 KB |
Time limit exceeded |
11 |
Execution timed out |
1049 ms |
6356 KB |
Time limit exceeded |
12 |
Execution timed out |
1039 ms |
548 KB |
Time limit exceeded |
13 |
Execution timed out |
1042 ms |
344 KB |
Time limit exceeded |
14 |
Incorrect |
0 ms |
348 KB |
Unexpected end of file - int32 expected |