ens-ulm-1

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

solution.h (579B)


      1 class solution
      2 {
      3   vector<int> cibles[nbVoitures] ;
      4 
      5   void readFile(const char * s)
      6   {
      7     FILE * f = fopen(s,"r");
      8     int s ;
      9     fscanf(f,"%d",&s);
     10     for(int v = 0 ; v < nbVoitures ; v++)
     11       {
     12 	fscanf(f,"%d",&s);
     13 	while(s--)
     14 	  {
     15 	    fscanf(f,"%d",&s);
     16 	    cibles[v].push_back(s);
     17 	  }
     18       }
     19     fclose(f);
     20   }
     21 
     22   void writeFile(const char * s)
     23   {
     24     FILE * f = fopen(s,"w");
     25     fprintf(f,"8\n");
     26     for(int v = 0 ; v < nbVoitures ; v++)
     27       {
     28 	fprintf(f,"%d\n",cibles[v].size());
     29 	for(int s : cibles[v])
     30 	  fprintf(f,"%d\n",s);
     31       }
     32     fclose(f);
     33   }
     34 };