Detalii evaluare #64013205

Rezumat problemă

#873

Se dau dau două vase cu capacitatea A, respectiv B litri. Se cere să se măsoare cu ajutorul lor C litri de apă.

Detalii

Problema Vase Operații I/O tastatură/ecran
Limita timp 0.1 secunde Limita memorie Total: 64 MB / Stivă 8 MB
Id soluție #64013205 Utilizator Girigan Andrei (AndreiGir)
Fișier vase.cpp Dimensiune 3.22 KB
Data încărcării 05 Aprilie 2026, 18:35 Scor/rezultat Eroare de compilare

Evaluare

Mesaj compilare

vase.cpp: In function 'int main()':
vase.cpp:32:14: error: expected unqualified-id before '[' token
         auto [a, b] = q.front();

              ^
vase.cpp:36:13: error: 'a' was not declared in this scope
         if (a == C || b == C) {

             ^
vase.cpp:36:23: error: 'b' was not declared in this scope
         if (a == C || b == C) {

                       ^
vase.cpp:37:20: error: no match for 'operator=' (operand types are 'std::pair<int, int>' and '<brace-enclosed initializer list>')
             target = {a, b};

                    ^
vase.cpp:37:20: note: candidates are:
In file included from /usr/include/c++/4.8/bits/stl_algobase.h:64:0,
                 from /usr/include/c++/4.8/bits/char_traits.h:39,
                 from /usr/include/c++/4.8/ios:40,
                 from /usr/include/c++/4.8/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from vase.cpp:1:
/usr/include/c++/4.8/bits/stl_pair.h:158:7: note: std::pair<_T1, _T2>& std::pair<_T1, _T2>::operator=(const std::pair<_T1, _T2>&) [with _T1 = int; _T2 = int]
       operator=(const pair& __p)
       ^
/usr/include/c++/4.8/bits/stl_pair.h:158:7: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const std::pair<int, int>&'
/usr/include/c++/4.8/bits/stl_pair.h:166:7: note: std::pair<_T1, _T2>& std::pair<_T1, _T2>::operator=(std::pair<_T1, _T2>&&) [with _T1 = int; _T2 = int]
       operator=(pair&& __p)
       ^
/usr/include/c++/4.8/bits/stl_pair.h:166:7: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::pair<int, int>&&'
/usr/include/c++/4.8/bits/stl_pair.h:177:2: note: template<class _U1, class _U2> std::pair<_T1, _T2>& std::pair<_T1, _T2>::operator=(const std::pair<_U1, _U2>&) [with _U1 = _U1; _U2 = _U2; _T1 = int; _T2 = int]
  operator=(const pair<_U1, _U2>& __p)
  ^
/usr/include/c++/4.8/bits/stl_pair.h:177:2: note:   template argument deduction/substitution failed:
vase.cpp:37:20: note:   couldn't deduce template parameter '_U1'
             target = {a, b};

                    ^
In file included from /usr/include/c++/4.8/bits/stl_algobase.h:64:0,
                 from /usr/include/c++/4.8/bits/char_traits.h:39,
                 from /usr/include/c++/4.8/ios:40,
                 from /usr/include/c++/4.8/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from vase.cpp:1:
/usr/include/c++/4.8/bits/stl_pair.h:186:2: note: template<class _U1, class _U2> std::pair<_T1, _T2>& std::pair<_T1, _T2>::operator=(std::pair<_U1, _U2>&&) [with _U1 = _U1; _U2 = _U2; _T1 = int; _T2 = int]
  operator=(pair<_U1, _U2>&& __p)
  ^
/usr/include/c++/4.8/bits/stl_pair.h:186:2: note:   template argument deduction/substitution failed:
vase.cpp:37:20: note:   couldn't deduce template parameter '_U1'
             target = {a, b};

                    ^
vase.cpp:42:13: error: 'a' was not declared in this scope
         if (a < A) {

             ^
vase.cpp:43:39: error: 'b' was not declared in this scope
             pair<int, int> next = {A, b};

                                       ^
vase.cpp:43:40: error: could not convert '{A, <expression error>}' from '<brace-enclosed initializer list>' to 'std::pair<int, int>'
             pair<int, int> next = {A, b};

                                        ^
vase.cpp:51:13: error: 'b' was not declared in this scope
         if (b < B) {

             ^
vase.cpp:52:36: error: 'a' was not declared in this scope
             pair<int, int> next = {a, B};

                                    ^
vase.cpp:52:40: error: could not convert '{<expression error>, B}' from '<brace-enclosed initializer list>' to 'std::pair<int, int>'
             pair<int, int> next = {a, B};

                                        ^
vase.cpp:60:13: error: 'a' was not declared in this scope
         if (a > 0) {

             ^
vase.cpp:61:39: error: 'b' was not declared in this scope
             pair<int, int> next = {0, b};

                                       ^
vase.cpp:61:40: error: could not convert '{0, <expression error>}' from '<brace-enclosed initializer list>' to 'std::pair<int, int>'
             pair<int, int> next = {0, b};

                                        ^
vase.cpp:69:13: error: 'b' was not declared in this scope
         if (b > 0) {

             ^
vase.cpp:70:36: error: 'a' was not declared in this scope
             pair<int, int> next = {a, 0};

                                    ^
vase.cpp:70:40: error: could not convert '{<expression error>, 0}' from '<brace-enclosed initializer list>' to 'std::pair<int, int>'
             pair<int, int> next = {a, 0};

                                        ^
vase.cpp:78:13: error: 'a' was not declared in this scope
         if (a > 0 && b < B) {

             ^
vase.cpp:78:22: error: 'b' was not declared in this scope
         if (a > 0 && b < B) {

                      ^
vase.cpp:80:54: error: could not convert '{<expression error>, <expression error>}' from '<brace-enclosed initializer list>' to 'std::pair<int, int>'
             pair<int, int> next = {a - pour, b + pour};

                                                      ^
vase.cpp:88:13: error: 'b' was not declared in this scope
         if (b > 0 && a < A) {

             ^
vase.cpp:88:22: error: 'a' was not declared in this scope
         if (b > 0 && a < A) {

                      ^
vase.cpp:90:54: error: could not convert '{<expression error>, <expression error>}' from '<brace-enclosed initializer list>' to 'std::pair<int, int>'
             pair<int, int> next = {a + pour, b - pour};

                                                      ^
In file included from /usr/include/c++/4.8/bits/stl_map.h:63:0,
                 from /usr/include/c++/4.8/map:61,
                 from vase.cpp:5:
/usr/include/c++/4.8/tuple: In instantiation of 'std::pair<_T1, _T2>::pair(std::tuple<_Args1 ...>&, std::tuple<_Args2 ...>&, std::_Index_tuple<_Indexes1 ...>, std::_Index_tuple<_Indexes2 ...>) [with _Args1 = {std::pair<int, int>&&}; unsigned int ..._Indexes1 = {0u}; _Args2 = {}; unsigned int ..._Indexes2 = {}; _T1 = const std::pair<int, int>; _T2 = State]':
/usr/include/c++/4.8/tuple:1079:63:   required from 'std::pair<_T1, _T2>::pair(std::piecewise_construct_t, std::tuple<_Args1 ...>, std::tuple<_Args2 ...>) [with _Args1 = {std::pair<int, int>&&}; _Args2 = {}; _T1 = const std::pair<int, int>; _T2 = State]'
/usr/include/c++/4.8/bits/stl_tree.h:140:49:   required from 'std::_Rb_tree_node<_Val>::_Rb_tree_node(_Args&& ...) [with _Args = {const std::piecewise_construct_t&, std::tuple<std::pair<int, int>&&>, std::tuple<>}; _Val = std::pair<const std::pair<int, int>, State>]'
/usr/include/c++/4.8/ext/new_allocator.h:120:4:   required from 'void __gnu_cxx::new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = std::_Rb_tree_node<std::pair<const std::pair<int, int>, State> >; _Args = {const std::piecewise_construct_t&, std::tuple<std::pair<int, int>&&>, std::tuple<>}; _Tp = std::_Rb_tree_node<std::pair<const std::pair<int, int>, State> >]'
/usr/include/c++/4.8/bits/alloc_traits.h:254:4:   required from 'static typename std::enable_if<std::allocator_traits<_Alloc>::__construct_helper<_Tp, _Args>::value, void>::type std::allocator_traits<_Alloc>::_S_construct(_Alloc&, _Tp*, _Args&& ...) [with _Tp = std::_Rb_tree_node<std::pair<const std::pair<int, int>, State> >; _Args = {const std::piecewise_construct_t&, std::tuple<std::pair<int, int>&&>, std::tuple<>}; _Alloc = std::allocator<std::_Rb_tree_node<std::pair<const std::pair<int, int>, State> > >; typename std::enable_if<std::allocator_traits<_Alloc>::__construct_helper<_Tp, _Args>::value, void>::type = void]'
/usr/include/c++/4.8/bits/alloc_traits.h:393:57:   required from 'static decltype (_S_construct(__a, __p, (forward<_Args>)(std::allocator_traits::construct::__args)...)) std::allocator_traits<_Alloc>::construct(_Alloc&, _Tp*, _Args&& ...) [with _Tp = std::_Rb_tree_node<std::pair<const std::pair<int, int>, State> >; _Args = {const std::piecewise_construct_t&, std::tuple<std::pair<int, int>&&>, std::tuple<>}; _Alloc = std::allocator<std::_Rb_tree_node<std::pair<const std::pair<int, int>, State> > >; decltype (_S_construct(__a, __p, (forward<_Args>)(std::allocator_traits::construct::__args)...)) = <type error>]'
/usr/include/c++/4.8/bits/stl_tree.h:408:36:   required from 'std::_Rb_tree_node<_Val>* std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_create_node(_Args&& ...) [with _Args = {const std::piecewise_construct_t&, std::tuple<std::pair<int, int>&&>, std::tuple<>}; _Key = std::pair<int, int>; _Val = std::pair<const std::pair<int, int>, State>; _KeyOfValue = std::_Select1st<std::pair<const std::pair<int, int>, State> >; _Compare = std::less<std::pair<int, int> >; _Alloc = std::allocator<std::pair<const std::pair<int, int>, State> >; std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Link_type = std::_Rb_tree_node<std::pair<const std::pair<int, int>, State> >*]'
/usr/include/c++/4.8/bits/stl_tree.h:1669:64:   required from 'std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_emplace_hint_unique(std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator, _Args&& ...) [with _Args = {const std::piecewise_construct_t&, std::tuple<std::pair<int, int>&&>, std::tuple<>}; _Key = std::pair<int, int>; _Val = std::pair<const std::pair<int, int>, State>; _KeyOfValue = std::_Select1st<std::pair<const std::pair<int, int>, State> >; _Compare = std::less<std::pair<int, int> >; _Alloc = std::allocator<std::pair<const std::pair<int, int>, State> >; std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator = std::_Rb_tree_iterator<std::pair<const std::pair<int, int>, State> >; std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator = std::_Rb_tree_const_iterator<std::pair<const std::pair<int, int>, State> >]'
/usr/include/c++/4.8/bits/stl_map.h:484:8:   required from 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](std::map<_Key, _Tp, _Compare, _Alloc>::key_type&&) [with _Key = std::pair<int, int>; _Tp = State; _Compare = std::less<std::pair<int, int> >; _Alloc = std::allocator<std::pair<const std::pair<int, int>, State> >; std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type = State; std::map<_Key, _Tp, _Compare, _Alloc>::key_type = std::pair<int, int>]'
vase.cpp:27:19:   required from here
/usr/include/c++/4.8/tuple:1090:70: error: no matching function for call to 'State::State()'
         second(std::forward<_Args2>(std::get<_Indexes2>(__tuple2))...)
                                                                      ^
/usr/include/c++/4.8/tuple:1090:70: note: candidates are:
vase.cpp:15:5: note: State::State(int, int, std::string, int, int)
     State(int a, int b, string move, int prev_a, int prev_b) 

     ^
vase.cpp:15:5: note:   candidate expects 5 arguments, 0 provided
vase.cpp:10:8: note: State::State(const State&)
 struct State {

        ^
vase.cpp:10:8: note:   candidate expects 1 argument, 0 provided
vase.cpp:10:8: note: State::State(State&&)
vase.cpp:10:8: note:   candidate expects 1 argument, 0 provided
In file included from /usr/include/c++/4.8/bits/stl_map.h:63:0,
                 from /usr/include/c++/4.8/map:61,
                 from vase.cpp:5:
/usr/include/c++/4.8/tuple: In instantiation of 'std::pair<_T1, _T2>::pair(std::tuple<_Args1 ...>&, std::tuple<_Args2 ...>&, std::_Index_tuple<_Indexes1 ...>, std::_Index_tuple<_Indexes2 ...>) [with _Args1 = {const std::pair<int, int>&}; unsigned int ..._Indexes1 = {0u}; _Args2 = {}; unsigned int ..._Indexes2 = {}; _T1 = const std::pair<int, int>; _T2 = State]':
/usr/include/c++/4.8/tuple:1079:63:   required from 'std::pair<_T1, _T2>::pair(std::piecewise_construct_t, std::tuple<_Args1 ...>, std::tuple<_Args2 ...>) [with _Args1 = {const std::pair<int, int>&}; _Args2 = {}; _T1 = const std::pair<int, int>; _T2 = State]'
/usr/include/c++/4.8/bits/stl_tree.h:140:49:   required from 'std::_Rb_tree_node<_Val>::_Rb_tree_node(_Args&& ...) [with _Args = {const std::piecewise_construct_t&, std::tuple<const std::pair<int, int>&>, std::tuple<>}; _Val = std::pair<const std::pair<int, int>, State>]'
/usr/include/c++/4.8/ext/new_allocator.h:120:4:   required from 'void __gnu_cxx::new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = std::_Rb_tree_node<std::pair<const std::pair<int, int>, State> >; _Args = {const std::piecewise_construct_t&, std::tuple<const std::pair<int, int>&>, std::tuple<>}; _Tp = std::_Rb_tree_node<std::pair<const std::pair<int, int>, State> >]'
/usr/include/c++/4.8/bits/alloc_traits.h:254:4:   required from 'static typename std::enable_if<std::allocator_traits<_Alloc>::__construct_helper<_Tp, _Args>::value, void>::type std::allocator_traits<_Alloc>::_S_construct(_Alloc&, _Tp*, _Args&& ...) [with _Tp = std::_Rb_tree_node<std::pair<const std::pair<int, int>, State> >; _Args = {const std::piecewise_construct_t&, std::tuple<const std::pair<int, int>&>, std::tuple<>}; _Alloc = std::allocator<std::_Rb_tree_node<std::pair<const std::pair<int, int>, State> > >; typename std::enable_if<std::allocator_traits<_Alloc>::__construct_helper<_Tp, _Args>::value, void>::type = void]'
/usr/include/c++/4.8/bits/alloc_traits.h:393:57:   required from 'static decltype (_S_construct(__a, __p, (forward<_Args>)(std::allocator_traits::construct::__args)...)) std::allocator_traits<_Alloc>::construct(_Alloc&, _Tp*, _Args&& ...) [with _Tp = std::_Rb_tree_node<std::pair<const std::pair<int, int>, State> >; _Args = {const std::piecewise_construct_t&, std::tuple<const std::pair<int, int>&>, std::tuple<>}; _Alloc = std::allocator<std::_Rb_tree_node<std::pair<const std::pair<int, int>, State> > >; decltype (_S_construct(__a, __p, (forward<_Args>)(std::allocator_traits::construct::__args)...)) = <type error>]'
/usr/include/c++/4.8/bits/stl_tree.h:408:36:   required from 'std::_Rb_tree_node<_Val>* std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_create_node(_Args&& ...) [with _Args = {const std::piecewise_construct_t&, std::tuple<const std::pair<int, int>&>, std::tuple<>}; _Key = std::pair<int, int>; _Val = std::pair<const std::pair<int, int>, State>; _KeyOfValue = std::_Select1st<std::pair<const std::pair<int, int>, State> >; _Compare = std::less<std::pair<int, int> >; _Alloc = std::allocator<std::pair<const std::pair<int, int>, State> >; std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Link_type = std::_Rb_tree_node<std::pair<const std::pair<int, int>, State> >*]'
/usr/include/c++/4.8/bits/stl_tree.h:1669:64:   required from 'std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_emplace_hint_unique(std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator, _Args&& ...) [with _Args = {const std::piecewise_construct_t&, std::tuple<const std::pair<int, int>&>, std::tuple<>}; _Key = std::pair<int, int>; _Val = std::pair<const std::pair<int, int>, State>; _KeyOfValue = std::_Select1st<std::pair<const std::pair<int, int>, State> >; _Compare = std::less<std::pair<int, int> >; _Alloc = std::allocator<std::pair<const std::pair<int, int>, State> >; std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator = std::_Rb_tree_iterator<std::pair<const std::pair<int, int>, State> >; std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator = std::_Rb_tree_const_iterator<std::pair<const std::pair<int, int>, State> >]'
/usr/include/c++/4.8/bits/stl_map.h:465:8:   required from 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const key_type&) [with _Key = std::pair<int, int>; _Tp = State; _Compare = std::less<std::pair<int, int> >; _Alloc = std::allocator<std::pair<const std::pair<int, int>, State> >; std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type = State; std::map<_Key, _Tp, _Compare, _Alloc>::key_type = std::pair<int, int>]'
vase.cpp:45:29:   required from here
/usr/include/c++/4.8/tuple:1090:70: error: no matching function for call to 'State::State()'
         second(std::forward<_Args2>(std::get<_Indexes2>(__tuple2))...)
                                                                      ^
/usr/include/c++/4.8/tuple:1090:70: note: candidates are:
vase.cpp:15:5: note: State::State(int, int, std::string, int, int)
     State(int a, int b, string move, int prev_a, int prev_b) 

     ^
vase.cpp:15:5: note:   candidate expects 5 arguments, 0 provided
vase.cpp:10:8: note: State::State(const State&)
 struct State {

        ^
vase.cpp:10:8: note:   candidate expects 1 argument, 0 provided
vase.cpp:10:8: note: State::State(State&&)
vase.cpp:10:8: note:   candidate expects 1 argument, 0 provided

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 Vase 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!