#include int cost[2050][2050]; // broadcast_cost[i][j]=cost[j][i] int tensor[2050][32]; int prefix_sum[2050][32]; int max[32]; int n,k; int broadcast_cost(int i,int j){ int cost=1; for(int t=0;t<=k-3;t++){ if(prefix_sum[j+1][t]-prefix_sum[i][t]) cost*=max[t]; } cost*=tensor[i][k-2]; cost*=tensor[j][k-1]; return cost; } int main(){ scanf("%d%d",&n,&k); for(int i=0;i