Submission #750127

# Submission time Handle Problem Language Result Execution time Memory
750127 2023-05-29T07:02:06 Z mohammedMonem Zalmoxis (BOI18_zalmoxis) C++17
0 / 100
75 ms 4180 KB
#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();
    if (fopen("input.txt", "r")) {
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    }
}

Compilation message

zalmoxis.cpp: In function 'void Run()':
zalmoxis.cpp:42:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   42 |         freopen("input.txt", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
zalmoxis.cpp:43:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   43 |         freopen("output.txt", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 57 ms 4180 KB Unexpected end of file - int32 expected
2 Incorrect 59 ms 4180 KB Unexpected end of file - int32 expected
3 Incorrect 57 ms 4180 KB Unexpected end of file - int32 expected
4 Incorrect 60 ms 4180 KB Unexpected end of file - int32 expected
5 Incorrect 66 ms 4180 KB Unexpected end of file - int32 expected
6 Incorrect 75 ms 4180 KB Unexpected end of file - int32 expected
# Verdict Execution time Memory Grader output
1 Incorrect 64 ms 4180 KB Unexpected end of file - int32 expected
2 Incorrect 55 ms 4180 KB Unexpected end of file - int32 expected
3 Incorrect 60 ms 4180 KB Unexpected end of file - int32 expected
4 Incorrect 59 ms 4180 KB Unexpected end of file - int32 expected
5 Incorrect 60 ms 4180 KB Unexpected end of file - int32 expected
6 Incorrect 62 ms 4180 KB Unexpected end of file - int32 expected
7 Incorrect 57 ms 4180 KB Unexpected end of file - int32 expected
8 Incorrect 60 ms 4180 KB Unexpected end of file - int32 expected
9 Incorrect 45 ms 3412 KB Unexpected end of file - int32 expected
10 Incorrect 17 ms 1492 KB Unexpected end of file - int32 expected
11 Incorrect 28 ms 2260 KB Unexpected end of file - int32 expected
12 Incorrect 0 ms 212 KB Unexpected end of file - int32 expected
13 Incorrect 1 ms 212 KB Unexpected end of file - int32 expected
14 Incorrect 0 ms 212 KB Unexpected end of file - int32 expected