#include <bits/stdc++.h>
#include <cstdint>
using namespace std;
#define int long long
int n,ok,sum=0,eksi,ilk=0;
int32_t main() {
cin>>n;
eksi=n;
int arr[n];
for(int i=0;i<n;i++){
cin>>arr[i];
}
while(eksi>0){
sum++;
ok=arr[ilk];
ilk=0;
for(int i=0;i<n;i++){
if(ok==arr[i]){
arr[i]=-1;
eksi--;
ok--;
}
else if(ilk==0 && ok!=arr[i]){
ilk=i;
}
}
}
cout<<sum;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
336 KB |
Output isn't correct |
2 |
Incorrect |
3 ms |
336 KB |
Output isn't correct |
3 |
Incorrect |
12 ms |
460 KB |
Output isn't correct |
4 |
Incorrect |
18 ms |
472 KB |
Output isn't correct |
5 |
Execution timed out |
2041 ms |
6480 KB |
Time limit exceeded |
6 |
Execution timed out |
2044 ms |
7248 KB |
Time limit exceeded |
7 |
Execution timed out |
2056 ms |
5968 KB |
Time limit exceeded |
8 |
Execution timed out |
2059 ms |
5968 KB |
Time limit exceeded |
9 |
Execution timed out |
2053 ms |
6224 KB |
Time limit exceeded |
10 |
Execution timed out |
2058 ms |
6480 KB |
Time limit exceeded |