# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
63020 | 2018-07-31T10:09:30 Z | hamzqq9 | Zalmoxis (BOI18_zalmoxis) | C++14 | 336 ms | 11484 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; 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); } } assert(sz(s)==1); 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 | 336 ms | 6492 KB | Output is correct |
2 | Correct | 249 ms | 6620 KB | Output is correct |
3 | Correct | 203 ms | 6620 KB | Output is correct |
4 | Correct | 249 ms | 6620 KB | Output is correct |
5 | Correct | 242 ms | 6620 KB | Output is correct |
6 | Correct | 196 ms | 6672 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 251 ms | 6672 KB | not a zalsequence |
2 | Correct | 226 ms | 6684 KB | Output is correct |
3 | Incorrect | 332 ms | 6704 KB | not a zalsequence |
4 | Incorrect | 232 ms | 6704 KB | not a zalsequence |
5 | Incorrect | 240 ms | 6704 KB | not a zalsequence |
6 | Incorrect | 216 ms | 6704 KB | not a zalsequence |
7 | Incorrect | 215 ms | 6704 KB | not a zalsequence |
8 | Incorrect | 209 ms | 6704 KB | not a zalsequence |
9 | Incorrect | 245 ms | 6960 KB | not a zalsequence |
10 | Incorrect | 162 ms | 9264 KB | not a zalsequence |
11 | Incorrect | 187 ms | 9264 KB | not a zalsequence |
12 | Incorrect | 159 ms | 11356 KB | not a zalsequence |
13 | Incorrect | 121 ms | 11484 KB | not a zalsequence |
14 | Incorrect | 120 ms | 11484 KB | not a zalsequence |