Submission #821219

#TimeUsernameProblemLanguageResultExecution timeMemory
821219rinhoRabbit Carrot (LMIO19_triusis)C++14
100 / 100
26 ms3932 KiB
#include<bits/stdc++.h> using namespace std; const int Nmax = 2e5; const int MOD = 1000000007; int n, m, dp[Nmax + 3]; vector<int> b; void in(){ cin >> n >> m; for(int i = 1; i <= n; i++) { int x; cin >> x; int y = m * i - x; if(y >= 0) b.push_back(y); } } void sol(){ memset(dp, 0x3f, sizeof dp); int ans = 0; for(auto i : b){ int k = upper_bound(dp + 1, dp + n + 1, i) - (dp); ans = max(ans, k); dp[k] = i; } cout << n - ans; } int main(){ //freopen(" ", "r", stdin); //freopen(" ", "w", stdout); ios_base::sync_with_stdio(false); cin.tie(0); int t = 1; //cin >> t; while(t--){ in(); sol(); } 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...