# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
63023 | 2018-07-31T10:36:30 Z | hamzqq9 | Zalmoxis (BOI18_zalmoxis) | C++14 | 1000 ms | 263168 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=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 | 396 ms | 17384 KB | Expected EOF |
2 | Incorrect | 368 ms | 17384 KB | Expected EOF |
3 | Incorrect | 339 ms | 17384 KB | Expected EOF |
4 | Incorrect | 306 ms | 17384 KB | Expected EOF |
5 | Incorrect | 341 ms | 17384 KB | Expected EOF |
6 | Incorrect | 291 ms | 17384 KB | Expected EOF |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1073 ms | 41372 KB | Time limit exceeded |
2 | Incorrect | 633 ms | 41372 KB | Expected EOF |
3 | Incorrect | 459 ms | 41372 KB | Expected EOF |
4 | Execution timed out | 1008 ms | 74452 KB | Time limit exceeded |
5 | Incorrect | 511 ms | 74452 KB | Expected EOF |
6 | Incorrect | 722 ms | 74452 KB | Expected EOF |
7 | Execution timed out | 1058 ms | 74452 KB | Time limit exceeded |
8 | Incorrect | 394 ms | 74452 KB | Expected EOF |
9 | Execution timed out | 1064 ms | 263168 KB | Time limit exceeded |
10 | Runtime error | 152 ms | 263168 KB | Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience. |
11 | Execution timed out | 1059 ms | 263168 KB | Time limit exceeded |
12 | Runtime error | 172 ms | 263168 KB | Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience. |
13 | Runtime error | 147 ms | 263168 KB | Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience. |
14 | Runtime error | 129 ms | 263168 KB | Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience. |