Submission #550412

#TimeUsernameProblemLanguageResultExecution timeMemory
550412JomnoiRabbit Carrot (LMIO19_triusis)C++17
100 / 100
35 ms5320 KiB
#include <bits/stdc++.h> #define DEBUG false using namespace std; const int MAX_N = 2e5 + 10; int a[MAX_N]; int main() { cin.tie(nullptr)->sync_with_stdio(false); int N, M; cin >> N >> M; for(int i = 1; i <= N; i++) { cin >> a[i]; } vector <int> vec; for(int i = 1; i <= N; i++) { if(i * M >= a[i]) { vec.push_back(i * M - a[i]); } } vector <int> lnds; for(auto v : vec) { auto it = upper_bound(lnds.begin(), lnds.end(), v); if(it == lnds.end()) { lnds.push_back(v); } else { *it = v; } } cout << N - lnds.size(); 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...