#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 time |
Memory |
Grader output |
1 |
Correct |
2 ms |
212 KB |
Output is correct |
2 |
Execution timed out |
2091 ms |
212 KB |
Time limit exceeded |
3 |
Execution timed out |
2085 ms |
212 KB |
Time limit exceeded |
4 |
Execution timed out |
2093 ms |
212 KB |
Time limit exceeded |
5 |
Correct |
1272 ms |
4144 KB |
Output is correct |
6 |
Execution timed out |
2023 ms |
4484 KB |
Time limit exceeded |
7 |
Execution timed out |
2039 ms |
3740 KB |
Time limit exceeded |
8 |
Execution timed out |
2029 ms |
3676 KB |
Time limit exceeded |
9 |
Correct |
1862 ms |
4024 KB |
Output is correct |
10 |
Execution timed out |
2076 ms |
4076 KB |
Time limit exceeded |