# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
61907 | 2018-07-27T05:06:14 Z | 김현수(#2139) | Zalmoxis (BOI18_zalmoxis) | C++11 | 350 ms | 10756 KB |
#include<bits/stdc++.h> using namespace std; typedef pair<int,int> pii; int n, k; vector<int> cur; vector<pii> ans; void upd () { while(cur.size() >= 2) { int A = cur.back(); cur.pop_back(); int B = cur.back(); cur.pop_back(); if(A != B) { cur.push_back(B); cur.push_back(A); return; } else cur.push_back(A+1); } } void print (int V) { if(V && k) { k--; print(V-1); print(V-1); } else { printf("%d ",V); return; } } int main() { scanf("%d%d",&n,&k); for(int i=1;i<=n;i++) { int T; scanf("%d",&T); while(!cur.empty() && T > cur.back()) { ans.push_back({cur.back(), 1}); k--; cur.push_back(cur.back()); upd(); } ans.push_back({T, 0}); cur.push_back(T); upd(); } while(cur[0] < 30) { ans.push_back({cur.back(), 1}); k--; cur.push_back(cur.back()); upd(); } for(auto &T : ans) { int A, B; tie(A, B) = T; if(B) print(A); else printf("%d ",A); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 230 ms | 10320 KB | Output is correct |
2 | Correct | 226 ms | 10344 KB | Output is correct |
3 | Correct | 314 ms | 10580 KB | Output is correct |
4 | Correct | 255 ms | 10580 KB | Output is correct |
5 | Correct | 278 ms | 10580 KB | Output is correct |
6 | Correct | 260 ms | 10640 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 291 ms | 10700 KB | Output is correct |
2 | Correct | 224 ms | 10700 KB | Output is correct |
3 | Correct | 268 ms | 10700 KB | Output is correct |
4 | Correct | 272 ms | 10732 KB | Output is correct |
5 | Correct | 287 ms | 10732 KB | Output is correct |
6 | Correct | 350 ms | 10732 KB | Output is correct |
7 | Correct | 316 ms | 10756 KB | Output is correct |
8 | Correct | 332 ms | 10756 KB | Output is correct |
9 | Correct | 295 ms | 10756 KB | Output is correct |
10 | Correct | 227 ms | 10756 KB | Output is correct |
11 | Correct | 191 ms | 10756 KB | Output is correct |
12 | Correct | 133 ms | 10756 KB | Output is correct |
13 | Correct | 105 ms | 10756 KB | Output is correct |
14 | Correct | 106 ms | 10756 KB | Output is correct |