# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
668201 | 2022-12-03T08:54:40 Z | 1zaid1 | Zalmoxis (BOI18_zalmoxis) | C++17 | 564 ms | 96412 KB |
#include <bits/stdc++.h> using namespace std; #define int long long #define endl '\n' const int M = 3e5+10; signed main() { cin.tie(0)->sync_with_stdio(0); int n, k; cin >> n >> k; vector<int> v(n), v1; for (int &i:v) cin >> i; vector<int> x; for (int i:v) x.push_back(i); map<int, int> vis; reverse(v.begin(), v.end()); vector<int> st; st.push_back(v.back()); v1 = {v.back()}; v.pop_back(); while (st.back() != 30) { if (v.empty()) { for (int i = st.back(); i < 30; i++) { vis[v1.size()] = true; v1.push_back(i); } break; } else { int h = v.back(); int w = st.back(); if (h == w) { v1.push_back(h); v.pop_back(); while (st.size() && h == w) { h = w+1; st.pop_back(); if (st.size()) w = st.back(); } st.push_back(h); } else if (h < w) { v.pop_back(); st.push_back(h); v1.push_back(h); } else { v.push_back(w); } } } swap(v, x); int j = 0; for (int i = 0; i < v.size(); i++) { while (v[i] != v1[j]) { vis[j] = 1, j++; } j++; } while (j < v1.size()) vis[j++] = true; vector<int> ans; for (int i = 0; i < v1.size(); i++) { ans.push_back(v1[i]); k -= vis[i]; if (vis[i]&&k>0) { while (ans.back()>0 && k > 0) { k--; ans.back()--; ans.push_back(ans.back()); } } // cout << k << endl; } // for (int j=0;j<v1.size();j++) cout << vis[j]; cout << endl; // for (int i:v) cout << i << ' '; cout << endl; // for (int i:v1) cout << i << ' '; cout << endl; for (int i:ans) cout << i << ' '; cout << endl; return 0; } /* 5 1 29 27 25 25 28 1 5 29 */
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 514 ms | 96400 KB | Expected EOF |
2 | Incorrect | 525 ms | 96380 KB | Expected EOF |
3 | Incorrect | 515 ms | 96292 KB | Expected EOF |
4 | Incorrect | 524 ms | 96296 KB | Expected EOF |
5 | Incorrect | 530 ms | 96400 KB | Expected EOF |
6 | Incorrect | 518 ms | 96264 KB | Expected EOF |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 564 ms | 96260 KB | Expected EOF |
2 | Incorrect | 373 ms | 96304 KB | Expected EOF |
3 | Incorrect | 363 ms | 96280 KB | Expected EOF |
4 | Incorrect | 495 ms | 96296 KB | Expected EOF |
5 | Incorrect | 504 ms | 96264 KB | Expected EOF |
6 | Incorrect | 528 ms | 96280 KB | Expected EOF |
7 | Incorrect | 528 ms | 96412 KB | Expected EOF |
8 | Incorrect | 521 ms | 96280 KB | Expected EOF |
9 | Incorrect | 417 ms | 92356 KB | Expected EOF |
10 | Incorrect | 223 ms | 45420 KB | Expected EOF |
11 | Incorrect | 327 ms | 70400 KB | Expected EOF |
12 | Incorrect | 0 ms | 212 KB | Unexpected end of file - int32 expected |
13 | Incorrect | 0 ms | 212 KB | Unexpected end of file - int32 expected |
14 | Incorrect | 0 ms | 212 KB | Unexpected end of file - int32 expected |