Submission #468578

#TimeUsernameProblemLanguageResultExecution timeMemory
468578ala2Baloni (COCI15_baloni)C++14
40 / 100
2099 ms10672 KiB
#include <bits/stdc++.h> using namespace std; int a[1000100]; int n; int v[1001000]; int main() { cin>>n; for(int i=0;i<n;i++) { cin>>a[i]; } // int mx=0; int h=0; int ans=0; while(h<n) { int mx=0; for(int i=0;i<n;i++) { if(v[i]) continue; mx=max(mx,a[i]); } int s=mx; for(int i=0;i<n;i++) { if(v[i]) continue; if(a[i]==s) { h++; s--; v[i]=1; } } ans++; //for(int i=0;i<n;i++) // cout<<v[i]<<" "; // cout<<endl; } cout<<ans<<endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...