# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
81161 | FutymyClone | Baloni (COCI15_baloni) | C++14 | 183 ms | 32940 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;
const int N = 1e6 + 5;
int n, a[N], ptr[N], ans = 0;
bool used[N];
vector <int> pos[N];
int main(){
scanf("%d", &n);
for (int i = 1; i <= n; i++) scanf("%d", &a[i]), pos[a[i]].push_back(i);
for (int i = 1; i <= n; i++) {
if (used[i]) continue;
ans++;
int pt = a[i];
while (pt >= 1) {
if (ptr[pt] >= pos[pt].size()) break;
used[pos[pt][ptr[pt]++]] = true;
pt--;
}
}
printf("%d", ans);
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |