# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
201403 | ArKCa | Studentsko (COCI14_studentsko) | C++17 | 1097 ms | 1092 KiB |
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 f1 first
#define s2 second
#define pb push_back
#define pob pop_back
#define int ll
#define ll long long
#define PII pair<int,int>
#define N 5003
using namespace std;
int n,k;
int dizi[N],dizim[N],sa[N];
map<int,int>m;
int32_t main(){
// freopen("a.gir","r",stdin);
// freopen("a.cik","w",stdout);
scanf("%lld %lld",&n,&k);
for(int i=0;i<n;i++){
scanf("%lld",&dizi[i]);
dizim[i]=dizi[i];
}
sort(dizim,dizim+n);
for(int i=0;i<n;i++){
m[dizim[i]]=i/k;
}
int mx=0;
for(int i=n-1;i>=0;i--){
sa[i]=1;
for(int j=i+1;j<n;j++){
if(m[dizi[i]]<=m[dizi[j]])
sa[i]=max(sa[i],sa[j]+1);
}
mx=max(mx,sa[i]);
}
printf("%lld\n",n-mx );
}
Compilation message (stderr)
# | 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... |