This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#define dibs reserve
#define OVER9000 1234567890
#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
#define tisic 47
#define soclose 1e-8
#define chocolate win
// so much chocolate
#define patkan 9
#define ff first
#define ss second
#define abs(x) ((x < 0)?-(x):x)
#define uint unsigned int
#define dbl long double
using namespace std;
// mylittledoge
int main(){
cin.sync_with_stdio(0);
cin.tie(0);
int N, K;
cin >> N >> K;
vector <int> A(N);
map <int, int> M;
for (int i = 0; i < N; i++){
cin >> A[i];
M[A[i]] = 0;
}
int n = 0;
ALL_THE(M,it) it->ss = n++;
for (int i = 0; i < N; i++){
A[i] = M[A[i]] / K;
}
int ansT = 0;
vector <int> ans(N, 1);
for (int i = 0; i < N; i++){
for (int j = 0; j < i; j++){
if (A[j] <= A[i]) ans[i] = max(ans[i], ans[j] + 1);
}
ansT = max(ansT, ans[i]);
}
cout << N - ansT << "\n";
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... |
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |