Submission #541724

#TimeUsernameProblemLanguageResultExecution timeMemory
541724daristyleBaloni (COCI15_baloni)C++11
30 / 100
2093 ms4484 KiB
#include <bits/stdc++.h> using namespace std; int main() { int n, arrows=0, mx=0, r=0, h; cin>>n; int v[n]; for(int i=1; i<=n; ++i){ cin>>v[i]; if(mx<v[i]) mx=v[i]; } while(r!=n){ h=mx; mx=0; arrows++; for(int i=1; i<=n && h; ++i){ if(v[i]==h){ v[i]=0; h--; r++; } if(v[i]>mx) mx=v[i]; } } cout<<arrows; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...