Submission #1105308

# Submission time Handle Problem Language Result Execution time Memory
1105308 2024-10-26T06:12:00 Z Almonther Studentsko (COCI14_studentsko) C++
100 / 100
28 ms 764 KB
#include <bits/stdc++.h>

#define suiii ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define co cout<<
//#pragma GCC optimize("O3,Ofast,unroll-loops")
//#pragma GCC target("avx2,sse3,sse4,avx")
using namespace std;
//stuff
ll n,k,mx;
ll arr[5005],dp[5005];
pair<ll,ll>arr1[5005];
void solve(){
    cin>>n>>k;
    for(int i=0;i<n;i++){
        cin>>arr[i];
        arr1[i]={arr[i],i};
    }
    sort(arr1,arr1+n);
    for(int i=0;i<n;i++) arr[arr1[i].second]=i/k;
    for(int i=0;i<n;i++){
        dp[i]=1;
        for(int j=0;j<i;j++) if(arr[i]>=arr[j]) dp[i]=max(dp[i],dp[j]+1);
        mx=max(mx,dp[i]);
    }
    co n-mx;
}
int main()
{
    suiii
    int _=1;
    // cin>>_;
    while(_--) solve();
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 23 ms 592 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 24 ms 592 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 19 ms 592 KB Output is correct
2 Correct 20 ms 632 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 22 ms 592 KB Output is correct
2 Correct 25 ms 592 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 25 ms 592 KB Output is correct
2 Correct 11 ms 476 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 22 ms 592 KB Output is correct
2 Correct 28 ms 592 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 28 ms 764 KB Output is correct
2 Correct 25 ms 648 KB Output is correct