# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
862103 | iskhakkutbilim | Zalmoxis (BOI18_zalmoxis) | C++17 | 198 ms | 32924 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
#define int long long
int n, k;
vector<int> ans;
int cur;
vector<int> a;
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);
}
}
main(){
cin >> n >> k;
a.resize(n);
for(int i = 0;i < n; i++){
cin >> a[i];
}
/*
5 1
28 25 25 26 27
6 1
28 25 25 26 27 29
5 1
28 25 26 27 29
*/
f(30);
if(ans.size() == n + k){
for(int x : ans) cout << x << ' ';
return 0;
}
assert(false);
// if(ans.back() > 1){
// int bk = ans.back();
// ans.pop_back();
// ans.push_back(bk-1);
// ans.push_back(bk-1);
// for(int x : ans) cout << x << ' ';
// }else if(ans[0] > 1){
// int bk = ans[0];
// cout << bk-1 << ' ' << bk-1 << ' ';
// for(int i = 1;i < ans.size(); i++) cout << ans[i] << ' ';
// }else{
// assert(false);
// }
// while(ans.size() < n + k){
// vector<int> have = ans;
// vector<int> merge;
// ans.clear();
// for(int i = 0;i < have.size(); i++){
// if(have[i] > 1){
// f(have[i]-1, 1);
// f(have[i]-1, 1);
// for(int j = 0;j < i; j++) merge.push_back(have[j]);
// for(int x : ans) merge.push_back(x);
// for(int j = i + 1; j < have.size(); j++){
// merge.push_back(have[j]);
// }
// break;
// }
// }
// if(merge.empty()) assert(false);
// ans = merge;
// }
// for(int i = 0;i < ans.size(); i++) cout << ans[i] << ' ';
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |