Submission #1088135

#TimeUsernameProblemLanguageResultExecution timeMemory
1088135vjudge1Rabbit Carrot (LMIO19_triusis)C++17
100 / 100
64 ms3920 KiB
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> arr(n); for (int i = 0; i < n; i++) { int v; cin >> v; arr[i] = v - m * (i + 1); } reverse(arr.begin(), arr.end()); vector<int> res(n + 1, INT32_MAX); res[0] = INT32_MIN; for (int i = 0; i < n; i++) { if (arr[i] > 0) continue; int l = upper_bound(res.begin(), res.end(), arr[i]) - res.begin(); res[l] = arr[i]; } cout << n - (lower_bound(res.begin(), res.end(), INT32_MAX) - res.begin() - 1) << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...