Submission #960229

#TimeUsernameProblemLanguageResultExecution timeMemory
960229ezzzayBaloni (COCI15_baloni)C++14
40 / 100
53 ms7152 KiB
#include<bits/stdc++.h> using namespace std; #define int long long #define ff first #define ss second #define pb push_back const int N=3e5+5; int a[N]; bool vis[N]; signed main(){ int n; cin>>n; for(int i=1;i<=n;i++){ cin>>a[i]; } int p=0; int cnt=n; while(cnt>0){ int cur=-1; for(int i=n;i>=1;i--){ if(vis[i]==0){ if(cur==-1){ cur=a[i]; vis[i]=1; cnt--; continue; } if(cur==a[i]-1){ cur=a[i]; vis[i]=1; cnt--; } } } p++; } cout<<p; }
#Verdict Execution timeMemoryGrader output
Fetching results...