# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
61905 | 2018-07-27T05:01:21 Z | alex(#2140) | Zalmoxis (BOI18_zalmoxis) | C++11 | 1000 ms | 63316 KB |
#include <cstdio> #include <cstdlib> #include <cstring> #include <cassert> #include <iostream> #include <algorithm> #include <string> #include <vector> #include <list> #include <stack> #include <queue> #include <deque> #include <set> #include <map> #include <tuple> #include <iterator> #include <forward_list> using namespace std; struct node { int x; forward_list<int> l; }; forward_list<node> a; int main() { //freopen("in", "r", stdin); //freopen("out", "w", stdout); int n, k, i; scanf("%d%d", &n, &k); for(i = 0; i < n; i++) { int x; scanf("%d", &x); a.push_front({ x, forward_list<int>(1, x) }); } a.reverse(); int c = 0; for(i = 0; i < 30; i++) { for(auto it = a.begin(); it != a.end(); it++) { if(abs(it->x) != i) continue; auto it2 = next(it); if(it2 != a.end() && abs(it2->x) == i) { it2->l.splice_after(it2->l.before_begin(), it->l); it->l = it2->l; a.erase_after(it); } else { c++; it->l.push_front(-abs(it->x)); } if(it->x > 0) (it->x)++; else (it->x)--; } } auto &r = a.front().l; for(i = abs(a.front().x); i < 30; i++) { c++; r.push_front(-i); } for(auto it = r.begin(); it != r.end(); it++) { while(*it < 0 && c < k) { c++; (*it)++; r.insert_after(it, *it); } } for(auto it = r.begin(); it != r.end(); it++) printf("%d ", abs(*it)); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1092 ms | 62972 KB | Time limit exceeded |
2 | Execution timed out | 1078 ms | 62972 KB | Time limit exceeded |
3 | Execution timed out | 1082 ms | 63036 KB | Time limit exceeded |
4 | Execution timed out | 1087 ms | 63092 KB | Time limit exceeded |
5 | Execution timed out | 1071 ms | 63316 KB | Time limit exceeded |
6 | Execution timed out | 1069 ms | 63316 KB | Time limit exceeded |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1061 ms | 63316 KB | Time limit exceeded |
2 | Execution timed out | 1081 ms | 63316 KB | Time limit exceeded |
3 | Execution timed out | 1100 ms | 63316 KB | Time limit exceeded |
4 | Execution timed out | 1079 ms | 63316 KB | Time limit exceeded |
5 | Execution timed out | 1061 ms | 63316 KB | Time limit exceeded |
6 | Execution timed out | 1084 ms | 63316 KB | Time limit exceeded |
7 | Execution timed out | 1088 ms | 63316 KB | Time limit exceeded |
8 | Execution timed out | 1082 ms | 63316 KB | Time limit exceeded |
9 | Execution timed out | 1067 ms | 63316 KB | Time limit exceeded |
10 | Execution timed out | 1077 ms | 63316 KB | Time limit exceeded |
11 | Execution timed out | 1075 ms | 63316 KB | Time limit exceeded |
12 | Correct | 349 ms | 63316 KB | Output is correct |
13 | Correct | 191 ms | 63316 KB | Output is correct |
14 | Correct | 210 ms | 63316 KB | Output is correct |