Submission #485909

#TimeUsernameProblemLanguageResultExecution timeMemory
485909groupATSUStudentsko (COCI14_studentsko)C++14
100 / 100
47 ms412 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long const ll inf=1e9; const int maxn=100; const ll mod=1e9+7; void solve(){ int a,k; cin>>a>>k; vector <pair<int,int>> b(a); for(int i=0;i<a;i++){ cin>>b[i].first; b[i].second=i; } sort(b.begin(),b.end()); vector <int> h(a); for(int i=0;i<a;i++){ h[b[i].second]=i/k; } vector <int> dp(a+5); int ans=0; for(int i=0;i<a;i++){ dp[i]=1; for(int t=0;t<i;t++){ if(h[i]>=h[t]){ dp[i]=max(dp[i],dp[t]+1); } } ans=max(ans,dp[i]); } cout<<a-ans; } int main(){ //ios_base::sync_with_stdio(false); //cin.tie(NULL); int t=1; //cin>>t; while(t--){ solve(); cout<<'\n'; } }
#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...