#include #include #define oo 100000000 #define max(a,b) ((a)>(b)?(a):(b)) #define min(a,b) ((a)<(b)?(a):(b)) #define DBG(x) char names[300][50]; int c; int getname(char *s) { int i, pos = -1; for (i = 0;i < c;i++) { if (strcmp(s,names[i])==0) { pos = i; break; } } return pos; } int putname(char *s) { int pos; if ((pos = getname(s)) == -1) { pos = c; strcpy(names[c++],s); } return pos; } int main(void) { FILE *f = fopen("heavy.in", "r"); char s1[50], s2[50]; int i,j,k,a[300][300],n,r, d, i1, i2, anz=1; while(1) { fscanf(f, "%d %d ", &n ,&r); DBG(printf("%d %d ", n, r);) if (n == 0 && r == 0) break; /* DBG(printf("%d %d ", n, r);)*/ for (i=0;i