#include "bits/stdc++.h"
using namespace std;
#define int long long
int k;
vector <pair <int,int>> ans;
vector <int> a;
void f(int v) {
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);
int n, cnt = 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(auto [x, y] : ans) cout << x << ' ';
return 0;
}
Compilation message
zalmoxis.cpp: In function 'int main()':
zalmoxis.cpp:34:9: warning: unused variable 'cnt' [-Wunused-variable]
34 | int n, cnt = 0;
| ^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
106 ms |
26136 KB |
Output is correct |
2 |
Correct |
107 ms |
26056 KB |
Output is correct |
3 |
Correct |
108 ms |
26156 KB |
Output is correct |
4 |
Correct |
121 ms |
27196 KB |
Output is correct |
5 |
Correct |
108 ms |
26408 KB |
Output is correct |
6 |
Correct |
107 ms |
26156 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
109 ms |
26104 KB |
Unexpected end of file - int32 expected |
2 |
Correct |
113 ms |
25988 KB |
Output is correct |
3 |
Incorrect |
118 ms |
25940 KB |
Unexpected end of file - int32 expected |
4 |
Incorrect |
114 ms |
26072 KB |
Unexpected end of file - int32 expected |
5 |
Incorrect |
109 ms |
26408 KB |
Unexpected end of file - int32 expected |
6 |
Incorrect |
108 ms |
26156 KB |
Unexpected end of file - int32 expected |
7 |
Incorrect |
108 ms |
26156 KB |
Unexpected end of file - int32 expected |
8 |
Incorrect |
114 ms |
26688 KB |
Unexpected end of file - int32 expected |
9 |
Incorrect |
101 ms |
26536 KB |
Unexpected end of file - int32 expected |
10 |
Incorrect |
44 ms |
14420 KB |
Unexpected end of file - int32 expected |
11 |
Incorrect |
82 ms |
21404 KB |
Unexpected end of file - int32 expected |
12 |
Incorrect |
0 ms |
344 KB |
Unexpected end of file - int32 expected |
13 |
Incorrect |
0 ms |
344 KB |
Unexpected end of file - int32 expected |
14 |
Incorrect |
0 ms |
348 KB |
Unexpected end of file - int32 expected |