# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
31729 | simotion | Baloni (COCI15_baloni) | C++14 | 116 ms | 9828 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 inp[1000002],n,h[1000002],sum;
int main() {
scanf("%d",&n);
for(int i=0;i<n;i++) scanf("%d",&inp[i]);
sum++,h[inp[n-1]]++;
for(int i=n-2;i>=0;i--) {
if(h[inp[i]-1]) h[inp[i]-1]--;
else sum++;
h[inp[i]]++;
}
printf("%d",sum);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |