제출 #1353261

#제출 시각아이디문제언어결과실행 시간메모리
1353261lizi14Global Warming (NOI13_gw)C++20
0 / 40
1097 ms131072 KiB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define f first
#define ss second
#define ina insert
#define pb push_back
signed main(){
    int n;
    cin>>n;
    int x[n];
    set<int>s;
    map<int,vector<int>>mp;
    for(int i=0; i<n; i++){
        cin>>x[i];
        s.ina(x[i]);
        mp[x[i]].pb(i);
    }
    int ans=1;
    set<int>bati;
    for(auto a:s){
        int di=0,ri=0;
        for(auto b:mp[a]){
            // if(bati.find(b-1)==bati.end())di=1;
            // if(bati.find(b+1)==bati.end())ri=1;
            // if(di && ri){
            //     bati.ina(b);
            // }
            // else{
            //     if(di!=1 && ri!=1){
                    
            //     }
            // }
            bati.ina(b);
        }
        int l=0;
        int ixvi=-1;
        //cout<<a<<endl;
        for(auto b:bati){
            if(ixvi!=-1){
                if(b==ixvi+1){
                    //ixvi=b;
                    //continue;
                }
                else{
                    l++;
                }
            }
            else{
                l++;
            }
            //cout<<b<<" "<<ixvi<<endl;
            ixvi=b;
        }
        //cout<<l<<endl;
        //int k=bati.size()+1;
        if(bati.find(n-1)==bati.end())l++;
        ans=max(l,ans);
    }
    cout<<ans<<endl;
}
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…