# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
541739 | nutzu | Baloni (COCI15_baloni) | C++11 | 212 ms | 7116 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;
long long n,i,s=1,x,x1,v[1000001];
bool v1[1000001];
int main()
{
cin>>n;
for(i=1; i<=n; i++)
{
cin>>v[i];
}
for(i=2; i<=n; i++)
{
if(v[i]!=v[i-1]-1)
{
if(v1[v[i]]>0)
{
v1[v[i]]=0;
v1[v[i]-1]=1;
}
else
{
s++;
v1[v[i-1]-1]=1;
}
}
}
cout<<s;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |