#include <bits/extc++.h>
using namespace std;
typedef long long ll;
#define int ll
int n,curr,ans;
int arr[1000005];
map<int,vector<int>> mp;
bool check[100005];
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> n;
for(int i=1;i<=n;i++){
cin >> arr[i];
mp[arr[i]].push_back(i);
}
for(auto it=mp.end();it!=mp.begin();){
it--;
for(int j:it->second){
check[j] = true;
curr++;
if(check[j-1]){
curr--;
}
if(check[j+1]){
curr--;
}
ans = max(ans,curr);
}
}
cout << ans << "\n";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
468 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
468 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
10 ms |
2596 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
72 ms |
12964 KB |
Output is correct |
2 |
Correct |
41 ms |
12756 KB |
Output is correct |
3 |
Correct |
71 ms |
12976 KB |
Output is correct |
4 |
Correct |
74 ms |
12876 KB |
Output is correct |
5 |
Correct |
73 ms |
12872 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
519 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
844 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |