# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
63024 | 2018-07-31T10:37:49 Z | hamzqq9 | Zalmoxis (BOI18_zalmoxis) | C++14 | 313 ms | 14692 KB |
#include<bits/stdc++.h> #define st first #define nd second #define pb push_back #define ppb pop_back #define umax(x,y) x=max(x,y) #define umin(x,y) x=min(x,y) #define ll long long #define ii pair<int,int> #define iii pair<ii,int> #define sz(x) (x.size()) #define orta ((bas+son)>>1) #define all(x) x.begin(),x.end() #define dbgs(x) cerr<<(#x)<<" --> "<<(x)<<" " #define dbg(x) cerr<<(#x)<<" --> "<<(x)<<endl;getchar() #define pw(x) (1<<(x)) #define inf 2000500000 #define MOD 1000000007 #define N 305 #define LOG 20 using namespace std; int n,k,x; stack<int> s; vector<int> ans,cev,seq; int rem; void solve(int x) { if(x==0 || rem==0) { cev.pb(x); return ; } rem--; solve(x-1); solve(x-1); } int main() { // freopen("input.txt","r",stdin); scanf("%d %d",&n,&k); for(int i=1;i<=n+1;i++) { if(i==n+1 && sz(ans)==n+k) break ; if(i!=n+1) {scanf("%d",&x);seq.pb(x);} else x=inf; while((i!=n+1)?(sz(s) && s.top()<x):(sz(s)>1)) { int val=s.top(); ans.pb(val); while(sz(s) && s.top()==val) { s.pop(); val++; } s.push(val); } if(i!=n+1) { int tut=x; while(sz(s) && s.top()==tut) { s.pop(); tut++; } s.push(tut); ans.pb(x); } } rem=n+k-sz(ans); int cur=0; for(int i=0;i<sz(ans);i++) { if(cur<sz(seq) && seq[cur]==ans[i]) { cev.pb(ans[i]); cur++; } else { if(rem) solve(ans[i]); } } int val=s.top(); while(rem>0) { solve(val); val++; } for(auto x:cev) printf("%d ",x); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 230 ms | 14324 KB | Unexpected end of file - int32 expected |
2 | Incorrect | 304 ms | 14444 KB | Unexpected end of file - int32 expected |
3 | Incorrect | 301 ms | 14536 KB | Unexpected end of file - int32 expected |
4 | Incorrect | 256 ms | 14664 KB | Unexpected end of file - int32 expected |
5 | Incorrect | 225 ms | 14664 KB | Unexpected end of file - int32 expected |
6 | Incorrect | 237 ms | 14664 KB | Unexpected end of file - int32 expected |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 246 ms | 14664 KB | Unexpected end of file - int32 expected |
2 | Incorrect | 270 ms | 14664 KB | Unexpected end of file - int32 expected |
3 | Incorrect | 222 ms | 14664 KB | Unexpected end of file - int32 expected |
4 | Incorrect | 244 ms | 14664 KB | Unexpected end of file - int32 expected |
5 | Incorrect | 234 ms | 14664 KB | Unexpected end of file - int32 expected |
6 | Incorrect | 224 ms | 14664 KB | Unexpected end of file - int32 expected |
7 | Incorrect | 270 ms | 14692 KB | Unexpected end of file - int32 expected |
8 | Incorrect | 249 ms | 14692 KB | Unexpected end of file - int32 expected |
9 | Incorrect | 263 ms | 14692 KB | Unexpected end of file - int32 expected |
10 | Incorrect | 136 ms | 14692 KB | Unexpected end of file - int32 expected |
11 | Incorrect | 313 ms | 14692 KB | Unexpected end of file - int32 expected |
12 | Incorrect | 118 ms | 14692 KB | Expected EOF |
13 | Incorrect | 103 ms | 14692 KB | Expected EOF |
14 | Incorrect | 128 ms | 14692 KB | Expected EOF |