이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("avx,avx2,sse,sse2")
#include<bits/stdc++.h>
#define all(x) begin(x), end(x)
using namespace std;
using ll = long long;
int n, k;
vector<int> res;
vector<int> st;
vector<array<int, 2>> aa;
void push(int x) {
while(st.size() && x == st.back()) {
st.pop_back(), x++;
}
st.push_back(x);
}
void uwu(int t) {
while(st.size() && st.back() < t) {
aa.push_back({st.back(), 1});
int x = st.back()+1;
st.pop_back();
push(x);
}
}
void ins(int x, int y) {
if(!y) {res.push_back(x); return;}
if(x > 1 && k) {
k--;
ins(x-1, 1);
ins(x-1, 1);
} else res.push_back(x);
}
int main() {
cin.tie(0)->sync_with_stdio(0);
cin >> n >> k;
st.reserve(n+k);
for(int t, i = 0; i < n; i++) {
cin >> t;
uwu(t);
aa.push_back({t, 0});
push(t);
}
uwu(30);
k = n+k-aa.size();
for(auto [x, y] : aa) ins(x, y);
for(auto i : res) cout << i << " "; cout << endl;
}
컴파일 시 표준 에러 (stderr) 메시지
zalmoxis.cpp: In function 'int main()':
zalmoxis.cpp:46:2: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
46 | for(auto i : res) cout << i << " "; cout << endl;
| ^~~
zalmoxis.cpp:46:38: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
46 | for(auto i : res) cout << i << " "; cout << endl;
| ^~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |