Олимпиадные задачи по программированию. Ч. 2. Лучшие решения. Ускова О.Ф - 38 стр.

UptoLike

int max, imax;
max=0;
imax=0;
for (y=0; y<matr->m_ysize; y++) {
for (x=0; x<matr->m_xsize; x++) {
if (*at_vect(x,excl) == 0) {
*at_vect(y,vect) += *at_matr(x,y,matr);
if (*at_vect(y,vect) > max) {
max=*at_vect(y,vect);
imax=y;
};
};
};
};
return imax;
}
int Solve(struct t_matr* matr, struct t_vect* vect) {
struct t_vect marks, excluded;
unsigned int excl_num;
int i,pos;
int solve_size;
alloc_vect(matr->m_ysize, vect);
alloc_vect(matr->m_ysize, &marks);
alloc_vect(matr->m_xsize, &excluded);
excl_num=0;
solve_size=0;
while (excl_num < matr->m_xsize) {
for (i=0; i<marks.m_size; i++) *at_vect(i,&marks)=0;
pos=CalcMarks(matr, &marks, &excluded);
*at_vect(solve_size, vect)=pos;
solve_size++;
for (i=0; i<matr->m_xsize; i++) {
if (*at_matr(i,pos,matr)) {
if (!*at_vect(i,&excluded)) {
excl_num++;
};
(*at_vect(i,&excluded))++;
};
};
};
vect->m_size = solve_size;
free_vect(&excluded);
free_vect(&marks);
DBG(("Successful call to 'Solve'\n"));
return ERR_OK;
}
/* ===== входная точка программы ===== */
int main(int argc, char *argv[]) {
struct t_matr matr;
struct t_vect solution;
ReadInput("input.txt",&matr);
if (matr.m_xsize > 60) {