# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
544697 | AbdelmagedNour | Baloni (COCI15_baloni) | C++17 | 75 ms | 7304 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>
#pragma GCC optimize("Ofast")
using namespace std;
int a[1000005],freq[1000005];
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n;
cin>>n;
for(int i=0;i<n;i++)cin>>a[i];
int res=0;
for(int i=n-1;i>=0;i--){
freq[a[i]]++;
if(freq[a[i]-1])freq[a[i]-1]--;
else res++;
}
cout<<res;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |