# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
74147 | 2018-08-30T09:56:54 Z | admin | Zalmoxis (BOI18_zalmoxis) | C++17 | 415 ms | 62304 KB |
/* lightly tested */ #include <cmath> #include <cassert> #include <iostream> #include <list> #include <deque> using namespace std; int main(){ int n, k; cin >> n >> k; deque<int> st; list<int> res; list<list<int>::iterator> increasable; int sum = 0; for(int i = 0; i <= n; ++i){ int x; if(i == n) x = 30; else cin >> x, sum += (1<<x); while(!st.empty() && st[0] < x){ res.push_back(st[0]); increasable.push_back(--res.end()); ++st[0]; while(st.size() > 1 && st[0] == st[1]){ st.pop_front(); ++st[0]; } } st.push_front(x); while(st.size() > 1 & st[0] == st[1]){ st.pop_front(); ++st[0]; } if(i != n) res.push_back(x); } while(res.size() < n+k){ auto it = increasable.front(); increasable.pop_front(); if(*it == 0) continue; --*it; increasable.push_back(it); increasable.push_back(res.insert(it, *it)); } for(auto x : res) cout << x << ' '; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 383 ms | 33772 KB | Output is correct |
2 | Correct | 383 ms | 33796 KB | Output is correct |
3 | Correct | 387 ms | 33876 KB | Output is correct |
4 | Correct | 379 ms | 33876 KB | Output is correct |
5 | Correct | 406 ms | 33884 KB | Output is correct |
6 | Correct | 392 ms | 33884 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 381 ms | 34028 KB | Output is correct |
2 | Correct | 389 ms | 34052 KB | Output is correct |
3 | Correct | 395 ms | 34128 KB | Output is correct |
4 | Correct | 389 ms | 34128 KB | Output is correct |
5 | Correct | 403 ms | 34128 KB | Output is correct |
6 | Correct | 415 ms | 34128 KB | Output is correct |
7 | Correct | 388 ms | 34128 KB | Output is correct |
8 | Correct | 413 ms | 34128 KB | Output is correct |
9 | Correct | 367 ms | 40032 KB | Output is correct |
10 | Correct | 304 ms | 53728 KB | Output is correct |
11 | Correct | 333 ms | 53728 KB | Output is correct |
12 | Correct | 280 ms | 62304 KB | Output is correct |
13 | Correct | 278 ms | 62304 KB | Output is correct |
14 | Correct | 286 ms | 62304 KB | Output is correct |