Detalii evaluare #51085937

Rezumat problemă

Se dă un vector de N numere naturale nenule, indexat de la 1.
Se cere să se raspundă la Q interogări de tipul:

  • pentru un interval [l, r] din vector, aflați costul total mimin, al egalizării tuturor elementelor din interval.

Detalii

Problema Median_Heaps Operații I/O tastatură/ecran
Limita timp 1.5 secunde Limita memorie Total: 8 MB / Stivă 1 MB
Id soluție #51085937 Utilizator Berbescu Alexandru (mentalist_361)
Fișier median_heaps.cpp Dimensiune 3.41 KB
Data încărcării 22 Mai 2024, 23:43 Scor / rezultat Eroare de compilare

Evaluare


Mesaj compilare

median_heaps.cpp: In function 'int32_t main(int, char**)':
median_heaps.cpp:99:44: error: no matching function for call to '__gnu_pbds::tree<std::pair<int, int>, __gnu_pbds::null_type, std::less<std::pair<int, int> >, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update>::insert(<brace-enclosed initializer list>)'
                 oset.insert({a[drcur], z++});

                                            ^
median_heaps.cpp:99:44: note: candidate is:
In file included from /usr/include/c++/4.8/ext/pb_ds/detail/container_base_dispatch.hpp:85:0,
                 from /usr/include/c++/4.8/ext/pb_ds/assoc_container.hpp:48,
                 from median_heaps.cpp:7:
/usr/include/c++/4.8/ext/pb_ds/detail/rb_tree_map_/insert_fn_imps.hpp:43:1: note: std::pair<typename __gnu_pbds::detail::bin_search_tree_set<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>::point_iterator, bool> __gnu_pbds::detail::rb_tree_set<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>::insert(__gnu_pbds::detail::rb_tree_set<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>::const_reference) [with Key = std::pair<int, int>; Mapped = __gnu_pbds::null_type; Cmp_Fn = std::less<std::pair<int, int> >; Node_And_It_Traits = __gnu_pbds::detail::tree_traits<std::pair<int, int>, __gnu_pbds::null_type, std::less<std::pair<int, int> >, __gnu_pbds::tree_order_statistics_node_update, __gnu_pbds::rb_tree_tag, std::allocator<char> >; _Alloc = std::allocator<char>; typename __gnu_pbds::detail::bin_search_tree_set<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>::point_iterator = __gnu_pbds::detail::bin_search_tree_const_it_<__gnu_pbds::detail::rb_tree_node_<std::pair<int, int>, unsigned int, std::allocator<char> >*, std::pair<int, int>, std::pair<int, int>*, const std::pair<int, int>*, std::pair<int, int>&, const std::pair<int, int>&, true, std::allocator<char> >; __gnu_pbds::detail::rb_tree_set<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>::const_reference = const std::pair<int, int>&]
 PB_DS_CLASS_C_DEC::
 ^
/usr/include/c++/4.8/ext/pb_ds/detail/rb_tree_map_/insert_fn_imps.hpp:43:1: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to '__gnu_pbds::detail::rb_tree_set<std::pair<int, int>, __gnu_pbds::null_type, std::less<std::pair<int, int> >, __gnu_pbds::detail::tree_traits<std::pair<int, int>, __gnu_pbds::null_type, std::less<std::pair<int, int> >, __gnu_pbds::tree_order_statistics_node_update, __gnu_pbds::rb_tree_tag, std::allocator<char> >, std::allocator<char> >::const_reference {aka const std::pair<int, int>&}'
median_heaps.cpp:108:44: error: no matching function for call to '__gnu_pbds::tree<std::pair<int, int>, __gnu_pbds::null_type, std::less<std::pair<int, int> >, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update>::insert(<brace-enclosed initializer list>)'
                 oset.insert({a[stcur], z++});

                                            ^
median_heaps.cpp:108:44: note: candidate is:
In file included from /usr/include/c++/4.8/ext/pb_ds/detail/container_base_dispatch.hpp:85:0,
                 from /usr/include/c++/4.8/ext/pb_ds/assoc_container.hpp:48,
                 from median_heaps.cpp:7:
/usr/include/c++/4.8/ext/pb_ds/detail/rb_tree_map_/insert_fn_imps.hpp:43:1: note: std::pair<typename __gnu_pbds::detail::bin_search_tree_set<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>::point_iterator, bool> __gnu_pbds::detail::rb_tree_set<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>::insert(__gnu_pbds::detail::rb_tree_set<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>::const_reference) [with Key = std::pair<int, int>; Mapped = __gnu_pbds::null_type; Cmp_Fn = std::less<std::pair<int, int> >; Node_And_It_Traits = __gnu_pbds::detail::tree_traits<std::pair<int, int>, __gnu_pbds::null_type, std::less<std::pair<int, int> >, __gnu_pbds::tree_order_statistics_node_update, __gnu_pbds::rb_tree_tag, std::allocator<char> >; _Alloc = std::allocator<char>; typename __gnu_pbds::detail::bin_search_tree_set<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>::point_iterator = __gnu_pbds::detail::bin_search_tree_const_it_<__gnu_pbds::detail::rb_tree_node_<std::pair<int, int>, unsigned int, std::allocator<char> >*, std::pair<int, int>, std::pair<int, int>*, const std::pair<int, int>*, std::pair<int, int>&, const std::pair<int, int>&, true, std::allocator<char> >; __gnu_pbds::detail::rb_tree_set<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>::const_reference = const std::pair<int, int>&]
 PB_DS_CLASS_C_DEC::
 ^
/usr/include/c++/4.8/ext/pb_ds/detail/rb_tree_map_/insert_fn_imps.hpp:43:1: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to '__gnu_pbds::detail::rb_tree_set<std::pair<int, int>, __gnu_pbds::null_type, std::less<std::pair<int, int> >, __gnu_pbds::detail::tree_traits<std::pair<int, int>, __gnu_pbds::null_type, std::less<std::pair<int, int> >, __gnu_pbds::tree_order_statistics_node_update, __gnu_pbds::rb_tree_tag, std::allocator<char> >, std::allocator<char> >::const_reference {aka const std::pair<int, int>&}'
median_heaps.cpp:115:58: error: no matching function for call to '__gnu_pbds::tree<std::pair<int, int>, __gnu_pbds::null_type, std::less<std::pair<int, int> >, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update>::lower_bound(<brace-enclosed initializer list>)'
                 oset.erase(oset.lower_bound({a[stcur], 0}));

                                                          ^
median_heaps.cpp:115:58: note: candidates are:
In file included from /usr/include/c++/4.8/ext/pb_ds/detail/container_base_dispatch.hpp:84:0,
                 from /usr/include/c++/4.8/ext/pb_ds/assoc_container.hpp:48,
                 from median_heaps.cpp:7:
/usr/include/c++/4.8/ext/pb_ds/detail/bin_search_tree_/find_fn_imps.hpp:62:1: note: __gnu_pbds::detail::bin_search_tree_set<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>::point_iterator __gnu_pbds::detail::bin_search_tree_set<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>::lower_bound(__gnu_pbds::detail::bin_search_tree_set<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>::key_const_reference) [with Key = std::pair<int, int>; Mapped = __gnu_pbds::null_type; Cmp_Fn = std::less<std::pair<int, int> >; Node_And_It_Traits = __gnu_pbds::detail::tree_traits<std::pair<int, int>, __gnu_pbds::null_type, std::less<std::pair<int, int> >, __gnu_pbds::tree_order_statistics_node_update, __gnu_pbds::rb_tree_tag, std::allocator<char> >; _Alloc = std::allocator<char>; __gnu_pbds::detail::bin_search_tree_set<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>::point_iterator = __gnu_pbds::detail::bin_search_tree_const_it_<__gnu_pbds::detail::rb_tree_node_<std::pair<int, int>, unsigned int, std::allocator<char> >*, std::pair<int, int>, std::pair<int, int>*, const std::pair<int, int>*, std::pair<int, int>&, const std::pair<int, int>&, true, std::allocator<char> >; __gnu_pbds::detail::bin_search_tree_set<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>::key_const_reference = const std::pair<int, int>&]
 PB_DS_CLASS_C_DEC::
 ^
/usr/include/c++/4.8/ext/pb_ds/detail/bin_search_tree_/find_fn_imps.hpp:62:1: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to '__gnu_pbds::detail::bin_search_tree_set<std::pair<int, int>, __gnu_pbds::null_type, std::less<std::pair<int, int> >, __gnu_pbds::detail::tree_traits<std::pair<int, int>, __gnu_pbds::null_type, std::less<std::pair<int, int> >, __gnu_pbds::tree_order_statistics_node_update, __gnu_pbds::rb_tree_tag, std::allocator<char> >, std::allocator<char> >::key_const_reference {aka const std::pair<int, int>&}'
/usr/include/c++/4.8/ext/pb_ds/detail/bin_search_tree_/find_fn_imps.hpp:43:1: note: __gnu_pbds::detail::bin_search_tree_set<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>::point_const_iterator __gnu_pbds::detail::bin_search_tree_set<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>::lower_bound(__gnu_pbds::detail::bin_search_tree_set<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>::key_const_reference) const [with Key = std::pair<int, int>; Mapped = __gnu_pbds::null_type; Cmp_Fn = std::less<std::pair<int, int> >; Node_And_It_Traits = __gnu_pbds::detail::tree_traits<std::pair<int, int>, __gnu_pbds::null_type, std::less<std::pair<int, int> >, __gnu_pbds::tree_order_statistics_node_update, __gnu_pbds::rb_tree_tag, std::allocator<char> >; _Alloc = std::allocator<char>; __gnu_pbds::detail::bin_search_tree_set<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>::point_const_iterator = __gnu_pbds::detail::bin_search_tree_const_it_<__gnu_pbds::detail::rb_tree_node_<std::pair<int, int>, unsigned int, std::allocator<char> >*, std::pair<int, int>, std::pair<int, int>*, const std::pair<int, int>*, std::pair<int, int>&, const std::pair<int, int>&, true, std::allocator<char> >; __gnu_pbds::detail::bin_search_tree_set<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>::key_const_reference = const std::pair<int, int>&]
 PB_DS_CLASS_C_DEC::
 ^
/usr/include/c++/4.8/ext/pb_ds/detail/bin_search_tree_/find_fn_imps.hpp:43:1: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to '__gnu_pbds::detail::bin_search_tree_set<std::pair<int, int>, __gnu_pbds::null_type, std::less<std::pair<int, int> >, __gnu_pbds::detail::tree_traits<std::pair<int, int>, __gnu_pbds::null_type, std::less<std::pair<int, int> >, __gnu_pbds::tree_order_statistics_node_update, __gnu_pbds::rb_tree_tag, std::allocator<char> >, std::allocator<char> >::key_const_reference {aka const std::pair<int, int>&}'
median_heaps.cpp:123:58: error: no matching function for call to '__gnu_pbds::tree<std::pair<int, int>, __gnu_pbds::null_type, std::less<std::pair<int, int> >, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update>::lower_bound(<brace-enclosed initializer list>)'
                 oset.erase(oset.lower_bound({a[drcur], 0}));

                                                          ^
median_heaps.cpp:123:58: note: candidates are:
In file included from /usr/include/c++/4.8/ext/pb_ds/detail/container_base_dispatch.hpp:84:0,
                 from /usr/include/c++/4.8/ext/pb_ds/assoc_container.hpp:48,
                 from median_heaps.cpp:7:
/usr/include/c++/4.8/ext/pb_ds/detail/bin_search_tree_/find_fn_imps.hpp:62:1: note: __gnu_pbds::detail::bin_search_tree_set<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>::point_iterator __gnu_pbds::detail::bin_search_tree_set<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>::lower_bound(__gnu_pbds::detail::bin_search_tree_set<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>::key_const_reference) [with Key = std::pair<int, int>; Mapped = __gnu_pbds::null_type; Cmp_Fn = std::less<std::pair<int, int> >; Node_And_It_Traits = __gnu_pbds::detail::tree_traits<std::pair<int, int>, __gnu_pbds::null_type, std::less<std::pair<int, int> >, __gnu_pbds::tree_order_statistics_node_update, __gnu_pbds::rb_tree_tag, std::allocator<char> >; _Alloc = std::allocator<char>; __gnu_pbds::detail::bin_search_tree_set<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>::point_iterator = __gnu_pbds::detail::bin_search_tree_const_it_<__gnu_pbds::detail::rb_tree_node_<std::pair<int, int>, unsigned int, std::allocator<char> >*, std::pair<int, int>, std::pair<int, int>*, const std::pair<int, int>*, std::pair<int, int>&, const std::pair<int, int>&, true, std::allocator<char> >; __gnu_pbds::detail::bin_search_tree_set<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>::key_const_reference = const std::pair<int, int>&]
 PB_DS_CLASS_C_DEC::
 ^
/usr/include/c++/4.8/ext/pb_ds/detail/bin_search_tree_/find_fn_imps.hpp:62:1: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to '__gnu_pbds::detail::bin_search_tree_set<std::pair<int, int>, __gnu_pbds::null_type, std::less<std::pair<int, int> >, __gnu_pbds::detail::tree_traits<std::pair<int, int>, __gnu_pbds::null_type, std::less<std::pair<int, int> >, __gnu_pbds::tree_order_statistics_node_update, __gnu_pbds::rb_tree_tag, std::allocator<char> >, std::allocator<char> >::key_const_reference {aka const std::pair<int, int>&}'
/usr/include/c++/4.8/ext/pb_ds/detail/bin_search_tree_/find_fn_imps.hpp:43:1: note: __gnu_pbds::detail::bin_search_tree_set<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>::point_const_iterator __gnu_pbds::detail::bin_search_tree_set<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>::lower_bound(__gnu_pbds::detail::bin_search_tree_set<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>::key_const_reference) const [with Key = std::pair<int, int>; Mapped = __gnu_pbds::null_type; Cmp_Fn = std::less<std::pair<int, int> >; Node_And_It_Traits = __gnu_pbds::detail::tree_traits<std::pair<int, int>, __gnu_pbds::null_type, std::less<std::pair<int, int> >, __gnu_pbds::tree_order_statistics_node_update, __gnu_pbds::rb_tree_tag, std::allocator<char> >; _Alloc = std::allocator<char>; __gnu_pbds::detail::bin_search_tree_set<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>::point_const_iterator = __gnu_pbds::detail::bin_search_tree_const_it_<__gnu_pbds::detail::rb_tree_node_<std::pair<int, int>, unsigned int, std::allocator<char> >*, std::pair<int, int>, std::pair<int, int>*, const std::pair<int, int>*, std::pair<int, int>&, const std::pair<int, int>&, true, std::allocator<char> >; __gnu_pbds::detail::bin_search_tree_set<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>::key_const_reference = const std::pair<int, int>&]
 PB_DS_CLASS_C_DEC::
 ^
/usr/include/c++/4.8/ext/pb_ds/detail/bin_search_tree_/find_fn_imps.hpp:43:1: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to '__gnu_pbds::detail::bin_search_tree_set<std::pair<int, int>, __gnu_pbds::null_type, std::less<std::pair<int, int> >, __gnu_pbds::detail::tree_traits<std::pair<int, int>, __gnu_pbds::null_type, std::less<std::pair<int, int> >, __gnu_pbds::tree_order_statistics_node_update, __gnu_pbds::rb_tree_tag, std::allocator<char> >, std::allocator<char> >::key_const_reference {aka const std::pair<int, int>&}'
median_heaps.cpp:127:13: warning: unused variable 'valu' [-Wunused-variable]
         int valu = oset.find_by_order((right - left + 2) / 2 - 1)->first;

             ^

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