Submission #540518

#TimeUsernameProblemLanguageResultExecution timeMemory
540518phathnvRabbit Carrot (LMIO19_triusis)C++11
100 / 100
39 ms3816 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n, m; cin >> n >> m; vector<int> a(n + 1, 0); for (int i = 1; i <= n; ++i) { cin >> a[i]; a[i] -= i * m; } reverse(a.begin(), a.end()); int res = 0; vector<int> f(a.size() + 1, 1e9); f[0] = -1e9; for (int x : a) { res = upper_bound(f.begin(), f.end(), x) - f.begin(); f[res] = x; } cout << n - (res - 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...