# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
777386 | JhoZzel | Baloni (COCI15_baloni) | C++14 | 2083 ms | 3796 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 |
---|---|---|---|---|
Fetching results... |