Submission #590500

# Submission time Handle Problem Language Result Execution time Memory
590500 2022-07-06T04:21:32 Z lam Rabbit Carrot (LMIO19_triusis) C++17
0 / 100
1 ms 340 KB
#include <bits/stdc++.h>
#define taskname "cowjog"
#define maxn 200010
#define ff first
#define ss second
#define int long long
using namespace std;
int n,T;
int a[maxn],dp[maxn];
int ans=0;
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
   // freopen(taskname".in","r",stdin);
   // freopen(taskname".out","w",stdout);
    cin>>n>>T;
    for (int i=1; i<=n; i++)
    {
        int x; cin>>x;
        a[i]=x-i*T; a[i]=-a[i];
    }
    fill_n(dp,n+1,2*1e18);
    dp[0]=-2*1e18;
    for (int i=1; i<=n; i++)
    {
        int j=upper_bound(dp,dp+n+1,a[i])-dp;
        ans=max(ans,j);
        dp[j]=a[i];
    }
    cout<<n-ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -