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>
using namespace std;
int main(void){ios_base::sync_with_stdio(false);cin.tie(0);
int n,k;
vector<pair<int,int> >skills;
int newarr[5000];
vector<int>temp;
temp.push_back(-1);
cin >> n >> k;
for(int i=0;i<n;i++){
int a;
cin >> a;
skills.push_back(make_pair(a,i));
}
sort(skills.begin(),skills.end());
for(int i=0;i<n;i++){
newarr[skills[i].second]=i/k;
}
for(int i=0;i<n;i++){
if(newarr[i]>=temp.back())
temp.push_back(newarr[i]);
else
*lower_bound(temp.begin(),temp.end(),newarr[i])=newarr[i];
}
cout << n-(temp.size()-1);
}
# | 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... |