Submission #1088105

#TimeUsernameProblemLanguageResultExecution timeMemory
1088105ssitaramRabbit Carrot (LMIO19_triusis)C++17
100 / 100
22 ms3928 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n, m; cin >> n >> m; vector<int> a(n); for (int i = 0; i < n; ++i) { int v; cin >> v; a[i] = v - m * (i + 1); } reverse(a.begin(), a.end()); vector<int> d(n + 1, INT32_MAX); d[0] = INT32_MIN; for (int i = 0; i < n; ++i) { if (a[i] > 0) continue; int l = upper_bound(d.begin(), d.end(), a[i]) - d.begin(); d[l] = a[i]; } cout << n - (lower_bound(d.begin(), d.end(), INT32_MAX) - d.begin() - 1) << '\n'; 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...