Submission #405797

# Submission time Handle Problem Language Result Execution time Memory
405797 2021-05-16T22:47:48 Z fadi57 Global Warming (NOI13_gw) C++14
0 / 40
674 ms 64040 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=1;
   int ans=1;
   map<int,int>mp;
   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]){
        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 53 ms 27504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 73 ms 27644 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 674 ms 64040 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 659 ms 63660 KB Memory limit exceeded
2 Halted 0 ms 0 KB -