Submission #1136130

#TimeUsernameProblemLanguageResultExecution timeMemory
1136130nrg_studioRabbit Carrot (LMIO19_triusis)C++20
100 / 100
15 ms2496 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define pii pair<int,int> #define f first #define s second #define chmin(a, b) a = min(a,b) #define chmax(a, b) a = max(a,b) #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define F0R(i, a) for (int i = 0; i < (a); i++) #define all(x) x.begin(),x.end() #define v vector int main() { ios::sync_with_stdio(false); cin.tie(0); ll n, m; cin >> n >> m; v<ll> dp; F0R(i,n) { ll a; cin >> a; ll val = m*(i+1)-a; if (val>=0) { int pos = upper_bound(all(dp),val)-dp.begin(); if (pos==dp.size()) {dp.pb(val);} else {dp[pos] = val;} } } cout << n-dp.size() << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...