Detalii evaluare #50778581

Rezumat problemă

#2217 Map

Domnul Map vă pune la dispoziție un șir a[1], a[2], …, a[n] de numere naturale. Pentru fiecare a[i] (i=1..n) trebuie să spuneți de câte ori apare acest element în secvența a[1], a[2], …, a[i].

Detalii

Problema Map Operații I/O map.in/map.out
Limita timp 0.2 secunde Limita memorie Total: 64 MB / Stivă 8 MB
Id soluție #50778581 Utilizator Tepurlan Vlad (Vlad_Mihail)
Fișier map.c Dimensiune 4.22 KB
Data încărcării 02 Mai 2024, 22:59 Scor / rezultat Eroare de compilare

Evaluare


Mesaj compilare

map.c: In function 'key_val_free_function':
map.c:56:2: error: unknown type name 'info'
  info *be_free = (info*)data;

  ^
map.c:56:19: error: 'info' undeclared (first use in this function)
  info *be_free = (info*)data;

                   ^
map.c:56:19: note: each undeclared identifier is reported only once for each function it appears in
map.c:56:24: error: expected expression before ')' token
  info *be_free = (info*)data;

                        ^
map.c:57:14: error: request for member 'key' in something not a structure or union
  free(be_free->key);

              ^
map.c:58:14: error: request for member 'value' in something not a structure or union
  free(be_free->value);

              ^
map.c: At top level:
map.c:62:1: error: unknown type name 'hashtable'
 hashtable *ht_create(int hmax, unsigned int (*hash_function)(void*),

 ^
map.c: In function 'ht_create':
map.c:66:2: error: unknown type name 'hashtable'
  hashtable *ht = malloc(sizeof(hashtable));

  ^
map.c:66:32: error: 'hashtable' undeclared (first use in this function)
  hashtable *ht = malloc(sizeof(hashtable));

                                ^
map.c:67:4: error: request for member 'hmax' in something not a structure or union
  ht->hmax = hmax;

    ^
map.c:68:4: error: request for member 'hash_function' in something not a structure or union
  ht->hash_function = (*hash_function);

    ^
map.c:69:4: error: request for member 'compare_function' in something not a structure or union
  ht->compare_function = (*compare_function);

    ^
map.c:70:4: error: request for member 'key_val_free_function' in something not a structure or union
  ht->key_val_free_function = (*key_val_free_function);

    ^
map.c:71:4: error: request for member 'size' in something not a structure or union
  ht->size = 0;

    ^
map.c:72:4: error: request for member 'buckets' in something not a structure or union
  ht->buckets = malloc(hmax * sizeof(linked_list *));

    ^
map.c:72:37: error: 'linked_list' undeclared (first use in this function)
  ht->buckets = malloc(hmax * sizeof(linked_list *));

                                     ^
map.c:72:50: error: expected expression before ')' token
  ht->buckets = malloc(hmax * sizeof(linked_list *));

                                                  ^
map.c:74:5: error: request for member 'buckets' in something not a structure or union
   ht->buckets[i] = ll_create(sizeof(info), ht->key_val_free_function);

     ^
map.c:74:3: warning: implicit declaration of function 'll_create' [-Wimplicit-function-declaration]
   ht->buckets[i] = ll_create(sizeof(info), ht->key_val_free_function);

   ^
map.c:74:37: error: 'info' undeclared (first use in this function)
   ht->buckets[i] = ll_create(sizeof(info), ht->key_val_free_function);

                                     ^
map.c:74:46: error: request for member 'key_val_free_function' in something not a structure or union
   ht->buckets[i] = ll_create(sizeof(info), ht->key_val_free_function);

                                              ^
map.c: At top level:
map.c:78:16: error: unknown type name 'hashtable'
 int ht_has_key(hashtable *ht, void *key)

                ^
map.c:91:14: error: unknown type name 'hashtable'
 void *ht_get(hashtable *ht, void *key)

              ^
map.c:107:13: error: unknown type name 'hashtable'
 void ht_put(hashtable *ht, void *key, unsigned int key_size,

             ^
map.c:127:22: error: unknown type name 'hashtable'
 void ht_remove_entry(hashtable *ht, void *key)

                      ^
map.c:149:14: error: unknown type name 'hashtable'
 void ht_free(hashtable **ht)

              ^
map.c: In function 'main':
map.c:168:5: error: unknown type name 'hashtable'
     hashtable *ht = ht_create(10000, hash_function_int, compare_function_ints, key_val_free_function);

     ^
map.c:174:9: warning: implicit declaration of function 'ht_get' [-Wimplicit-function-declaration]
         if (ht_get(ht, &x))

         ^
map.c:179:9: warning: implicit declaration of function 'ht_put' [-Wimplicit-function-declaration]
         ht_put(ht, &x, sizeof(int), &value, sizeof(int));

         ^
map.c:170:10: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);

          ^
map.c:173:14: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &x);

              ^

Cum funcționează evaluarea?

www.pbinfo.ro permite evaluarea a două tipuri de probleme:

  • probleme la care rezolvarea presupune scrierea unui program complet
  • probleme la care rezolvarea presupune scrierea unei secvențe de program - câteva instrucțiuni, o listă de declarații, una sau mai multe funcții, etc.

Problema Map face parte din prima categorie. Soluția propusă de tine va fi evaluată astfel:

  • Programul sursă este compilat folosind compilatorul corespunzător. Dacă în urma compilării se obțin erori sau avertismente, acestea sunt afișate în această pagină.
  • Dacă programul a fost compilat, executabilul obținut va fi rulat, furnizându-i-se unul sau mai multe seturi de date de intrare, în concordanță cu restricțiile specifice problemei. Pentru fiecare set de date se obține un anumit punctaj, în raport cu corectitudinea soluției tale.

Suma punctajelor acordate pe testele utilizate pentru verificare este 100. Astfel, soluția ta poate obține cel mult 100 de puncte, caz în care se poate considera corectă.