# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
165020 | Rouge_Hugo | Baloni (COCI15_baloni) | C++14 | 442 ms | 7516 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>
#define ll long long
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
int n;
int a[1000009],b[1000009];
int main()
{
cin>>n;
for(int i=0;i<n;i++)cin>>a[i];
for(int i=n-1;i>-1;i--)
{
if (b[a[i]-1]>0)b[a[i]-1]--;
b[a[i]]++;
}
ll sum=0;
for(int i=1;i<1000003;i++)sum+=b[i];
cout<<sum;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |