Submission #1101598

#TimeUsernameProblemLanguageResultExecution timeMemory
1101598ChocoStudentsko (COCI14_studentsko)C++14
0 / 100
1004 ms924 KiB
#include<bits/stdc++.h> using namespace std; #define Study ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) #define ll long long #define pb push_back #define ff first #define ss second #define fori for(ll i=0;i<n;i++) #define ins insert void work(){ ll n,k; cin>>n>>k; vector<ll>a(n+1); vector<ll>ca(n+1); vector<ll>dp(n+1,1); map<ll,ll>m; for(ll i=1;i<=n;i++){ cin>>a[i]; ca[i]=a[i]; } for(ll i=1;i<=n;i++){ ll ans=i/k; if(i%k!=0) ans++; m[a[i]]=ans; } ll ans=0; for(ll i=1;i<=n;i++){ for(ll j=1;j<i;j++){ if(m[ca[i]]>=m[ca[j]]){ dp[i]=max(dp[i],dp[j]+1); } } ans=max(ans,dp[i]); } cout<<n-ans; } int main(){ Study; ll t=1; //cin>>t; while(t--){ work(); } }
#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...