#include <cstdio>
#include <algorithm>
#include <queue>
#include <utility>
using namespace std;
typedef pair<int,int> pi;
int v[1000005],n;
priority_queue<pi,vector<pi>,greater<pi> > pq;
int main(){
scanf("%d",&n);
for (int i=1; i<=n; i++) {
int t;
scanf("%d",&t);
v[i] = 1;
pq.push(pi(t,i));
}
int ct = 1, res = 1;
while (!pq.empty()) {
int x = pq.top().first;
while (!pq.empty() && pq.top().first == x) {
int pos = pq.top().second;
ct += v[pos-1] + v[pos+1] - 1;
v[pos] = 0;
pq.pop();
}
res = max(res,ct);
}
printf("%d",res);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
5112 KB |
Output is correct |
2 |
Correct |
0 ms |
5112 KB |
Output is correct |
3 |
Correct |
0 ms |
5112 KB |
Output is correct |
4 |
Correct |
0 ms |
5112 KB |
Output is correct |
5 |
Correct |
0 ms |
5112 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
32 ms |
6652 KB |
Output is correct |
2 |
Correct |
28 ms |
6652 KB |
Output is correct |
3 |
Correct |
28 ms |
6652 KB |
Output is correct |
4 |
Correct |
32 ms |
6652 KB |
Output is correct |
5 |
Correct |
28 ms |
6652 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
32 ms |
6652 KB |
Output is correct |
2 |
Correct |
24 ms |
6652 KB |
Output is correct |
3 |
Correct |
36 ms |
6652 KB |
Output is correct |
4 |
Correct |
24 ms |
6652 KB |
Output is correct |
5 |
Correct |
40 ms |
6652 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
444 ms |
17404 KB |
Output is correct |
2 |
Correct |
432 ms |
17404 KB |
Output is correct |
3 |
Correct |
432 ms |
17404 KB |
Output is correct |
4 |
Correct |
428 ms |
17404 KB |
Output is correct |
5 |
Correct |
428 ms |
17404 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
432 ms |
17404 KB |
Output is correct |
2 |
Correct |
440 ms |
17404 KB |
Output is correct |
3 |
Correct |
432 ms |
17404 KB |
Output is correct |
4 |
Correct |
356 ms |
17404 KB |
Output is correct |
5 |
Correct |
384 ms |
17404 KB |
Output is correct |