#include <iostream>
using namespace std;
int n,cnt=1,maxi=1;
int tim[100005];
bool tree[100005];
int main(){
cin >> n;
for(int i=1;i<=n;i++){
int a;
cin >> a;
tim[a] = i;
tree[i] = true;
}
for(int i=1;i<=n;i++){
cnt--;
if(tree[tim[i]-1]){
cnt++;
}
if(tree[tim[i]+1]){
cnt++;
}
tree[tim[i]] = false;
maxi = max(maxi,cnt);
}
cout << maxi << "\n";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
18 ms |
596 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
452 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |