#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ă.
| Problema | Vase | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64047284 | Utilizator | |
| Fișier | vase.cpp | Dimensiune | 2.26 KB |
| Data încărcării | 13 Aprilie 2026, 13:39 | Scor/rezultat | Eroare de compilare |
vase.cpp: In function 'int main()': vase.cpp:23:14: error: expected unqualified-id before '[' token auto [x,y] = q.front(); ^ vase.cpp:26:12: error: 'x' was not declared in this scope if(x == c || y == c) { ^ vase.cpp:26:22: error: 'y' was not declared in this scope if(x == c || y == c) { ^ vase.cpp:27:17: error: no match for 'operator=' (operand types are 'std::pair<int, int>' and '<brace-enclosed initializer list>') end = {x,y}; ^ vase.cpp:27:17: 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:27:17: note: couldn't deduce template parameter '_U1' end = {x,y}; ^ 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:27:17: note: couldn't deduce template parameter '_U1' end = {x,y}; ^ vase.cpp:32:26: error: 'y' was not declared in this scope int nx = a, ny = y; ^ vase.cpp:35:31: error: 'x' was not declared in this scope parent[nx][ny] = {x,y}; ^ vase.cpp:35:28: error: no match for 'operator=' (operand types are 'std::pair<int, int>' and '<brace-enclosed initializer list>') parent[nx][ny] = {x,y}; ^ vase.cpp:35:28: 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:35:28: note: couldn't deduce template parameter '_U1' parent[nx][ny] = {x,y}; ^ 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:35:28: note: couldn't deduce template parameter '_U1' parent[nx][ny] = {x,y}; ^ vase.cpp:41:14: error: 'x' was not declared in this scope nx = x; ny = b; ^ vase.cpp:44:28: error: no match for 'operator=' (operand types are 'std::pair<int, int>' and '<brace-enclosed initializer list>') parent[nx][ny] = {x,y}; ^ vase.cpp:44:28: 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:44:28: note: couldn't deduce template parameter '_U1' parent[nx][ny] = {x,y}; ^ 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:44:28: note: couldn't deduce template parameter '_U1' parent[nx][ny] = {x,y}; ^ vase.cpp:53:28: error: no match for 'operator=' (operand types are 'std::pair<int, int>' and '<brace-enclosed initializer list>') parent[nx][ny] = {x,y}; ^ vase.cpp:53:28: 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:53:28: note: couldn't deduce template parameter '_U1' parent[nx][ny] = {x,y}; ^ 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:53:28: note: couldn't deduce template parameter '_U1' parent[nx][ny] = {x,y}; ^ vase.cpp:62:28: error: no match for 'operator=' (operand types are 'std::pair<int, int>' and '<brace-enclosed initializer list>') parent[nx][ny] = {x,y}; ^ vase.cpp:62:28: 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:62:28: note: couldn't deduce template parameter '_U1' parent[nx][ny] = {x,y}; ^ 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:62:28: note: couldn't deduce template parameter '_U1' parent[nx][ny] = {x,y}; ^ vase.cpp:73:28: error: no match for 'operator=' (operand types are 'std::pair<int, int>' and '<brace-enclosed initializer list>') parent[nx][ny] = {x,y}; ^ vase.cpp:73:28: 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:73:28: note: couldn't deduce template parameter '_U1' parent[nx][ny] = {x,y}; ^ 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:73:28: note: couldn't deduce template parameter '_U1' parent[nx][ny] = {x,y}; ^ vase.cpp:84:28: error: no match for 'operator=' (operand types are 'std::pair<int, int>' and '<brace-enclosed initializer list>') parent[nx][ny] = {x,y}; ^ vase.cpp:84:28: 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:84:28: note: couldn't deduce template parameter '_U1' parent[nx][ny] = {x,y}; ^ 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:84:28: note: couldn't deduce template parameter '_U1' parent[nx][ny] = {x,y}; ^
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ă.