#include <bits/stdc++.h>
using namespace std;
const int N = 1000*1000+5;
int a[N];
bool col[N];
int main(){
ios_base::sync_with_stdio(false);
int n;
cin>>n;
for(int i = 1;i<=n;i++) cin>>a[i];
int ans = 0;
for(int i = 1;i<=n;i++){
if(col[i]) continue;
ans++;
int now = a[i];
now--;
for(int j = i+1;j<=n;j++){
if(a[j] == now){
col[j] = 1;
now--;
}
}
}
cout<<ans<<endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Incorrect |
3 ms |
376 KB |
Output isn't correct |
3 |
Incorrect |
7 ms |
376 KB |
Output isn't correct |
4 |
Incorrect |
9 ms |
376 KB |
Output isn't correct |
5 |
Execution timed out |
2067 ms |
7772 KB |
Time limit exceeded |
6 |
Execution timed out |
2065 ms |
8184 KB |
Time limit exceeded |
7 |
Execution timed out |
2070 ms |
6776 KB |
Time limit exceeded |
8 |
Execution timed out |
2054 ms |
6648 KB |
Time limit exceeded |
9 |
Execution timed out |
2050 ms |
7288 KB |
Time limit exceeded |
10 |
Execution timed out |
2064 ms |
7288 KB |
Time limit exceeded |