Submission #382994

#TimeUsernameProblemLanguageResultExecution timeMemory
382994victoriadBaloni (COCI15_baloni)C++14
40 / 100
2097 ms3948 KiB
#include <fstream> #include <cstdio> #include <vector> #include <iostream> #include <algorithm> #include <utility> #include <queue> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(NULL); int n; cin>>n; vector<bool>p(n,false); int x=0; vector<int>a(n); for(int i=0;i<n;i++){ cin>>a[i]; } int y; for(int i=0;i<n;i++){ if(p[i])continue; x++; p[i]=true; y=a[i]-1; for(int j=i+1;j<n;j++){ if(!p[j]&&a[j]==y){ p[j]=true; y--; if(y==0)break; } } } cout<<x; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...