# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
61906 | 2018-07-27T05:05:02 Z | alex(#2140) | Zalmoxis (BOI18_zalmoxis) | C++11 | 1000 ms | 65492 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) { it->l.splice_after(it->l.before_begin(), 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); } } r.reverse(); for(auto it = r.begin(); it != r.end(); it++) printf("%d ", abs(*it)); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1026 ms | 65016 KB | Time limit exceeded |
2 | Execution timed out | 1006 ms | 65232 KB | Time limit exceeded |
3 | Correct | 946 ms | 65384 KB | Output is correct |
4 | Correct | 897 ms | 65456 KB | Output is correct |
5 | Execution timed out | 1018 ms | 65456 KB | Time limit exceeded |
6 | Execution timed out | 1063 ms | 65456 KB | Time limit exceeded |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1026 ms | 65456 KB | Time limit exceeded |
2 | Execution timed out | 1026 ms | 65456 KB | Time limit exceeded |
3 | Execution timed out | 1086 ms | 65456 KB | Time limit exceeded |
4 | Correct | 982 ms | 65456 KB | Output is correct |
5 | Correct | 995 ms | 65492 KB | Output is correct |
6 | Execution timed out | 1020 ms | 65492 KB | Time limit exceeded |
7 | Correct | 924 ms | 65492 KB | Output is correct |
8 | Execution timed out | 1012 ms | 65492 KB | Time limit exceeded |
9 | Execution timed out | 1049 ms | 65492 KB | Time limit exceeded |
10 | Correct | 646 ms | 65492 KB | Output is correct |
11 | Correct | 912 ms | 65492 KB | Output is correct |
12 | Correct | 196 ms | 65492 KB | Output is correct |
13 | Correct | 186 ms | 65492 KB | Output is correct |
14 | Correct | 225 ms | 65492 KB | Output is correct |