#873
Vase
Se dau dau două vase cu capacitatea A
, respectiv B
litri. Se cere să se măsoare cu ajutorul lor C
litri de apă.
Problema | Vase | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #53675389 | Utilizator | |
Fișier | vase.cpp | Dimensiune | 1.58 KB |
Data încărcării | 08 Noiembrie 2024, 00:03 | Scor / rezultat | Eroare de compilare |
vase.cpp: In function 'void afis(int, int)': vase.cpp:25:10: error: expected unqualified-id before '[' token auto [ta, tb, op] = t[a][b]; ^ vase.cpp:26:19: error: 'op' was not declared in this scope ans.push_back(op); ^ vase.cpp:27:18: error: 'ta' was not declared in this scope tie(a, b) = {ta, tb}; ^ vase.cpp:27:22: error: 'tb' was not declared in this scope tie(a, b) = {ta, tb}; ^ vase.cpp:27:15: error: no match for 'operator=' (operand types are 'std::tuple<int&, int&>' and '<brace-enclosed initializer list>') tie(a, b) = {ta, tb}; ^ vase.cpp:27:15: note: candidates are: 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 /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64, from vase.cpp:1: /usr/include/c++/4.8/tuple:618:7: note: std::tuple<_T1, _T2>& std::tuple<_T1, _T2>::operator=(const std::tuple<_T1, _T2>&) [with _T1 = int&; _T2 = int&] operator=(const tuple& __in) ^ /usr/include/c++/4.8/tuple:618:7: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const std::tuple<int&, int&>&' /usr/include/c++/4.8/tuple:625:7: note: std::tuple<_T1, _T2>& std::tuple<_T1, _T2>::operator=(std::tuple<_T1, _T2>&&) [with _T1 = int&; _T2 = int&] operator=(tuple&& __in) ^ /usr/include/c++/4.8/tuple:625:7: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::tuple<int&, int&>&&' /usr/include/c++/4.8/tuple:634:9: note: template<class _U1, class _U2> std::tuple<_T1, _T2>& std::tuple<_T1, _T2>::operator=(const std::tuple<_U1, _U2>&) [with _U1 = _U1; _U2 = _U2; _T1 = int&; _T2 = int&] operator=(const tuple<_U1, _U2>& __in) ^ /usr/include/c++/4.8/tuple:634:9: note: template argument deduction/substitution failed: vase.cpp:27:15: note: couldn't deduce template parameter '_U1' tie(a, b) = {ta, tb}; ^ 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 /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64, from vase.cpp:1: /usr/include/c++/4.8/tuple:642:9: note: template<class _U1, class _U2> std::tuple<_T1, _T2>& std::tuple<_T1, _T2>::operator=(std::tuple<_U1, _U2>&&) [with _U1 = _U1; _U2 = _U2; _T1 = int&; _T2 = int&] operator=(tuple<_U1, _U2>&& __in) ^ /usr/include/c++/4.8/tuple:642:9: note: template argument deduction/substitution failed: vase.cpp:27:15: note: couldn't deduce template parameter '_U1' tie(a, b) = {ta, tb}; ^ 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 /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64, from vase.cpp:1: /usr/include/c++/4.8/tuple:650:9: note: template<class _U1, class _U2> std::tuple<_T1, _T2>& std::tuple<_T1, _T2>::operator=(const std::pair<_U1, _U2>&) [with _U1 = _U1; _U2 = _U2; _T1 = int&; _T2 = int&] operator=(const pair<_U1, _U2>& __in) ^ /usr/include/c++/4.8/tuple:650:9: note: template argument deduction/substitution failed: vase.cpp:27:15: note: couldn't deduce template parameter '_U1' tie(a, b) = {ta, tb}; ^ 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 /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64, from vase.cpp:1: /usr/include/c++/4.8/tuple:659:9: note: template<class _U1, class _U2> std::tuple<_T1, _T2>& std::tuple<_T1, _T2>::operator=(std::pair<_U1, _U2>&&) [with _U1 = _U1; _U2 = _U2; _T1 = int&; _T2 = int&] operator=(pair<_U1, _U2>&& __in) ^ /usr/include/c++/4.8/tuple:659:9: note: template argument deduction/substitution failed: vase.cpp:27:15: note: couldn't deduce template parameter '_U1' tie(a, b) = {ta, tb}; ^ vase.cpp: In function 'int main()': vase.cpp:39:29: error: no matching function for call to 'std::deque<std::tuple<int, int, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::emplace_back(<brace-enclosed initializer list>)' dq.emplace_back({0, 0, ""}); ^ vase.cpp:39:29: note: candidate is: In file included from /usr/include/c++/4.8/deque:66:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:67, from vase.cpp:1: /usr/include/c++/4.8/bits/deque.tcc:131:7: note: void std::deque<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {}; _Tp = std::tuple<int, int, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >; _Alloc = std::allocator<std::tuple<int, int, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >] deque<_Tp, _Alloc>:: ^ /usr/include/c++/4.8/bits/deque.tcc:131:7: note: candidate expects 0 arguments, 1 provided vase.cpp:42:10: error: expected unqualified-id before '[' token auto [a, b, _] = dq.back(); ^ vase.cpp:44:30: error: 'a' was not declared in this scope vector<state> v = vecini(a, b); ^ vase.cpp:44:33: error: 'b' was not declared in this scope vector<state> v = vecini(a, b); ^ vase.cpp:46:12: error: expected unqualified-id before '[' token auto [na, nb, op] = nstate; ^ vase.cpp:47:15: error: 'na' was not declared in this scope if(dist[na][nb] == 0){ ^ vase.cpp:47:19: error: 'nb' was not declared in this scope if(dist[na][nb] == 0){ ^ vase.cpp:48:28: error: 'op' was not declared in this scope t[na][nb] = {a, b, op}; ^ vase.cpp:50:44: error: no matching function for call to 'std::tuple<int, int, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >::tuple(<brace-enclosed initializer list>)' dq.emplace_front((state){na, nb, op}); ^ vase.cpp:50:44: note: candidates are: 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 /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64, from vase.cpp:1: /usr/include/c++/4.8/tuple:465:2: note: template<class _Alloc, class ... _UElements, class> std::tuple< <template-parameter-1-1> >::tuple(std::allocator_arg_t, const _Alloc&, std::tuple<_Args2 ...>&&) tuple(allocator_arg_t __tag, const _Alloc& __a, ^ /usr/include/c++/4.8/tuple:465:2: note: template argument deduction/substitution failed: vase.cpp:50:44: note: cannot convert 'na' (type '<type error>') to type 'std::allocator_arg_t' dq.emplace_front((state){na, nb, op}); ^ 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 /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64, from vase.cpp:1: /usr/include/c++/4.8/tuple:456:2: note: template<class _Alloc, class ... _UElements, class> std::tuple< <template-parameter-1-1> >::tuple(std::allocator_arg_t, const _Alloc&, const std::tuple<_Args2 ...>&) tuple(allocator_arg_t __tag, const _Alloc& __a, ^ /usr/include/c++/4.8/tuple:456:2: note: template argument deduction/substitution failed: vase.cpp:50:44: note: cannot convert 'na' (type '<type error>') to type 'std::allocator_arg_t' dq.emplace_front((state){na, nb, op}); ^ 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 /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64, from vase.cpp:1: /usr/include/c++/4.8/tuple:450:2: note: template<class _Alloc> std::tuple< <template-parameter-1-1> >::tuple(std::allocator_arg_t, const _Alloc&, std::tuple< <template-parameter-1-1> >&&) tuple(allocator_arg_t __tag, const _Alloc& __a, tuple&& __in) ^ /usr/include/c++/4.8/tuple:450:2: note: template argument deduction/substitution failed: vase.cpp:50:44: note: cannot convert 'na' (type '<type error>') to type 'std::allocator_arg_t' dq.emplace_front((state){na, nb, op}); ^ 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 /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64, from vase.cpp:1: /usr/include/c++/4.8/tuple:446:2: note: template<class _Alloc> std::tuple< <template-parameter-1-1> >::tuple(std::allocator_arg_t, const _Alloc&, const std::tuple< <template-parameter-1-1> >&) tuple(allocator_arg_t __tag, const _Alloc& __a, const tuple& __in) ^ /usr/include/c++/4.8/tuple:446:2: note: template argument deduction/substitution failed: vase.cpp:50:44: note: cannot convert 'na' (type '<type error>') to type 'std::allocator_arg_t' dq.emplace_front((state){na, nb, op}); ^ 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 /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64, from vase.cpp:1: /usr/include/c++/4.8/tuple:440:2: note: template<class _Alloc, class ... _UElements, class> std::tuple< <template-parameter-1-1> >::tuple(std::allocator_arg_t, const _Alloc&, _UElements&& ...) tuple(allocator_arg_t __tag, const _Alloc& __a, ^ /usr/include/c++/4.8/tuple:440:2: note: template argument deduction/substitution failed: vase.cpp:50:44: note: cannot convert 'na' (type '<type error>') to type 'std::allocator_arg_t' dq.emplace_front((state){na, nb, op}); ^ 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 /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64, from vase.cpp:1: /usr/include/c++/4.8/tuple:433:2: note: template<class _Alloc> std::tuple< <template-parameter-1-1> >::tuple(std::allocator_arg_t, const _Alloc&, const _Elements& ...) tuple(allocator_arg_t __tag, const _Alloc& __a, ^ /usr/include/c++/4.8/tuple:433:2: note: template argument deduction/substitution failed: vase.cpp:50:44: note: cannot convert 'na' (type '<type error>') to type 'std::allocator_arg_t' dq.emplace_front((state){na, nb, op}); ^ 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 /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64, from vase.cpp:1: /usr/include/c++/4.8/tuple:429:2: note: template<class _Alloc> std::tuple< <template-parameter-1-1> >::tuple(std::allocator_arg_t, const _Alloc&) tuple(allocator_arg_t __tag, const _Alloc& __a) ^ /usr/include/c++/4.8/tuple:429:2: note: template argument deduction/substitution failed: vase.cpp:50:44: note: cannot convert 'na' (type '<type error>') to type 'std::allocator_arg_t' dq.emplace_front((state){na, nb, op}); ^ 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 /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64, from vase.cpp:1: /usr/include/c++/4.8/tuple:423:19: note: template<class ... _UElements, class> constexpr std::tuple< <template-parameter-1-1> >::tuple(std::tuple<_Args1 ...>&&) constexpr tuple(tuple<_UElements...>&& __in) ^ /usr/include/c++/4.8/tuple:423:19: note: template argument deduction/substitution failed: /usr/include/c++/4.8/tuple:416:19: note: template<class ... _UElements, class> constexpr std::tuple< <template-parameter-1-1> >::tuple(const std::tuple<_Args1 ...>&) constexpr tuple(const tuple<_UElements...>& __in) ^ /usr/include/c++/4.8/tuple:416:19: note: template argument deduction/substitution failed: /usr/include/c++/4.8/tuple:411:17: note: constexpr std::tuple< <template-parameter-1-1> >::tuple(std::tuple< <template-parameter-1-1> >&&) [with _Elements = {int, int, std::basic_string<char, std::char_traits<char>, std::allocator<char> >}] constexpr tuple(tuple&&) = default; ^ /usr/include/c++/4.8/tuple:411:17: note: candidate expects 1 argument, 3 provided /usr/include/c++/4.8/tuple:409:17: note: constexpr std::tuple< <template-parameter-1-1> >::tuple(const std::tuple< <template-parameter-1-1> >&) [with _Elements = {int, int, std::basic_string<char, std::char_traits<char>, std::allocator<char> >}] constexpr tuple(const tuple&) = default; ^ /usr/include/c++/4.8/tuple:409:17: note: candidate expects 1 argument, 3 provided /usr/include/c++/4.8/tuple:406:19: note: template<class ... _UElements, class> constexpr std::tuple< <template-parameter-1-1> >::tuple(_UElements&& ...) constexpr tuple(_UElements&&... __elements) ^ /usr/include/c++/4.8/tuple:406:19: note: template argument deduction/substitution failed: /usr/include/c++/4.8/tuple:399:17: note: constexpr std::tuple< <template-parameter-1-1> >::tuple(const _Elements& ...) [with _Elements = {int, int, std::basic_string<char, std::char_traits<char>, std::allocator<char> >}] constexpr tuple(const _Elements&... __elements) ^ /usr/include/c++/4.8/tuple:399:17: note: no known conversion for argument 1 from '<type error>' to 'const int&' /usr/include/c++/4.8/tuple:395:17: note: constexpr std::tuple< <template-parameter-1-1> >::tuple() [with _Elements = {int, int, std::basic_string<char, std::char_traits<char>, std::allocator<char> >}] constexpr tuple() ^ /usr/include/c++/4.8/tuple:395:17: note: candidate expects 0 arguments, 3 provided
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Vase face parte din prima categorie. Soluția propusă de tine va fi evaluată astfel:
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ă.