제출 #1304631

#제출 시각아이디문제언어결과실행 시간메모리
1304631cousinvRabbit Carrot (LMIO19_triusis)C++20
0 / 100
2 ms584 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int N; long long M; cin >> N >> M; vector<long long> a(N); for (int i = 0; i < N; i++) { cin >> a[i]; } vector<long long> dp; for (int i = 0; i < N; i++) { long long b = a[i] - (long long)i * M; if (b > 0) continue; long long val = -b; auto it = upper_bound(dp.begin(), dp.end(), val); if (it == dp.end()) { dp.push_back(val); } else { *it = val; } } int max_kept = dp.size(); cout << (N - max_kept) << "\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...