Detalii evaluare #57821915

Rezumat problemă

pitici1

#4213

În vârful muntelui Acrom trăiesc pe timpul verii K pitici, numerotaţi de la 1 la K. Pe munte există N cabane, aflate la altitudini diferite, legate între ele de M poteci. Cabana piticilor este numerotată cu 1, iar cabana de la poalele muntelui cu N. Fiindcă iarna este prea frig, piticii se mută în cabana de la poalele muntelui, unde este mai cald. Piticii sunt disciplinaţi şi coboară de pe munte în ordinea crescătoare a numerelor lor. Scrieţi un program care să determine lungimea drumului ales de fiecare pitic, drum ce respectă condiţiile din enunţ.

Lot informatică, Ploiești, 2006

Fișiere Pracsiu Dan (dnprx) Dan-Ionuț Fechete concurs

Detalii

Problema pitici1 Operații I/O pitici.in/pitici.out
Limita timp 0.5 secunde Limita memorie Total: 128 MB / Stivă 64 MB
Id soluție #57821915 Utilizator Stefan Susanu (stefan_313)
Fișier pitici1.cpp Dimensiune 1.54 KB
Data încărcării 22 Aprilie 2025, 14:23 Scor / rezultat Eroare de compilare

Evaluare

Mesaj compilare

pitici1.cpp: In function 'int main()':
pitici1.cpp:35:29: error: converting to 'std::priority_queue<std::tuple<long long int, int, std::vector<int, std::allocator<int> > >, std::vector<std::tuple<long long int, int, std::vector<int, std::allocator<int> > > >, main()::__lambda0>::value_type {aka std::tuple<long long int, int, std::vector<int, std::allocator<int> > >}' from initializer list would use explicit constructor 'constexpr std::tuple< <template-parameter-1-1> >::tuple(const _Elements& ...) [with _Elements = {long long int, int, std::vector<int, std::allocator<int> >}]'
     coada.push({ 0, 1, {1} });

                             ^
pitici1.cpp:40:39: error: conversion from 'const value_type {aka const std::tuple<long long int, int, std::vector<int, std::allocator<int> > >}' to non-scalar type 'std::pair<long long int, int>' requested
         pair<ll, int> top = coada.top();

                                       ^
pitici1.cpp:45:38: error: no matching function for call to 'get(std::pair<long long int, int>&)'
         vector<int> drum = get<2>(top);  

                                      ^
pitici1.cpp:45:38: note: candidates are:
In file included from /usr/include/c++/4.8/algorithm:60:0,
                 from pitici1.cpp:4:
/usr/include/c++/4.8/utility:142:5: note: template<unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& std::get(std::pair<_Tp1, _Tp2>&)
     get(std::pair<_Tp1, _Tp2>& __in) noexcept
     ^
/usr/include/c++/4.8/utility:142:5: note:   template argument deduction/substitution failed:
/usr/include/c++/4.8/utility: In substitution of 'template<unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& std::get(std::pair<_Tp1, _Tp2>&) [with unsigned int _Int = 2u; _Tp1 = long long int; _Tp2 = int]':
pitici1.cpp:45:38:   required from here
/usr/include/c++/4.8/utility:142:5: error: invalid use of incomplete type 'struct std::tuple_element<2u, std::pair<long long int, int> >'
/usr/include/c++/4.8/utility:84:11: error: declaration of 'struct std::tuple_element<2u, std::pair<long long int, int> >'
     class tuple_element;
           ^
/usr/include/c++/4.8/utility:147:5: note: template<unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&& std::get(std::pair<_Tp1, _Tp2>&&)
     get(std::pair<_Tp1, _Tp2>&& __in) noexcept
     ^
/usr/include/c++/4.8/utility:147:5: note:   template argument deduction/substitution failed:
/usr/include/c++/4.8/utility: In substitution of 'template<unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&& std::get(std::pair<_Tp1, _Tp2>&&) [with unsigned int _Int = 2u; _Tp1 = long long int; _Tp2 = int]':
pitici1.cpp:45:38:   required from here
/usr/include/c++/4.8/utility:147:5: error: invalid use of incomplete type 'struct std::tuple_element<2u, std::pair<long long int, int> >'
/usr/include/c++/4.8/utility:84:11: error: declaration of 'struct std::tuple_element<2u, std::pair<long long int, int> >'
     class tuple_element;
           ^
/usr/include/c++/4.8/utility:152:5: note: template<unsigned int _Int, class _Tp1, class _Tp2> constexpr const typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& std::get(const std::pair<_Tp1, _Tp2>&)
     get(const std::pair<_Tp1, _Tp2>& __in) noexcept
     ^
/usr/include/c++/4.8/utility:152:5: note:   template argument deduction/substitution failed:
/usr/include/c++/4.8/utility: In substitution of 'template<unsigned int _Int, class _Tp1, class _Tp2> constexpr const typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& std::get(const std::pair<_Tp1, _Tp2>&) [with unsigned int _Int = 2u; _Tp1 = long long int; _Tp2 = int]':
pitici1.cpp:45:38:   required from here
/usr/include/c++/4.8/utility:152:5: error: invalid use of incomplete type 'struct std::tuple_element<2u, std::pair<long long int, int> >'
/usr/include/c++/4.8/utility:84:11: error: declaration of 'struct std::tuple_element<2u, std::pair<long long int, int> >'
     class tuple_element;
           ^
In file included from /usr/include/c++/4.8/tuple:39:0,
                 from /usr/include/c++/4.8/functional:55,
                 from /usr/include/c++/4.8/bits/stl_algo.h:66,
                 from /usr/include/c++/4.8/algorithm:62,
                 from pitici1.cpp:4:
