Submission #405847

# Submission time Handle Problem Language Result Execution time Memory
405847 2021-05-17T00:09:24 Z fadi57 Global Warming (NOI13_gw) C++14
23 / 40
577 ms 9244 KB
#include<bits/stdc++.h>
using namespace std;
const int mx=1e6+50;
typedef long long ll;
int inf=1e9+10;
const int mod=1e9+7;
ll n,m,k;
vector<pair<int,int>>v;


bool vis[mx];
ll ans=0;

int main(){

   cin>>n;

   for(int i=1;i<=n;i++){
   int x;cin>>x;
    v.push_back({x,i});
   }
   sort(v.rbegin(),v.rend());
   int cur=0;
   int ans=0;


   for(ll i=0;i<n;i++){
        cur++;
         ll me=v[i].second;
        vis[me]=1;

    if((vis[me+1])){
        cur--;
    }
     if(vis[me-1]){
   cur--;

     }
     if(i==n-1||v[me+1].first!=v[me].first){
         ans=max(ans,cur);
     }
   // cout<<cur;


   }
   cout<<ans;


 }
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 34 ms 1448 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 63 ms 1340 KB Output is correct
2 Correct 39 ms 1372 KB Output is correct
3 Correct 51 ms 1396 KB Output is correct
4 Correct 50 ms 1348 KB Output is correct
5 Correct 51 ms 1344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 564 ms 9144 KB Output is correct
2 Correct 567 ms 9244 KB Output is correct
3 Correct 566 ms 9208 KB Output is correct
4 Correct 577 ms 9116 KB Output is correct
5 Correct 538 ms 9168 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 552 ms 9148 KB Output is correct
2 Correct 548 ms 9152 KB Output is correct
3 Correct 551 ms 9148 KB Output is correct
4 Incorrect 377 ms 9116 KB Output isn't correct
5 Halted 0 ms 0 KB -