제출 #862146

#제출 시각아이디문제언어결과실행 시간메모리
862146iskhakkutbilimZalmoxis (BOI18_zalmoxis)C++17
0 / 100
274 ms262144 KiB
#include <bits/stdc++.h> using namespace std; #define ff first #define ss second #define all(a) a.begin(), a.end() int n, k, cur; vector<pair<int, int> > ans; vector<int> a, all; void f(int x){ if(x < 0) return; if(cur >= n or a[cur] >= x){ if(cur < n && a[cur] == x){ ans.push_back({x, 0}); cur++; }else{ ans.push_back({x, 1}); } }else{ f(x-1); f(x-1); } } void split(int x){ if(!k && !x){ all.push_back(x); }else{ k--; split(x-1); split(x-1); } } main(){ cin >> n >> k; a.resize(n); for(int i = 0;i < n; i++)cin >> a[i]; f(30); k = k - (int)ans.size() + n; for(auto [x, y] : ans){ if(!y){ all.push_back(x); continue; } split(x); } for(int x : all) cout << x << ' '; return 0; }

컴파일 시 표준 에러 (stderr) 메시지

zalmoxis.cpp:35:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   35 | main(){
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...