# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
88791 | asifthegreat | Studentsko (COCI14_studentsko) | C++14 | 56 ms | 1004 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>
using namespace std;
const int N = 50003;
int ara[N],tmp[N],dp[N],n,k;
vector<int>v;
unordered_map<int,int>id;
int main()
{
scanf("%d %d",&n,&k);
for(int i = 0; i < n;i++){scanf("%d",&ara[i]);tmp[i] = ara[i];}
sort(tmp,tmp+n);
for(int i = 0; i < n;i++){id[tmp[i]] = i/k;}
for(int i = 0; i < n;i++)v.push_back(id[ara[i]]);
dp[0] = 1;
for(int i = 1; i < n;i++){
dp[i] = 1;
for(int j = 0; j < i;j++)
if(v[j] <= v[i])dp[i] = max(dp[i],dp[j]+1);
}
printf("%d\n",n-*max_element(dp,dp+n));
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... |