#include <bits/stdc++.h>
void Run();
int main() {
Run();
std::cout << "29 27 25 25 26 28";
return 0;
int n, k;
std::cin >> n >> k;
std::vector<int> s(n);
for (auto &i: s) {
std::cin >> i;
}
int minI = 0;
for (int i = 0; i < n; ++i) {
minI = s[i] < s[minI] ? i : minI;
}
std::pair<int, int> cur = {minI, minI};
int curI = s[minI];
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
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Unexpected end of file - int32 expected |
2 |
Incorrect |
0 ms |
212 KB |
Unexpected end of file - int32 expected |
3 |
Incorrect |
0 ms |
212 KB |
Unexpected end of file - int32 expected |
4 |
Incorrect |
0 ms |
212 KB |
Unexpected end of file - int32 expected |
5 |
Incorrect |
0 ms |
212 KB |
Unexpected end of file - int32 expected |
6 |
Incorrect |
1 ms |
212 KB |
Unexpected end of file - int32 expected |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Unexpected end of file - int32 expected |
2 |
Incorrect |
1 ms |
212 KB |
Unexpected end of file - int32 expected |
3 |
Incorrect |
1 ms |
212 KB |
Unexpected end of file - int32 expected |
4 |
Incorrect |
0 ms |
212 KB |
Unexpected end of file - int32 expected |
5 |
Incorrect |
0 ms |
212 KB |
Unexpected end of file - int32 expected |
6 |
Incorrect |
1 ms |
212 KB |
Unexpected end of file - int32 expected |
7 |
Incorrect |
0 ms |
212 KB |
Unexpected end of file - int32 expected |
8 |
Incorrect |
0 ms |
212 KB |
Unexpected end of file - int32 expected |
9 |
Incorrect |
0 ms |
212 KB |
Unexpected end of file - int32 expected |
10 |
Incorrect |
0 ms |
212 KB |
Unexpected end of file - int32 expected |
11 |
Incorrect |
0 ms |
212 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 |