Submission #1112420

# Submission time Handle Problem Language Result Execution time Memory
1112420 2024-11-14T07:36:27 Z vjudge1 Baloni (COCI15_baloni) C++17
0 / 100
2000 ms 11540 KB
#include <bits/stdc++.h>

using namespace std;

int mileh(int n, vector<int>& h) {
    int a = 0;

    while (!h.empty()) {
        int m = h[0];
        a++;

        vector<int> nh;

        bool p = false;
        for (int i = 0; i < h.size(); i++) {
            if (h[i] == m && !p) {
                p = true;
                continue;
            }

            if (p && h[i] < m) {
                m = h[i];
            } else if (h[i] >= m) {
                nh.push_back(h[i]);
            }
        }

        h = nh;
    }

    return a;
}

int main() {
    int n;
    cin >> n;
    vector<int> h(n);

    for (int i = 0; i < n; i++) {
        cin >> h[i];
    }

    cout << mileh(n, h) << endl;

    return 0;
}

Compilation message

baloni.cpp: In function 'int mileh(int, std::vector<int>&)':
baloni.cpp:15:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |         for (int i = 0; i < h.size(); i++) {
      |                         ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Incorrect 1 ms 336 KB Output isn't correct
3 Incorrect 2 ms 336 KB Output isn't correct
4 Incorrect 2 ms 336 KB Output isn't correct
5 Execution timed out 2067 ms 10776 KB Time limit exceeded
6 Execution timed out 2037 ms 11540 KB Time limit exceeded
7 Execution timed out 2058 ms 10308 KB Time limit exceeded
8 Execution timed out 2078 ms 10268 KB Time limit exceeded
9 Execution timed out 2061 ms 10548 KB Time limit exceeded
10 Execution timed out 2075 ms 10808 KB Time limit exceeded