이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |