Submission #469033

#TimeUsernameProblemLanguageResultExecution timeMemory
469033ala2Baloni (COCI15_baloni)C++14
100 / 100
225 ms7392 KiB
#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 timeMemoryGrader output
Fetching results...