Submission #777387

# Submission time Handle Problem Language Result Execution time Memory
777387 2023-07-09T07:43:10 Z JhoZzel Baloni (COCI15_baloni) C++14
100 / 100
963 ms 3868 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]) {
                b[j] = 1;
                h--;
            }
        }
        ans++;
    }

    cout << ans << "\n";
    
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 3 ms 212 KB Output is correct
4 Correct 3 ms 212 KB Output is correct
5 Correct 444 ms 3484 KB Output is correct
6 Correct 963 ms 3868 KB Output is correct
7 Correct 875 ms 3244 KB Output is correct
8 Correct 879 ms 3208 KB Output is correct
9 Correct 635 ms 3364 KB Output is correct
10 Correct 873 ms 3492 KB Output is correct