#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 | #53675376 | Utilizator | |
Fișier | vase.cpp | Dimensiune | 1.56 KB |
Data încărcării | 08 Noiembrie 2024, 00:01 | 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:26: error: converting to 'std::deque<std::tuple<int, int, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::value_type {aka std::tuple<int, int, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >}' from initializer list would use explicit constructor 'constexpr std::tuple< <template-parameter-1-1> >::tuple(_UElements&& ...) [with _UElements = {int, int, const char (&)[1]}; <template-parameter-2-2> = void; _Elements = {int, int, std::basic_string<char, std::char_traits<char>, std::allocator<char> >}]' dq.push_back({0, 0, ""}); ^ 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:35: error: no matching function for call to 'std::deque<std::tuple<int, int, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::push_front(<brace-enclosed initializer list>)' dq.push_front({na, nb, op}); ^ vase.cpp:50:35: note: candidates are: In file included from /usr/include/c++/4.8/deque:64:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:67, from vase.cpp:1: /usr/include/c++/4.8/bits/stl_deque.h:1359:7: note: void std::deque<_Tp, _Alloc>::push_front(const value_type&) [with _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> > > >; std::deque<_Tp, _Alloc>::value_type = std::tuple<int, int, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >] push_front(const value_type& __x) ^ /usr/include/c++/4.8/bits/stl_deque.h:1359:7: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type& {aka const std::tuple<int, int, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >&}' /usr/include/c++/4.8/bits/stl_deque.h:1372:7: note: void std::deque<_Tp, _Alloc>::push_front(std::deque<_Tp, _Alloc>::value_type&&) [with _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> > > >; std::deque<_Tp, _Alloc>::value_type = std::tuple<int, int, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >] push_front(value_type&& __x) ^ /usr/include/c++/4.8/bits/stl_deque.h:1372:7: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::deque<std::tuple<int, int, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::value_type&& {aka std::tuple<int, int, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >&&}'
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ă.