답안 #590500

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
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;
}
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 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 -