ens-ulm-1

google hashcode 2014 source for team ens-ulm-1
git clone https://a3nm.net/git/ens-ulm-1/
Log | Files | Refs

algo.cpp (691B)


      1 #include "louis.cpp"
      2 #include "ameliore.cpp"
      3 
      4 int main()
      5 {
      6   lecture_entree();
      7   init_use();
      8   vector<int> chem[8];
      9   for( int i = 0 ; i < 8 ; i++)
     10     {
     11       int arrivee = s_depart ;
     12       int l = 0 ;
     13       chem[i].push_back(s_depart);
     14       while( l < t_autorise )
     15 	{
     16 	  while(chem[i].back() == arrivee)
     17 	    arrivee = rand()%n_sommets ;
     18 	  int nouv = use[chem[i].back()][arrivee];
     19 	  l+= cout[id_arete[make_pair(chem[i].back(),nouv)]] ;
     20 	  if(l<t_autorise)
     21 	    chem[i].push_back(use[chem[i].back()][arrivee]);
     22 	  //	  fprintf(stderr,"%d %d %d\n",i,chem[i].back(),arrivee);
     23 	}
     24     }
     25   fprintf(stderr,"%d !\n",score_solution(chem));
     26   ameliore_louis(chem);
     27   //  affiche_sortie(chem);
     28 }
     29