제출 #40626

#제출 시각아이디문제언어결과실행 시간메모리
40626Hassoony학생 (COCI14_studentsko)C++14
0 / 100
58 ms49992 KiB
#include<bits/stdc++.h> #include<unordered_map> using namespace std; typedef unsigned long long ll; typedef double D; const ll inf=(1ll<<61); const ll mod=1e9+7; const int MX=5009; short int n,k; short int a[MX]; short int dp[MX][MX]; short int DP(int x,int y){ if(x==n)return 0; short int &ret=dp[x][y];if(ret!=-1)return ret; ret=DP(x+1,y); short int x1=1; if(a[x]>=y)x1+=DP(x+1,a[x]),ret=max(ret,x1); return ret; } map<int,int>hashy; short int b[MX]; int main(){ cin>>n>>k; for(int i=0;i<n;i++)cin>>a[i],b[i]=a[i]; sort(b,b+n); for(int i=0;i<n;i++){ hashy[b[i]]=i/k; } for(int i=0;i<n;i++)a[i]=hashy[a[i]]; for(int i=0;i<MX;i++){ for(int j=0;j<MX;j++){ dp[i][j]=-1; } } cout<<n-DP(0,0)<<endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...