| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1353257 | lizi14 | 지구 온난화 (NOI13_gw) | C++20 | 1097 ms | 131072 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;
int l=0;
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);
l++;
}
else{
if(di!=1 && ri!=1){
l--;
}
else bati.ina(b);
}
//bati.ina(b);
}
if(bati.find(n-1)!=bati.end()){
ans=max(l+1,ans);
}
else ans=max(l,ans);
}
cout<<ans<<endl;
}| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
