// Online adversary for bipartite matching - see Karp, Vazirani, & Vazirani // BPW, 2/29/04 #include main() { int n,i,j,k,p,ones,moves,seed,peek; int *boysMatchedADON,*boysMatchedALG; // The two matchings int *column,*seal; // The current column and ADON's sealed moves int boyALG; printf("Enter n and seed\n"); scanf("%d %d",&n,&seed); printf("Do you want to peek at sealed moves of online adversary? (0/1)\n"); scanf("%d",&peek); if (peek) printf("Shame on you . . .\n"); else printf("Virtue will not go unrewarded . . .\n"); srandom(seed); boysMatchedADON=(int*) malloc(n*sizeof(int)); boysMatchedALG=(int*) malloc(n*sizeof(int)); column=(int*) malloc(n*sizeof(int)); seal=(int*) malloc(n*sizeof(int)); if (!boysMatchedADON || !boysMatchedALG || !column || !seal) { printf("malloc failed %d\n",__LINE__); exit(0); } for (i=0;i=0 && boyALG=0 && boyALG