제출 #956309

#제출 시각아이디문제언어결과실행 시간메모리
956309BF001Rabbit Carrot (LMIO19_triusis)C++17
100 / 100
26 ms8580 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define N 200005 int n, m, a[N], res = 0; vector<int> vec, dp; void solve(){ for (auto x : vec){ auto it = upper_bound(dp.begin(), dp.end(), x); if (it == dp.end()) dp.push_back(x); else { int pos = it - dp.begin(); dp[pos] = x; } } res = dp.size(); } signed main(){ ios_base::sync_with_stdio(0); cin.tie(NULL); cin >> n >> m; for (int i = 1; i <= n; i++){ cin >> a[i]; int val = i * m - a[i]; if (val >= 0) vec.push_back(val); } solve(); cout << n - res; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...