# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
64501 | 2018-08-04T16:38:54 Z | mirbek01 | Zalmoxis (BOI18_zalmoxis) | C++17 | 360 ms | 11332 KB |
# include <bits/stdc++.h> using namespace std; const int N = 1e6 + 2; int n, k, a[N]; deque <int> dq; vector < pair <int, int> > vec; int main(){ scanf("%d %d", &n, &k); for(int i = 1; i <= n; i ++) scanf("%d", &a[i]); dq.push_back(30); int id = 1; while(id <= n){ int v = dq.front(); dq.pop_front(); if(v == a[id]){ id ++; } else if(v < a[id]){ vec.push_back({id - 1, v}); } else { v --; if(v < 0) continue; dq.push_front(v); dq.push_front(v); } } for(int i = 0; i < dq.size(); i ++) vec.push_back({id, dq[i]}); k -= vec.size(); int pos = 0; for(int i = 1; i <= n; i ++){ cout << a[i] << " "; if(pos < vec.size() && vec[pos].first <= i){ vector <int> vv; dq.clear(); dq.push_back(vec[pos ++].second); while(k > 0){ int v = dq.front(); dq.pop_front(); v --; if(v >= 0){ dq.push_front(v); dq.push_front(v); } else vv.push_back(0); k --; } for(int j = 0; j < dq.size(); j ++) vv.push_back(dq[j]); for(int j = 0; j < vv.size(); j ++) cout << vv[j] << " "; } } if(pos < vec.size()){ vector <int> vv; dq.clear(); dq.push_back(vec[pos ++].second); while(k > 0){ int v = dq.front(); dq.pop_front(); v --; if(v >= 0){ dq.push_front(v); dq.push_front(v); } else vv.push_back(0); k --; } for(int j = 0; j < dq.size(); j ++) vv.push_back(dq[j]); for(int j = 0; j < vv.size(); j ++) cout << vv[j] << " "; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 270 ms | 6404 KB | Output is correct |
2 | Correct | 240 ms | 6412 KB | Output is correct |
3 | Correct | 318 ms | 6508 KB | Output is correct |
4 | Correct | 270 ms | 6556 KB | Output is correct |
5 | Correct | 281 ms | 6628 KB | Output is correct |
6 | Correct | 299 ms | 6628 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 252 ms | 6628 KB | Unexpected end of file - int32 expected |
2 | Correct | 360 ms | 6628 KB | Output is correct |
3 | Runtime error | 129 ms | 8572 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
4 | Incorrect | 239 ms | 10692 KB | Unexpected end of file - int32 expected |
5 | Incorrect | 283 ms | 10724 KB | Unexpected end of file - int32 expected |
6 | Incorrect | 305 ms | 10724 KB | Unexpected end of file - int32 expected |
7 | Incorrect | 224 ms | 10740 KB | Unexpected end of file - int32 expected |
8 | Incorrect | 292 ms | 10740 KB | Unexpected end of file - int32 expected |
9 | Incorrect | 283 ms | 11332 KB | Unexpected end of file - int32 expected |
10 | Incorrect | 159 ms | 11332 KB | Unexpected end of file - int32 expected |
11 | Incorrect | 257 ms | 11332 KB | Unexpected end of file - int32 expected |
12 | Runtime error | 20 ms | 11332 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
13 | Runtime error | 19 ms | 11332 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
14 | Runtime error | 22 ms | 11332 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |