# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
468578 | ala2 | Baloni (COCI15_baloni) | C++14 | 2099 ms | 10672 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |