# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
131925 |
2019-07-18T04:30:32 Z |
maruii |
Zalmoxis (BOI18_zalmoxis) |
C++14 |
|
399 ms |
262148 KB |
#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
int A[1000006];
void f(int x, int m) {
if (m == 1) {
cout << x << ' ';
return;
}
f(x - 1, m / 2);
f(x - 1, m - m / 2);
}
int main() {
ios_base::sync_with_stdio(0), cin.tie(0);
int N, K; cin >> N >> K;
for (int i = 1; i <= N; ++i) cin >> A[i];
vector<int> v;
vector<pii> ans;
for (int i = 1; i <= N; ++i) {
while (v.size() && v.back() < A[i]) {
ans.push_back(pii(v.back(), 1));
v.push_back(v.back());
while (v.size() > 1 && v.back() == v[v.size() - 2]) {
v.pop_back();
++v.back();
}
}
ans.push_back(pii(A[i], 0));
v.push_back(A[i]);
while (v.size() > 1 && v.back() == v[v.size() - 2]) {
v.pop_back();
++v.back();
}
}
for (int i = v.back(); i < 30; ++i) ans.push_back(pii(i, 1));
int j = N + K - ans.size();
for (auto i : ans) {
if (i.second && j) {
if (j >= (1 << i.first) - 1) {
j -= (1 << i.first) - 1;
for (int k = (1 << i.first); k; --k) cout << 0 << ' ';
}
else f(i.first, j + 1), j = 0;
}
else cout << i.first << ' ';
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
399 ms |
262148 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
2 |
Runtime error |
386 ms |
262148 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
3 |
Runtime error |
395 ms |
262144 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
4 |
Runtime error |
385 ms |
262144 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
5 |
Runtime error |
384 ms |
262144 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
6 |
Runtime error |
381 ms |
262148 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
175 ms |
14292 KB |
not a zalsequence |
2 |
Correct |
171 ms |
14292 KB |
Output is correct |
3 |
Correct |
171 ms |
14420 KB |
Output is correct |
4 |
Incorrect |
171 ms |
14420 KB |
not a zalsequence |
5 |
Incorrect |
171 ms |
14292 KB |
not a zalsequence |
6 |
Incorrect |
174 ms |
14468 KB |
not a zalsequence |
7 |
Incorrect |
172 ms |
14292 KB |
not a zalsequence |
8 |
Incorrect |
178 ms |
14424 KB |
not a zalsequence |
9 |
Incorrect |
162 ms |
13008 KB |
not a zalsequence |
10 |
Incorrect |
111 ms |
7136 KB |
not a zalsequence |
11 |
Incorrect |
132 ms |
10600 KB |
not a zalsequence |
12 |
Incorrect |
75 ms |
2296 KB |
not a zalsequence |
13 |
Incorrect |
76 ms |
2296 KB |
not a zalsequence |
14 |
Correct |
74 ms |
2296 KB |
Output is correct |