Submission #1085629

# Submission time Handle Problem Language Result Execution time Memory
1085629 2024-09-08T13:54:08 Z vjudge1 Global Warming (CEOI18_glo) C++17
0 / 100
77 ms 4808 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=n-1;i>=0;i--)
    {
        int temp=lower_bound(dp.begin(),dp.end(),v[i])-dp.begin();
        res=max(res,pref[i]+temp);
        temp=lower_bound(dp.begin(),dp.end(),v[i]+x)-dp.begin();
        dp[temp]=v[i]+x;
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 77 ms 4808 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 16 ms 1628 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 35 ms 2504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -