Submission #1099273

#TimeUsernameProblemLanguageResultExecution timeMemory
1099273emptypringlescanStudentsko (COCI14_studentsko)C++17
100 / 100
27 ms600 KiB
#include <bits/stdc++.h> using namespace std; int32_t main(){ ios::sync_with_stdio(0); cin.tie(0); int n,k; cin >> n >> k; int arr[n]; pair<int,int> srt[n]; for(int i=0; i<n; i++){ cin >> srt[i].first; srt[i].second=i; } sort(srt,srt+n); for(int i=0; i<n; i+=k){ for(int j=0; j<k; j++){ arr[srt[i+j].second]=i/k; } } int dp[n],ans=0; for(int i=0; i<n; i++){ dp[i]=1; for(int j=0; j<i; j++) if(arr[j]<=arr[i]) dp[i]=max(dp[i],dp[j]+1); ans=max(ans,dp[i]); } cout << n-ans; return 0; }
#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...