답안 #1085642

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1085642 2024-09-08T14:09:36 Z vjudge1 Global Warming (CEOI18_glo) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,x,a;
    cin>>n>>x;
    vector<int>v,dp(n,INT_MAX),pref;
    for(int i=0;i<n;i++)
    {
        cin>>a;
        v.push_back(a);
    }
    int res=0;
    for(int i=0;i<n;i++)
    {
        int temp=lower_bound(dp.begin(),dp.end(),v[i])-dp.begin();
        pref.push_back(temp+1);
        dp[temp]=v[i];
        res=max(res,temp+1);
    }
    for(int i=0;i<n;i++)
    {
        dp[i]=MAX_INT;
    }
    for(int i=n-1;i>=0;i--)
    {
        int temp=lower_bound(dp.begin(),dp.end(),-v[i]+x)-dp.begin();
        res=max(res,pref[i]+temp);
        temp=lower_bound(dp.begin(),dp.end(),-v[i])-dp.begin();
        dp[temp]=-v[i];
    }
    cout<<res;
    return 0;
}

Compilation message

glo.cpp: In function 'int main()':
glo.cpp:23:15: error: 'MAX_INT' was not declared in this scope; did you mean 'MAX_INPUT'?
   23 |         dp[i]=MAX_INT;
      |               ^~~~~~~
      |               MAX_INPUT