# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
63019 | 2018-07-31T10:00:33 Z | hamzqq9 | Zalmoxis (BOI18_zalmoxis) | C++14 | 338 ms | 11400 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 1000500000 #define MOD 1000000007 #define N 305 #define LOG 20 using namespace std; int n,k,x; stack<int> s; vector<int> ans; 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); 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); } } while(sz(ans)<n+k) { int val=s.top(); s.pop(); ans.pb(val); s.push(val+1); } for(auto x:ans) printf("%d ",x); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 236 ms | 6620 KB | Output is correct |
2 | Correct | 292 ms | 6620 KB | Output is correct |
3 | Correct | 260 ms | 6644 KB | Output is correct |
4 | Correct | 269 ms | 6656 KB | Output is correct |
5 | Correct | 276 ms | 6792 KB | Output is correct |
6 | Correct | 257 ms | 6792 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 223 ms | 6792 KB | not a zalsequence |
2 | Correct | 329 ms | 6792 KB | Output is correct |
3 | Incorrect | 212 ms | 6792 KB | not a zalsequence |
4 | Incorrect | 246 ms | 6792 KB | not a zalsequence |
5 | Incorrect | 197 ms | 6792 KB | not a zalsequence |
6 | Incorrect | 262 ms | 6792 KB | not a zalsequence |
7 | Incorrect | 338 ms | 6852 KB | not a zalsequence |
8 | Incorrect | 291 ms | 6852 KB | not a zalsequence |
9 | Incorrect | 204 ms | 7020 KB | not a zalsequence |
10 | Incorrect | 137 ms | 9336 KB | not a zalsequence |
11 | Incorrect | 206 ms | 9336 KB | not a zalsequence |
12 | Incorrect | 141 ms | 11388 KB | not a zalsequence |
13 | Incorrect | 140 ms | 11400 KB | not a zalsequence |
14 | Incorrect | 117 ms | 11400 KB | not a zalsequence |