제출 #1131051

#제출 시각아이디문제언어결과실행 시간메모리
1131051catsarecool5530Rabbit Carrot (LMIO19_triusis)C++20
0 / 100
1 ms328 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; // #define endl "\n"; #define all(x) x.begin(), x.end() ll MOD = 1e9+7; void solve() { int n, jump; cin >> n >> jump; vector<int> a(n+1); a[0] = 0; for (int i = 1; i <= n; i++) { cin >> a[i]; a[i] = -a[i]; } vector<ll> dp{0}; for (int i = 1; i <= n; i++) { ll value = a[i] + jump*i; int index = upper_bound(all(dp), value) - dp.begin(); if (index == dp.size()) dp.push_back(value); else dp[index] = max(value, dp[index]); } cout << n - dp.size() + 1 << endl; } int main() { ios::sync_with_stdio(0); cin.tie(0); //freopen("example.txt", "r", stdin); //freopen("exercise.out", "w", stdout); ll t = 1; //cin >> t; while (t--) { solve(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...