| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 163355 | beso123 | Studentsko (COCI14_studentsko) | C++14 | 70 ms | 712 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[5001],dp[5001];
pair<int,int> m[5001];
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... | ||||
