# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
710567 | ToroTN | Baloni (COCI15_baloni) | C++14 | 196 ms | 7328 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 n,a[1000005],hsh[1000005],cnt=0;
int main()
{
cin >> n;
for(int i=1;i<=n;i++)cin >> a[i];
for(int i=n;i>=1;i--)
{
if(hsh[a[i]-1]==0)
{
++cnt;
}else
{
--hsh[a[i]-1];
}
++hsh[a[i]];
}
printf("%d\n",cnt);
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |