Detalii evaluare #36695525

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 #36695525 Utilizator Basaram Stefan (BasaramStefan)
Fișier map.cpp Dimensiune 605 B
Data încărcării 17 Mai 2022, 11:56 Scor / rezultat Eroare de compilare

Evaluare


Mesaj compilare

In file included from /usr/include/c++/4.8/bits/hashtable.h:35:0,
                 from /usr/include/c++/4.8/unordered_map:47,
                 from map.cpp:2:
/usr/include/c++/4.8/bits/hashtable_policy.h: In instantiation of 'void std::__detail::_Insert_base<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::insert(_InputIterator, _InputIterator) [with _InputIterator = int; _Key = int; _Value = std::pair<const int, int>; _Alloc = std::allocator<std::pair<const int, int> >; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<int>; _H1 = std::hash<int>; _H2 = std::__detail::_Mod_range_hashing; _Hash = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<false, false, true>]':
/usr/include/c++/4.8/bits/unordered_map.h:419:4:   required from 'void std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator, _InputIterator) [with _InputIterator = int; _Key = int; _Tp = int; _Hash = std::hash<int>; _Pred = std::equal_to<int>; _Alloc = std::allocator<std::pair<const int, int> >]'
map.cpp:19:34:   required from here
/usr/include/c++/4.8/bits/hashtable_policy.h:634:61: error: no matching function for call to '__distance_fw(int&, int&)'
  size_type __n_elt = __detail::__distance_fw(__first, __last);
                                                             ^
/usr/include/c++/4.8/bits/hashtable_policy.h:634:61: note: candidates are:
/usr/include/c++/4.8/bits/hashtable_policy.h:64:5: note: template<class _Iterator> typename std::iterator_traits<_Iterator>::difference_type std::__detail::__distance_fw(_Iterator, _Iterator, std::input_iterator_tag)
     __distance_fw(_Iterator __first, _Iterator __last,
     ^
/usr/include/c++/4.8/bits/hashtable_policy.h:64:5: note:   template argument deduction/substitution failed:
/usr/include/c++/4.8/bits/hashtable_policy.h:634:61: note:   candidate expects 3 arguments, 2 provided
  size_type __n_elt = __detail::__distance_fw(__first, __last);
                                                             ^
/usr/include/c++/4.8/bits/hashtable_policy.h:70:5: note: template<class _Iterator> typename std::iterator_traits<_Iterator>::difference_type std::__detail::__distance_fw(_Iterator, _Iterator, std::forward_iterator_tag)
     __distance_fw(_Iterator __first, _Iterator __last,
     ^
/usr/include/c++/4.8/bits/hashtable_policy.h:70:5: note:   template argument deduction/substitution failed:
/usr/include/c++/4.8/bits/hashtable_policy.h:634:61: note:   candidate expects 3 arguments, 2 provided
  size_type __n_elt = __detail::__distance_fw(__first, __last);
                                                             ^
/usr/include/c++/4.8/bits/hashtable_policy.h:76:5: note: template<class _Iterator> typename std::iterator_traits<_Iterator>::difference_type std::__detail::__distance_fw(_Iterator, _Iterator)
     __distance_fw(_Iterator __first, _Iterator __last)
     ^
/usr/include/c++/4.8/bits/hashtable_policy.h:76:5: note:   template argument deduction/substitution failed:
/usr/include/c++/4.8/bits/hashtable_policy.h: In substitution of 'template<class _Iterator> typename std::iterator_traits<_Iterator>::difference_type std::__detail::__distance_fw(_Iterator, _Iterator) [with _Iterator = int]':
/usr/include/c++/4.8/bits/hashtable_policy.h:634:61:   required from 'void std::__detail::_Insert_base<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::insert(_InputIterator, _InputIterator) [with _InputIterator = int; _Key = int; _Value = std::pair<const int, int>; _Alloc = std::allocator<std::pair<const int, int> >; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<int>; _H1 = std::hash<int>; _H2 = std::__detail::_Mod_range_hashing; _Hash = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<false, false, true>]'
/usr/include/c++/4.8/bits/unordered_map.h:419:4:   required from 'void std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator, _InputIterator) [with _InputIterator = int; _Key = int; _Tp = int; _Hash = std::hash<int>; _Pred = std::equal_to<int>; _Alloc = std::allocator<std::pair<const int, int> >]'
map.cpp:19:34:   required from here
/usr/include/c++/4.8/bits/hashtable_policy.h:76:5: error: no type named 'difference_type' in 'struct std::iterator_traits<int>'
/usr/include/c++/4.8/bits/hashtable_policy.h: In instantiation of 'void std::__detail::_Insert_base<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::insert(_InputIterator, _InputIterator) [with _InputIterator = int; _Key = int; _Value = std::pair<const int, int>; _Alloc = std::allocator<std::pair<const int, int> >; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<int>; _H1 = std::hash<int>; _H2 = std::__detail::_Mod_range_hashing; _Hash = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<false, false, true>]':
/usr/include/c++/4.8/bits/unordered_map.h:419:4:   required from 'void std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator, _InputIterator) [with _InputIterator = int; _Key = int; _Tp = int; _Hash = std::hash<int>; _Pred = std::equal_to<int>; _Alloc = std::allocator<std::pair<const int, int> >]'
map.cpp:19:34:   required from here
/usr/include/c++/4.8/bits/hashtable_policy.h:647:18: error: invalid type argument of unary '*' (have 'int')
    __h._M_insert(*__first, __unique_keys());
                  ^

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ă.