# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
60799 | 2018-07-24T17:07:16 Z | alenam0161 | Zalmoxis (BOI18_zalmoxis) | C++17 | 4 ms | 548 KB |
#include <bits/stdc++.h> void fl(); using namespace std; const int N = 1000000+7; int a[N]; stack<int> st; vector<int> ans; void rem(){ while(st.size()>=2){ int z=st.top(); st.pop(); if(z==st.top()){ st.pop(); st.push(z+1); } else{ st.push(z); break; } } } int n,k; void rek(int x){ if(x>0||k<=1){ ans.push_back(x); return; } k--; rek(x-1); rek(x-1); } int main(){ fl(); scanf("%d %d",&n,&k); for(int i=0;i<n;++i){ scanf("%d",a+i); } int s=k; st.push(a[0]); ans.push_back(a[0]); for(int i=1;i<n;++i){ while(a[i]>st.top()){ int x=st.top(); ans.push_back(x); st.push(x); rem(); k--; } ans.push_back(a[i]); st.push(a[i]); rem(); } while(st.size()!=1){ ans.push_back(st.top()); st.push(st.top()); rem(); k--; } int z=st.top(); while(k>0){ ans.push_back(z); z++; k--; st.pop(); st.push(z); if(z>30)break; } if(k>1) rek(st.top()); if(ans.size()<s+n){ assert(0); } for(int i=0;i<s+n;++i){ printf("%d ",ans[i]); } return 0; } void fl(){ freopen("input.txt","r",stdin); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 248 KB | Unexpected end of file - int32 expected |
2 | Incorrect | 2 ms | 356 KB | Unexpected end of file - int32 expected |
3 | Incorrect | 3 ms | 356 KB | Unexpected end of file - int32 expected |
4 | Incorrect | 3 ms | 432 KB | Unexpected end of file - int32 expected |
5 | Incorrect | 3 ms | 508 KB | Unexpected end of file - int32 expected |
6 | Incorrect | 2 ms | 508 KB | Unexpected end of file - int32 expected |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 508 KB | Unexpected end of file - int32 expected |
2 | Incorrect | 2 ms | 508 KB | Unexpected end of file - int32 expected |
3 | Incorrect | 2 ms | 548 KB | Unexpected end of file - int32 expected |
4 | Incorrect | 3 ms | 548 KB | Unexpected end of file - int32 expected |
5 | Incorrect | 3 ms | 548 KB | Unexpected end of file - int32 expected |
6 | Incorrect | 3 ms | 548 KB | Unexpected end of file - int32 expected |
7 | Incorrect | 3 ms | 548 KB | Unexpected end of file - int32 expected |
8 | Incorrect | 3 ms | 548 KB | Unexpected end of file - int32 expected |
9 | Incorrect | 2 ms | 548 KB | Unexpected end of file - int32 expected |
10 | Incorrect | 3 ms | 548 KB | Unexpected end of file - int32 expected |
11 | Incorrect | 4 ms | 548 KB | Unexpected end of file - int32 expected |
12 | Incorrect | 3 ms | 548 KB | Unexpected end of file - int32 expected |
13 | Incorrect | 3 ms | 548 KB | Unexpected end of file - int32 expected |
14 | Incorrect | 3 ms | 548 KB | Unexpected end of file - int32 expected |