# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
469033 | ala2 | Baloni (COCI15_baloni) | C++14 | 225 ms | 7392 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 <iostream>
using namespace std;
int a[1001000];
int v[1001000];
int main()
{
int n;
cin>>n;
for(int i=0;i<n;i++)
cin>>a[i];
v[a[0]]=1;
int ans=0;
for(int i=1;i<n;i++)
{
if(v[a[i]+1])
{
v[a[i]+1]--;
v[a[i]]++;
}
else
{
// cout<<" "<<i<<endl;
ans++;
v[a[i]]++;
}
//for(int i=0;i<n;i++)
// cout<<v[i]<<" ";
// cout<<endl;
// cout<<endl;
}
cout<<ans+1<<endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |