Submission #165020

#TimeUsernameProblemLanguageResultExecution timeMemory
165020Rouge_HugoBaloni (COCI15_baloni)C++14
100 / 100
442 ms7516 KiB
#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 timeMemoryGrader output
Fetching results...