#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
int n, k;
vector<pair<int, int> > ans;
multiset<int> st;
void f(int x, int depth){
// cout << x << ' ' << depth << '\n';
if(depth> 6) return;
int mn = (st.empty() ? INT_MAX : *st.begin());
if(x > mn){
f(x-1, depth + 1);
f(x-1, depth + 1);
}else{
ans.push_back({x, depth});
if(st.count(x))
st.erase(st.find(x));
}
}
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;
st.insert(x);
}
f(30, 0);
// if(ans.size() != (n + k)){
// cout << "WHAT";
// }else{
for(auto [x, y] : ans) cout << x << ' ';
// }
return 0;
}
Compilation message
zalmoxis.cpp:27:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
27 | main(){
| ^~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
235 ms |
49380 KB |
Unexpected end of file - int32 expected |
2 |
Incorrect |
239 ms |
49392 KB |
Unexpected end of file - int32 expected |
3 |
Incorrect |
243 ms |
49208 KB |
Unexpected end of file - int32 expected |
4 |
Incorrect |
237 ms |
49368 KB |
Unexpected end of file - int32 expected |
5 |
Incorrect |
264 ms |
49492 KB |
Unexpected end of file - int32 expected |
6 |
Incorrect |
236 ms |
49232 KB |
Unexpected end of file - int32 expected |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
245 ms |
49472 KB |
Unexpected end of file - int32 expected |
2 |
Incorrect |
246 ms |
49236 KB |
Unexpected end of file - int32 expected |
3 |
Incorrect |
237 ms |
49300 KB |
Unexpected end of file - int32 expected |
4 |
Incorrect |
235 ms |
49272 KB |
Unexpected end of file - int32 expected |
5 |
Incorrect |
264 ms |
49232 KB |
Unexpected end of file - int32 expected |
6 |
Incorrect |
234 ms |
49360 KB |
Unexpected end of file - int32 expected |
7 |
Incorrect |
236 ms |
49488 KB |
Unexpected end of file - int32 expected |
8 |
Incorrect |
241 ms |
49232 KB |
Unexpected end of file - int32 expected |
9 |
Incorrect |
185 ms |
39504 KB |
Unexpected end of file - int32 expected |
10 |
Incorrect |
60 ms |
14928 KB |
Unexpected end of file - int32 expected |
11 |
Incorrect |
106 ms |
24924 KB |
Unexpected end of file - int32 expected |
12 |
Incorrect |
1 ms |
344 KB |
Unexpected end of file - int32 expected |
13 |
Incorrect |
1 ms |
348 KB |
Unexpected end of file - int32 expected |
14 |
Incorrect |
0 ms |
348 KB |
Unexpected end of file - int32 expected |