# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
163354 | beso123 | Studentsko (COCI14_studentsko) | C++14 | 4 ms | 632 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 int long long
using namespace std;
int n,s,a[1001],dp[1001];
pair<int,int> m[1001];
main(){
cin>>n>>s;
for(int k=1;k<=n;k++){
int b;
cin>>b;
m[k]={b,k};
}
sort(m+1,m+n+1);
int t=1;
int h=1;
for(int k=1;k<=n;k++){
if(t>s){
t=1;
h++;
}
a[m[k].second]=h;
t++;
}
dp[1]=1;
int len=1;
for(int k=2;k<=n;k++){
dp[k]=1;
for(int i=1;i<k;i++){
if(a[i]<=a[k])
dp[k]=max(dp[k],dp[i]+1);
}
len=max(len,dp[k]);
}
cout<<n-len;
return 0;
}
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... |