problem 2041,wrong answer!

Problems from China regional contest

Moderator: Board moderators

problem 2041,wrong answer!

Postby vencentd » Wed May 21, 2008 12:57 pm

who can give me some test data?
thanks!
vencentd
New poster
 
Posts: 2
Joined: Wed May 21, 2008 12:53 pm

Re: problem 2041,wrong answer!

Postby serur » Wed May 21, 2008 8:51 pm

It is bipartite matching/Konig Theorem.
You may post your code.
No rest with the wicked
serur
Experienced poster
 
Posts: 70
Joined: Thu Feb 23, 2006 10:30 pm

Re: problem 2041,wrong answer!

Postby vencentd » Sun May 25, 2008 5:52 pm

here is my code,by the way ,the way i solve is follow by the step below:
i store all the input data into a table named romaData.
1,find the guys who have least number of romatical relation, and pick it into the set.
2 ,then update the table ---remove the item have been picked by mark the 2nd value in the array as "-2",
remove the item which have relationship with the guys picked,
and update the remain guys array.
3redo step 1and 2.

Code: Select all
#include<stdio.h>
int main(void){
   char input[1024];
   int **romaData;
   int num=0;
   int i=0;
   int k=0;
   int count=0;
   int j=0;
   while(gets(input)){
      num=0;
      for(i=0;i<strlen(input);i++){
         num=input[i]-48+num*10;
      }
      romaData=(int**)malloc(sizeof(int*)*num);
      for(i=0;i<num;i++){
         gets(input);
         romaData[i]=malloc(sizeof(int)*strlen(input));
         memset(romaData[i],((int)-1),strlen(input));
         romaData[i][0]=i;
         j=0;
         for(k=0;k<strlen(input);k++){
            if((int)input[k]<=57&&(int)input[k]>=48){
               count=input[k]-48+count*10;
            
         if(((int)input[k+1]>57||(int)input[k+1]<48)){
               romaData[i][j]=count;
               count=0;
               printf("data=%i\n",romaData[i][j]);
                  j++;
         }
            }
         }
         count=0;
         printf("\n");
      }
      count=0;
      int min=50000;
      int temp[1024];
      int t=-1;
      int u=0;
      int max=-90;
      int q=0;
      int r=10;
      memset(temp,-1,1024);
      while(max!=-1&&r!=0){
         min=50000;
         t=0;
         u=0;   
         for(i=0;i<num;i++){
            if(romaData[i][1]<min&&romaData[i][1]!=-2&&romaData[i][1]!=-1){
               min=romaData[i][1];
               t=i;
            }
            if(romaData[i][1]>=max){
               max=romaData[i][1];
            }
         }
         printf("max=%i  min =%i\n",max,min);
         for(i=t;i<num;i++){
            printf("min=%i\n",min);
            if(romaData[i][1]==min){
               for(k=0;k<romaData[i][1];k++){
                  for(j=0;j<u;j++){
                     if(temp[u]==romaData[i][k+2]){
                        count=1;
                        break;
                     }
                  }
                  if(count!=1){
                     temp[u]=romaData[i][k+2];
                     u++;
                  }
                  count=0;
               }
               printf("hihihi\n");
               romaData[i][1]=-2;
               for(k=0;k<min;k++){
                  if(romaData[i][k+2]==-3){
                     continue;
                  }
                  printf("error=%i   k=%i i=%i  \n",romaData[i][k+2],k,i);
                  romaData[romaData[i][k+2]][1]=-1;
               }
               printf("aygfouqwy\n");
            }
         }
         for(i=0;i<u;i++){
            for(k=0;k<num;k++){
               q=0;
               if(romaData[k][1]==-1){
                  continue;
               }
               count=romaData[k][1];
               for(j=0;j<count;j++){
                  if(romaData[k][j+2]==-3){
                     count++;
                     continue;
                  }
                  if(romaData[k][j+2]==temp[i]){
                     romaData[k][j+2]=-3;
                     romaData[k][1]--;
                  }   
               }
            }
         }
         count=0;
         for(i=0;i<num;i++){
            for(k=0;k<7;k++)
               printf("%i ",romaData[i][k]);
            printf("\n");
            if(romaData[i][1]==-2){
               count++;
            }
         }
         printf("count=%i \n",count);
         r--;
      }
   }
   return 1;
}
vencentd
New poster
 
Posts: 2
Joined: Wed May 21, 2008 12:53 pm

The particular area and also discretion apparatus

Postby huanhuan1 » Thu Nov 01, 2012 11:48 am

The particular area and also discretion apparatus to get quad bicycling are generally mud or perhaps quad cycles, buggies, pedal playthings and also the most crucial safe practices equipment. Safe practices equipment contains safe practices equipment, elbow protectors, physique amours, and also lids to get the two grownups and also infants, battery power pre-filled having serum electrolyte.
Down the road within 2004 they will produced any regular fragrance referred 305866965n0104 to as that lowerbomb? The principle substances of the fragrance incorporate concentrated amounts connected with flower,newest jordans, amber, patchouli, musk, bergamot, sambac, tangerine teas, teas, jasmine, freesia in addition to catleya orchid,Make use of social network websites that will sell your curr. They will invest all his time about its products and solutions,air jordans cheap, also to that title in order to assure you will be acquiring high grade products,retro jordans for sale.
huanhuan1
A great helper
 
Posts: 140
Joined: Thu Oct 18, 2012 12:15 pm


Return to Site 3 - China

Who is online

Users browsing this forum: No registered users and 1 guest

cron