# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
510298 | 2022-01-15T00:00:02 Z | SirCovidThe19th | Zalmoxis (BOI18_zalmoxis) | C++17 | 292 ms | 43112 KB |
#include <bits/stdc++.h> using namespace std; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); int n, k; cin >> n >> k; list<int> vals(1, 30); queue<list<int>::iterator> split; auto it = vals.begin(); for (int i = 0; i < n; i++){ int x; cin >> x; while (*it < x) split.push(it++); while (*it > x) (*it)--, it = vals.insert(it, *it); it++; } while (it != vals.end()) split.push(it++); while (vals.size() < n + k){ auto pos = split.front(); split.pop(); (*pos)--; vals.insert(pos, *pos); split.push(pos); split.push(--pos); } for (int i : vals) cout<<i<<" "; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 290 ms | 35652 KB | Output is correct |
2 | Correct | 275 ms | 35700 KB | Output is correct |
3 | Correct | 276 ms | 35744 KB | Output is correct |
4 | Correct | 235 ms | 35684 KB | Output is correct |
5 | Correct | 212 ms | 35704 KB | Output is correct |
6 | Correct | 234 ms | 35708 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 292 ms | 35756 KB | Output is correct |
2 | Correct | 240 ms | 35664 KB | Output is correct |
3 | Correct | 283 ms | 35780 KB | Output is correct |
4 | Correct | 239 ms | 35688 KB | Output is correct |
5 | Correct | 225 ms | 35772 KB | Output is correct |
6 | Correct | 230 ms | 35652 KB | Output is correct |
7 | Correct | 247 ms | 35768 KB | Output is correct |
8 | Correct | 227 ms | 35688 KB | Output is correct |
9 | Correct | 264 ms | 37020 KB | Output is correct |
10 | Correct | 162 ms | 40224 KB | Output is correct |
11 | Correct | 214 ms | 38880 KB | Output is correct |
12 | Correct | 153 ms | 43112 KB | Output is correct |
13 | Correct | 164 ms | 42924 KB | Output is correct |
14 | Correct | 167 ms | 42736 KB | Output is correct |