#include <bits/stdc++.h>
#define int long long
using namespace std;
int32_t main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n;
cin>>n;
int a[n];
vector<bool> b(n);
fill(b.begin(),b.end(),false);
int yukseklik=-1;
int idx=-1;
int cnt=0;
for(int i=0;i<n;i++)cin>>a[i];
while(find(b.begin(),b.end(),false)!=b.end()){
for(int i=0;i<n;i++){
if(b[i]==false){
idx=i;
yukseklik=a[i];
cnt++;
break;
}
}
for(int i=idx;i<n;i++){
if(a[i]==yukseklik){
b[i]=true;
yukseklik--;
}
}
}
cout<<cnt;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
336 KB |
Output isn't correct |
2 |
Incorrect |
3 ms |
336 KB |
Output isn't correct |
3 |
Incorrect |
8 ms |
504 KB |
Output isn't correct |
4 |
Incorrect |
12 ms |
336 KB |
Output isn't correct |
5 |
Execution timed out |
2075 ms |
6736 KB |
Time limit exceeded |
6 |
Execution timed out |
2061 ms |
7420 KB |
Time limit exceeded |
7 |
Execution timed out |
2037 ms |
6224 KB |
Time limit exceeded |
8 |
Execution timed out |
2050 ms |
5968 KB |
Time limit exceeded |
9 |
Execution timed out |
2048 ms |
6480 KB |
Time limit exceeded |
10 |
Execution timed out |
2064 ms |
6736 KB |
Time limit exceeded |