#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
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
77 ms |
4200 KB |
Unexpected end of file - int32 expected |
2 |
Incorrect |
63 ms |
4180 KB |
Unexpected end of file - int32 expected |
3 |
Incorrect |
72 ms |
4180 KB |
Unexpected end of file - int32 expected |
4 |
Incorrect |
66 ms |
4180 KB |
Unexpected end of file - int32 expected |
5 |
Incorrect |
67 ms |
4180 KB |
Unexpected end of file - int32 expected |
6 |
Incorrect |
99 ms |
4180 KB |
Unexpected end of file - int32 expected |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
66 ms |
4200 KB |
Unexpected end of file - int32 expected |
2 |
Incorrect |
68 ms |
4180 KB |
Unexpected end of file - int32 expected |
3 |
Incorrect |
62 ms |
4180 KB |
Unexpected end of file - int32 expected |
4 |
Incorrect |
72 ms |
4192 KB |
Unexpected end of file - int32 expected |
5 |
Incorrect |
70 ms |
4180 KB |
Unexpected end of file - int32 expected |
6 |
Incorrect |
74 ms |
4272 KB |
Unexpected end of file - int32 expected |
7 |
Incorrect |
64 ms |
4180 KB |
Unexpected end of file - int32 expected |
8 |
Incorrect |
64 ms |
4180 KB |
Unexpected end of file - int32 expected |
9 |
Incorrect |
81 ms |
3432 KB |
Unexpected end of file - int32 expected |
10 |
Incorrect |
24 ms |
1492 KB |
Unexpected end of file - int32 expected |
11 |
Incorrect |
39 ms |
2260 KB |
Unexpected end of file - int32 expected |
12 |
Incorrect |
1 ms |
256 KB |
Unexpected end of file - int32 expected |
13 |
Incorrect |
1 ms |
212 KB |
Unexpected end of file - int32 expected |
14 |
Incorrect |
1 ms |
212 KB |
Unexpected end of file - int32 expected |