/* Solution: FASTFOOD */ #include #include #define MAX_STORES 200 #define MAX_DEPOTS 30 FILE *inp; int pos[MAX_STORES]; int best[MAX_DEPOTS][MAX_STORES+1]; short back[MAX_DEPOTS][MAX_STORES+1]; int cost[MAX_STORES][MAX_STORES+1]; int k,n; int caseno = 1; /* cost[a][b] will hold for all a < b the distance sum coming from an interval containing the restaurants a,a+1,...,b-1 */ void compute_cost() { int i,j,l,med,err; for(i=0;i=0;j=back[i--][j]) sol[i] = back[i][j]; printf("Chain %d\n",caseno++); for(i=0;i= ' '); } int read_case() { int i; fscanf(inp,"%d %d",&n,&k); if(n == 0) return 0; skip_line(); for(i=0;i