#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_front(curI);
cur.second++, curI++;
}
else if (cur.first > 0 && s[cur.first - 1] == curI){
ans.push_back(curI);
cur.first++, curI++;
}
else {
ans.push_back(curI);
curI++;
}
}
std::reverse(ans.begin(), ans.end());
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
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
65 ms |
4180 KB |
Unexpected end of file - int32 expected |
2 |
Incorrect |
61 ms |
4180 KB |
Unexpected end of file - int32 expected |
3 |
Incorrect |
83 ms |
4180 KB |
Unexpected end of file - int32 expected |
4 |
Incorrect |
59 ms |
4180 KB |
Unexpected end of file - int32 expected |
5 |
Incorrect |
61 ms |
4180 KB |
Unexpected end of file - int32 expected |
6 |
Incorrect |
61 ms |
4180 KB |
Unexpected end of file - int32 expected |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
69 ms |
4180 KB |
Unexpected end of file - int32 expected |
2 |
Incorrect |
61 ms |
4180 KB |
Unexpected end of file - int32 expected |
3 |
Incorrect |
58 ms |
4180 KB |
Unexpected end of file - int32 expected |
4 |
Incorrect |
62 ms |
4180 KB |
Unexpected end of file - int32 expected |
5 |
Incorrect |
62 ms |
4180 KB |
Unexpected end of file - int32 expected |
6 |
Incorrect |
60 ms |
4180 KB |
Unexpected end of file - int32 expected |
7 |
Incorrect |
59 ms |
4180 KB |
Unexpected end of file - int32 expected |
8 |
Incorrect |
61 ms |
4180 KB |
Unexpected end of file - int32 expected |
9 |
Incorrect |
51 ms |
3412 KB |
Unexpected end of file - int32 expected |
10 |
Incorrect |
19 ms |
1492 KB |
Unexpected end of file - int32 expected |
11 |
Incorrect |
29 ms |
2260 KB |
Unexpected end of file - int32 expected |
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 |