Submission #1099273

# Submission time Handle Problem Language Result Execution time Memory
1099273 2024-10-11T04:14:53 Z emptypringlescan Studentsko (COCI14_studentsko) C++17
100 / 100
27 ms 600 KB
#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 time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 21 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 25 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 18 ms 348 KB Output is correct
2 Correct 18 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 25 ms 348 KB Output is correct
2 Correct 23 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 23 ms 564 KB Output is correct
2 Correct 9 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 20 ms 348 KB Output is correct
2 Correct 22 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 23 ms 344 KB Output is correct
2 Correct 27 ms 600 KB Output is correct