Submission #781536

#TimeUsernameProblemLanguageResultExecution timeMemory
781536AM1648Rabbit Carrot (LMIO19_triusis)C++17
100 / 100
26 ms2132 KiB
#include <iostream> #include <cstring> #include <algorithm> using namespace std; const int maxn = 200010; int A[maxn]; int lis[maxn]; int main() { ios::sync_with_stdio(false); cin.tie(0), cout.tie(0); int N, M; cin >> N >> M; for (int i = 1; i <= N; i++) { cin >> A[i]; A[i] -= i * M; } reverse(A, A + N + 1); memset(lis, 60, sizeof lis); int mx = 0; for (int i = 0; i <= N; i++) { if (A[i] > 0) continue; int idx = upper_bound(lis, lis + N, A[i]) - lis; lis[idx] = A[i]; mx = max(mx, idx + 1); } cout << N + 1 - mx << 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...