Submission #777386

# Submission time Handle Problem Language Result Execution time Memory
777386 2023-07-09T07:41:44 Z JhoZzel Baloni (COCI15_baloni) C++14
0 / 100
2000 ms 3796 KB
#include <bits/stdc++.h>
using namespace std;

int main() {
    int n; cin >> n;
    vector<int> a(n);
    vector<bool> b(n,0);
    for (int i = 0; i < n; i++) cin >> a[i];
    int ans = 0;
    for (int i = 0; i < n; i++) {
        if (b[i]) continue;
        b[i] = 1;
        int h = a[i] - 1;
        for (int j = i + 1; j < n; j++) {
            if (a[j] == h) {
                b[j] = 1;
                h--;
            }
        }
        ans++;
    }

    cout << ans;
    
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Incorrect 2 ms 212 KB Output isn't correct
3 Incorrect 4 ms 212 KB Output isn't correct
4 Incorrect 6 ms 212 KB Output isn't correct
5 Execution timed out 2078 ms 3412 KB Time limit exceeded
6 Execution timed out 2083 ms 3796 KB Time limit exceeded
7 Execution timed out 2033 ms 3156 KB Time limit exceeded
8 Execution timed out 2081 ms 3156 KB Time limit exceeded
9 Execution timed out 2079 ms 3284 KB Time limit exceeded
10 Execution timed out 2037 ms 3412 KB Time limit exceeded