# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
656471 | 2022-11-07T14:55:40 Z | MilosMilutinovic | Zalmoxis (BOI18_zalmoxis) | C++14 | 167 ms | 16420 KB |
#include <bits/stdc++.h> using namespace std; void Push(vector<int>& v) { while (v.size() >= 2) { int sz = (int) v.size(); if (v[sz - 1] == v[sz - 2]) { int x = v[sz - 1]; v.pop_back(); v.pop_back(); v.push_back(x + 1); } else { break; } } } int main() { ios::sync_with_stdio(false); cin.tie(0); int n, k; cin >> n >> k; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } vector<int> stk; vector<pair<int, int>> ans; for (int i = 0; i < n; i++) { while (!stk.empty() && stk.back() < a[i]) { int x = stk.back(); ans.emplace_back(stk.back(), 1); stk.push_back(stk.back()); Push(stk); } ans.emplace_back(a[i], 0); stk.push_back(a[i]); Push(stk); } for (auto& p : ans) { cout << p.first << " "; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 135 ms | 16348 KB | Unexpected end of file - int32 expected |
2 | Incorrect | 137 ms | 16228 KB | Unexpected end of file - int32 expected |
3 | Incorrect | 128 ms | 16280 KB | Unexpected end of file - int32 expected |
4 | Incorrect | 141 ms | 16344 KB | Unexpected end of file - int32 expected |
5 | Incorrect | 126 ms | 16260 KB | Unexpected end of file - int32 expected |
6 | Incorrect | 139 ms | 16224 KB | Unexpected end of file - int32 expected |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 127 ms | 16228 KB | Unexpected end of file - int32 expected |
2 | Correct | 143 ms | 16336 KB | Output is correct |
3 | Incorrect | 125 ms | 16344 KB | Unexpected end of file - int32 expected |
4 | Incorrect | 151 ms | 16320 KB | Unexpected end of file - int32 expected |
5 | Incorrect | 129 ms | 16260 KB | Unexpected end of file - int32 expected |
6 | Incorrect | 124 ms | 16248 KB | Unexpected end of file - int32 expected |
7 | Incorrect | 167 ms | 16304 KB | Unexpected end of file - int32 expected |
8 | Incorrect | 130 ms | 16420 KB | Unexpected end of file - int32 expected |
9 | Incorrect | 153 ms | 14440 KB | Unexpected end of file - int32 expected |
10 | Incorrect | 51 ms | 6540 KB | Unexpected end of file - int32 expected |
11 | Incorrect | 98 ms | 11592 KB | Unexpected end of file - int32 expected |
12 | Incorrect | 1 ms | 212 KB | Unexpected end of file - int32 expected |
13 | Incorrect | 1 ms | 212 KB | Unexpected end of file - int32 expected |
14 | Incorrect | 1 ms | 212 KB | Unexpected end of file - int32 expected |