/usr/include/c++/4.8/array:268:5: note: template<unsigned int _Int, class _Tp, unsigned int _Nm> constexpr _Tp& std::get(std::array<_Tp, _Nm>&)
     get(array<_Tp, _Nm>& __arr) noexcept
     ^
/usr/include/c++/4.8/array:268:5: note:   template argument deduction/substitution failed:
pitici1.cpp:45:38: note:   'std::pair<long long int, int>' is not derived from 'std::array<_Tp, _Nm>'
         vector<int> drum = get<2>(top);  

                                      ^
In file included from /usr/include/c++/4.8/tuple:39:0,
                 from /usr/include/c++/4.8/functional:55,
                 from /usr/include/c++/4.8/bits/stl_algo.h:66,
                 from /usr/include/c++/4.8/algorithm:62,
                 from pitici1.cpp:4:
/usr/include/c++/4.8/array:277:5: note: template<unsigned int _Int, class _Tp, unsigned int _Nm> constexpr _Tp&& std::get(std::array<_Tp, _Nm>&&)
     get(array<_Tp, _Nm>&& __arr) noexcept
     ^
/usr/include/c++/4.8/array:277:5: note:   template argument deduction/substitution failed:
pitici1.cpp:45:38: note:   'std::pair<long long int, int>' is not derived from 'std::array<_Tp, _Nm>'
         vector<int> drum = get<2>(top);  

                                      ^
In file included from /usr/include/c++/4.8/tuple:39:0,
                 from /usr/include/c++/4.8/functional:55,
                 from /usr/include/c++/4.8/bits/stl_algo.h:66,
                 from /usr/include/c++/4.8/algorithm:62,
                 from pitici1.cpp:4:
/usr/include/c++/4.8/array:285:5: note: template<unsigned int _Int, class _Tp, unsigned int _Nm> constexpr const _Tp& std::get(const std::array<_Tp, _Nm>&)
     get(const array<_Tp, _Nm>& __arr) noexcept
     ^
/usr/include/c++/4.8/array:285:5: note:   template argument deduction/substitution failed:
pitici1.cpp:45:38: note:   'std::pair<long long int, int>' is not derived from 'const std::array<_Tp, _Nm>'
         vector<int> drum = get<2>(top);  

                                      ^
In file included from /usr/include/c++/4.8/functional:55:0,
                 from /usr/include/c++/4.8/bits/stl_algo.h:66,
                 from /usr/include/c++/4.8/algorithm:62,
                 from pitici1.cpp:4:
/usr/include/c++/4.8/tuple:759:5: note: template<unsigned int __i, class ... _Elements> constexpr typename std::__add_ref<typename std::tuple_element<__i, std::tuple<_Elements ...> >::type>::type std::get(std::tuple<_Elements ...>&)
     get(tuple<_Elements...>& __t) noexcept
     ^
/usr/include/c++/4.8/tuple:759:5: note:   template argument deduction/substitution failed:
pitici1.cpp:45:38: note:   'std::pair<long long int, int>' is not derived from 'std::tuple<_Elements ...>'
         vector<int> drum = get<2>(top);  

                                      ^
In file included from /usr/include/c++/4.8/functional:55:0,
                 from /usr/include/c++/4.8/bits/stl_algo.h:66,
                 from /usr/include/c++/4.8/algorithm:62,
                 from pitici1.cpp:4:
/usr/include/c++/4.8/tuple:766:5: note: template<unsigned int __i, class ... _Elements> constexpr typename std::__add_c_ref<typename std::tuple_element<__i, std::tuple<_Elements ...> >::type>::type std::get(const std::tuple<_Elements ...>&)
     get(const tuple<_Elements...>& __t) noexcept
     ^
/usr/include/c++/4.8/tuple:766:5: note:   template argument deduction/substitution failed:
pitici1.cpp:45:38: note:   'std::pair<long long int, int>' is not derived from 'const std::tuple<_Elements ...>'
         vector<int> drum = get<2>(top);  

                                      ^
In file included from /usr/include/c++/4.8/functional:55:0,
                 from /usr/include/c++/4.8/bits/stl_algo.h:66,
                 from /usr/include/c++/4.8/algorithm:62,
                 from pitici1.cpp:4:
/usr/include/c++/4.8/tuple:773:5: note: template<unsigned int __i, class ... _Elements> constexpr typename std::__add_r_ref<typename std::tuple_element<__i, std::tuple<_Elements ...> >::type>::type std::get(std::tuple<_Elements ...>&&)
     get(tuple<_Elements...>&& __t) noexcept
     ^
/usr/include/c++/4.8/tuple:773:5: note:   template argument deduction/substitution failed:
pitici1.cpp:45:38: note:   'std::pair<long long int, int>' is not derived from 'std::tuple<_Elements ...>'
         vector<int> drum = get<2>(top);  

                                      ^
pitici1.cpp:63:45: error: converting to 'std::priority_queue<std::tuple<long long int, int, std::vector<int, std::allocator<int> > >, std::vector<std::tuple<long long int, int, std::vector<int, std::allocator<int> > > >, main()::__lambda0>::value_type {aka std::tuple<long long int, int, std::vector<int, std::allocator<int> > >}' from initializer list would use explicit constructor 'constexpr std::tuple< <template-parameter-1-1> >::tuple(_UElements&& ...) [with _UElements = {long long int, int&, std::vector<int, std::allocator<int> >&}; <template-parameter-2-2> = void; _Elements = {long long int, int, std::vector<int, std::allocator<int> >}]'
             coada.push({ cost + w, v, nweD }); 

                                             ^

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

Du-te sus!