이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
const int Nmax = 2e5;
const int MOD = 1000000007;
int n, m, dp[Nmax + 3];
vector<int> b;
void in(){
cin >> n >> m;
for(int i = 1; i <= n; i++) {
int x; cin >> x;
int y = m * i - x;
if(y >= 0) b.push_back(y);
}
}
void sol(){
memset(dp, 0x3f, sizeof dp);
int ans = 0;
for(auto i : b){
int k = upper_bound(dp + 1, dp + n + 1, i) - (dp);
ans = max(ans, k);
dp[k] = i;
}
cout << n - ans;
}
int main(){
//freopen(" ", "r", stdin);
//freopen(" ", "w", stdout);
ios_base::sync_with_stdio(false);
cin.tie(0);
int t = 1;
//cin >> t;
while(t--){
in();
sol();
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |