# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
750133 | mohammedMonem | Zalmoxis (BOI18_zalmoxis) | C++14 | 3 ms | 720 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
void Run();
int main() {
Run();
int n, k;
std::cin >> n >> k;
std::vector<int> s(n);
for (auto &i: s) {
std::cin >> i;
}
std::pair<int, int> cur = {std::min_element(s.begin(), s.end()) - s.begin(),
std::min_element(s.begin(), s.end()) - s.begin()};
int curI = *std::min_element(s.begin(), s.end());
std::deque<int> ans = {curI};
while (curI < 30) {
if (cur.second < n - 1 && s[cur.second + 1] == curI) {
ans.push_back(curI);
cur.second++, curI++;
}
else if (cur.first > 0 && s[cur.first - 1] == curI){
ans.push_front(curI);
cur.first--, curI++;
}
else {
ans.push_back(curI);
curI++;
}
}
for (const auto &i: ans) {
std::cout << i << ' ';
}
}
void Run() {
std::ios_base::sync_with_stdio(false);
std::cin.tie();
std::cout.tie();
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |