# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1090770 | 2024-09-18T17:54:10 Z | noyancanturk | Zalmoxis (BOI18_zalmoxis) | C++17 | 205 ms | 20408 KB |
#include<bits/stdc++.h> using namespace std; #define pb push_back int main(){ #ifdef Local freopen(".in","r",stdin); freopen(".out","w",stdout); #endif int n,k; cin>>n>>k; int s[n]; for(int i=0;i<n;i++)cin>>s[i]; vector<int>have; vector<int>ans; vector<int>mine; have.pb(s[0]); ans.pb(s[0]); mine.pb(0); for(int i=1;i<n;i++){ int cur=have.back(); have.pop_back(); while(cur<s[i]){ ans.pb(cur); mine.pb(1); k--; cur++; while(have.size()&&cur==have.back()){ have.pop_back(); cur++; } } ans.pb(s[i]); mine.pb(0); if(cur==s[i]){ cur++; while(have.size()&&have.back()==cur){ cur++; have.pop_back(); } have.pb(cur); }else{ have.pb(cur); have.pb(s[i]); } } while(have.back()<30){ int val=have.back(); ans.push_back(val); mine.push_back(1); k--; have.pop_back(); val++; while(have.size()&&val==have.back()){ have.pop_back(); val++; } have.pb(val); } vector<int>realans; for(int i=0;i<ans.size();i++){ if(!mine[i]){ realans.pb(ans[i]); }else{ vector<int>gotten; gotten.pb(ans[i]); while(k&&gotten.size()){ if(gotten.back()==1){ realans.pb(gotten.back()); gotten.pop_back(); }else{ int val=gotten.back(); gotten.pop_back(); gotten.pb(val-1); gotten.pb(val-1); k--; } } for(int i:gotten) realans.pb(i); } } for(int i:realans)cout<<i<<" "; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 205 ms | 20276 KB | Output is correct |
2 | Correct | 163 ms | 20152 KB | Output is correct |
3 | Correct | 199 ms | 20280 KB | Output is correct |
4 | Correct | 160 ms | 20396 KB | Output is correct |
5 | Correct | 155 ms | 20396 KB | Output is correct |
6 | Correct | 150 ms | 20240 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 151 ms | 20252 KB | not a zalsequence |
2 | Correct | 150 ms | 20236 KB | Output is correct |
3 | Correct | 162 ms | 20372 KB | Output is correct |
4 | Incorrect | 157 ms | 20396 KB | not a zalsequence |
5 | Incorrect | 164 ms | 20396 KB | not a zalsequence |
6 | Incorrect | 165 ms | 20256 KB | not a zalsequence |
7 | Incorrect | 150 ms | 20396 KB | not a zalsequence |
8 | Incorrect | 157 ms | 20408 KB | not a zalsequence |
9 | Incorrect | 141 ms | 18608 KB | not a zalsequence |
10 | Correct | 107 ms | 14556 KB | Output is correct |
11 | Incorrect | 113 ms | 14596 KB | not a zalsequence |
12 | Correct | 74 ms | 12264 KB | Output is correct |
13 | Correct | 70 ms | 12244 KB | Output is correct |
14 | Incorrect | 56 ms | 6324 KB | not a zalsequence |