# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
74147 | admin | Zalmoxis (BOI18_zalmoxis) | C++17 | 415 ms | 62304 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/* lightly tested */
#include <cmath>
#include <cassert>
#include <iostream>
#include <list>
#include <deque>
using namespace std;
int main(){
int n, k;
cin >> n >> k;
deque<int> st;
list<int> res;
list<list<int>::iterator> increasable;
int sum = 0;
for(int i = 0; i <= n; ++i){
int x;
if(i == n) x = 30;
else cin >> x, sum += (1<<x);
while(!st.empty() && st[0] < x){
res.push_back(st[0]);
increasable.push_back(--res.end());
++st[0];
while(st.size() > 1 && st[0] == st[1]){
st.pop_front();
++st[0]; } }
st.push_front(x);
while(st.size() > 1 & st[0] == st[1]){
st.pop_front();
++st[0]; }
if(i != n) res.push_back(x); }
while(res.size() < n+k){
auto it = increasable.front();
increasable.pop_front();
if(*it == 0) continue;
--*it;
increasable.push_back(it);
increasable.push_back(res.insert(it, *it)); }
for(auto x : res) cout << x << ' ';
return 0; }
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |