Submission #405813

# Submission time Handle Problem Language Result Execution time Memory
405813 2021-05-16T23:03:11 Z fadi57 Global Warming (NOI13_gw) C++14
0 / 40
693 ms 55060 KB
#include<bits/stdc++.h>
using namespace std;
const int mx=1000001;
typedef long long ll;
int inf=1e9+10;
const int mod=1e9+7;
int n,m,k;
vector<pair<ll,int>>v;
vector<pair<ll,ll>>adj[mx];
ll best[mx];
int vis[mx];
ll ans=0;
ll a[mx];
int main(){

   cin>>n;
   a[0]=-1;
   a[n+1]=-1;
   for(int i=1;i<=n;i++){
    cin>>a[i];
    v.push_back({a[i],i});
   }
   sort(v.begin(),v.end());
   int cur=0;
   int ans=0;
   map<int,int>mp;
   if(v[n-1].first>0){
    ans=1;cur=1;
   }
   for(int i=0;i<n;i++){
        int me=v[i].second;
    if((a[me+1]>a[me])&&(a[me-1]>a[me])){
        cur++;
    }else if(a[me-1]>a[me]){
    mp[me]=1;

     }else if(a[me-1]==a[me]){

     mp[me]=mp[me-1];
     if(a[me+1]>a[me]&&mp[me]){
        cur++;
     }

     }
    ans=max(ans,cur);

   }
   cout<<ans;


 }
# Verdict Execution time Memory Grader output
1 Incorrect 15 ms 23756 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 52 ms 27160 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 68 ms 26788 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 693 ms 54644 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 671 ms 55060 KB Memory limit exceeded
2 Halted 0 ms 0 KB -