Submission #10358

#TimeUsernameProblemLanguageResultExecution timeMemory
10358gs14004Global Warming (NOI13_gw)C++98
40 / 40
444 ms17404 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...