# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
862103 | 2023-10-17T14:09:53 Z | iskhakkutbilim | Zalmoxis (BOI18_zalmoxis) | C++17 | 198 ms | 32924 KB |
#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; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 198 ms | 18232 KB | Output is correct |
2 | Correct | 189 ms | 18096 KB | Output is correct |
3 | Correct | 171 ms | 18096 KB | Output is correct |
4 | Correct | 176 ms | 18128 KB | Output is correct |
5 | Correct | 171 ms | 18072 KB | Output is correct |
6 | Correct | 174 ms | 18160 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 133 ms | 32700 KB | Execution killed with signal 6 |
2 | Correct | 176 ms | 18096 KB | Output is correct |
3 | Runtime error | 129 ms | 32444 KB | Execution killed with signal 6 |
4 | Runtime error | 131 ms | 32440 KB | Execution killed with signal 6 |
5 | Runtime error | 142 ms | 32924 KB | Execution killed with signal 6 |
6 | Runtime error | 138 ms | 32452 KB | Execution killed with signal 6 |
7 | Runtime error | 132 ms | 32416 KB | Execution killed with signal 6 |
8 | Runtime error | 132 ms | 32440 KB | Execution killed with signal 6 |
9 | Runtime error | 108 ms | 28288 KB | Execution killed with signal 6 |
10 | Runtime error | 45 ms | 12224 KB | Execution killed with signal 6 |
11 | Runtime error | 72 ms | 22456 KB | Execution killed with signal 6 |
12 | Runtime error | 1 ms | 348 KB | Execution killed with signal 6 |
13 | Runtime error | 0 ms | 348 KB | Execution killed with signal 6 |
14 | Runtime error | 1 ms | 348 KB | Execution killed with signal 6 |