# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
712103 | wenqi | Zalmoxis (BOI18_zalmoxis) | C++17 | 173 ms | 8408 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
// trans rights
#include <bits/extc++.h>
using namespace std;
using ll = long long;
int N, K;
int inp[1000069];
stack<int> f;
vector<pair<int, int>> probes;
void probe(int x)
{
while (f.size() and x == f.top())
{
f.pop();
x++;
}
f.push(x);
}
void curse(int x, int &u)
{
if (x and u)
{
u--;
curse(x - 1, u);
curse(x - 1, u);
}else{
cout << x << ' ';
}
}
int main(int argc, const char *argv[])
{
ios::sync_with_stdio(false);
cin.tie(0);
cin >> N >> K;
for (int i = 0; i <= N; i++)
{
int x = 30;
if (i < N)
cin >> x;
inp[i] = x;
while (f.size() and x > f.top())
{
probes.emplace_back(f.top(), i);
probe(f.top());
}
if (i < N)
probe(x);
}
int lo = K - probes.size();
int ptr = 0;
for (int i = 0; i <= N; i++)
{
while (ptr < probes.size() and probes[ptr].second <= i)
{
curse(probes[ptr].first, lo);
ptr++;
}
if (i < N)
cout << inp[i] << ' ';
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |