Submission #515722

# Submission time Handle Problem Language Result Execution time Memory
515722 2022-01-19T14:41:24 Z andrei_boaca Global Warming (CEOI18_glo) C++17
28 / 100
2000 ms 4872 KB
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
ll n,x,v[200005],ans,dp[200005],maxim[200005];
ll getLIS()
{
    ll rez=0;
    for(int i=1;i<=n;i++)
        maxim[i]=-2e9;
    for(int i=n;i>=1;i--)
    {
        int lg=0;
        int st=1;
        int dr=n-i;
        while(st<=dr)
        {
            int mij=(st+dr)/2;
            if(maxim[mij]>v[i])
            {
                lg=mij;
                st=mij+1;
            }
            else
                dr=mij-1;
        }
        dp[i]=lg+1;
        rez=max(rez,dp[i]);
        maxim[dp[i]]=max(maxim[dp[i]],v[i]);
    }
    return rez;
}
int main()
{
    cin>>n>>x;
    for(int i=1;i<=n;i++)
        cin>>v[i];
    ans=getLIS();
    for(int i=1;i<=n;i++)
    {
        v[i]-=x;
        ans=max(ans,getLIS());
    }
    cout<<ans;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 28 ms 328 KB Output is correct
20 Correct 25 ms 332 KB Output is correct
21 Correct 26 ms 332 KB Output is correct
22 Correct 23 ms 204 KB Output is correct
23 Correct 10 ms 332 KB Output is correct
24 Correct 14 ms 336 KB Output is correct
25 Correct 11 ms 332 KB Output is correct
26 Correct 11 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 2078 ms 4872 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2080 ms 1448 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2063 ms 2636 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 28 ms 328 KB Output is correct
20 Correct 25 ms 332 KB Output is correct
21 Correct 26 ms 332 KB Output is correct
22 Correct 23 ms 204 KB Output is correct
23 Correct 10 ms 332 KB Output is correct
24 Correct 14 ms 336 KB Output is correct
25 Correct 11 ms 332 KB Output is correct
26 Correct 11 ms 332 KB Output is correct
27 Execution timed out 2078 ms 4872 KB Time limit exceeded
28 Halted 0 ms 0 KB -