#3702
Fie N și K două numere naturale. Toate punctele din plan de coordonate întregi (x,y) cu proprietatea 0 ≤ x ≤ N, 0 ≤ y ≤ N se unesc prin linii orizontale și verticale de lungime 1. Apoi K linii de lungime 1 dintre cele de mai sus se șterg. Definim o cale ca fiind o succesiune continuă de linii orizontale sau verticale de lungime 1, între originea sistemului de axe și punctul de coordonate (N, N), cu lungimea totală 2∙N. Să se determine numărul total de căi distincte.
Concursul Național Info Pro, Etapa IV
| Problema | npath | Operații I/O |
npath.in/npath.out
|
|---|---|---|---|
| Limita timp | 0.5 secunde | Limita memorie |
Total: 256 MB
/
Stivă 8 MB
|
| Id soluție | #62899779 | Utilizator | |
| Fișier | npath.cpp | Dimensiune | 1.67 KB |
| Data încărcării | 05 Februarie 2026, 17:39 | Scor/rezultat | Eroare de compilare |
npath.cpp: In function 'int main()': npath.cpp:23:35: error: no matching function for call to 'std::set<std::tuple<int, int, int> >::insert(<brace-enclosed initializer list>)' deleted.insert({x, y, tip}); ^ npath.cpp:23:35: note: candidates are: In file included from /usr/include/c++/4.8/set:61:0, from npath.cpp:3: /usr/include/c++/4.8/bits/stl_set.h:460:7: note: std::pair<typename std::_Rb_tree<_Key, _Key, std::_Identity<_Key>, _Compare, typename _Alloc::rebind<_Key>::other>::const_iterator, bool> std::set<_Key, _Compare, _Alloc>::insert(const value_type&) [with _Key = std::tuple<int, int, int>; _Compare = std::less<std::tuple<int, int, int> >; _Alloc = std::allocator<std::tuple<int, int, int> >; typename std::_Rb_tree<_Key, _Key, std::_Identity<_Key>, _Compare, typename _Alloc::rebind<_Key>::other>::const_iterator = std::_Rb_tree_const_iterator<std::tuple<int, int, int> >; std::set<_Key, _Compare, _Alloc>::value_type = std::tuple<int, int, int>] insert(const value_type& __x) ^ /usr/include/c++/4.8/bits/stl_set.h:460:7: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type& {aka const std::tuple<int, int, int>&}' /usr/include/c++/4.8/bits/stl_set.h:469:7: note: std::pair<typename std::_Rb_tree<_Key, _Key, std::_Identity<_Key>, _Compare, typename _Alloc::rebind<_Key>::other>::const_iterator, bool> std::set<_Key, _Compare, _Alloc>::insert(std::set<_Key, _Compare, _Alloc>::value_type&&) [with _Key = std::tuple<int, int, int>; _Compare = std::less<std::tuple<int, int, int> >; _Alloc = std::allocator<std::tuple<int, int, int> >; typename std::_Rb_tree<_Key, _Key, std::_Identity<_Key>, _Compare, typename _Alloc::rebind<_Key>::other>::const_iterator = std::_Rb_tree_const_iterator<std::tuple<int, int, int> >; std::set<_Key, _Compare, _Alloc>::value_type = std::tuple<int, int, int>] insert(value_type&& __x) ^ /usr/include/c++/4.8/bits/stl_set.h:469:7: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::set<std::tuple<int, int, int> >::value_type&& {aka std::tuple<int, int, int>&&}' /usr/include/c++/4.8/bits/stl_set.h:497:7: note: std::set<_Key, _Compare, _Alloc>::iterator std::set<_Key, _Compare, _Alloc>::insert(std::set<_Key, _Compare, _Alloc>::const_iterator, const value_type&) [with _Key = std::tuple<int, int, int>; _Compare = std::less<std::tuple<int, int, int> >; _Alloc = std::allocator<std::tuple<int, int, int> >; std::set<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree_const_iterator<std::tuple<int, int, int> >; std::set<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree_const_iterator<std::tuple<int, int, int> >; std::set<_Key, _Compare, _Alloc>::value_type = std::tuple<int, int, int>] insert(const_iterator __position, const value_type& __x) ^ /usr/include/c++/4.8/bits/stl_set.h:497:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/4.8/bits/stl_set.h:502:7: note: std::set<_Key, _Compare, _Alloc>::iterator std::set<_Key, _Compare, _Alloc>::insert(std::set<_Key, _Compare, _Alloc>::const_iterator, std::set<_Key, _Compare, _Alloc>::value_type&&) [with _Key = std::tuple<int, int, int>; _Compare = std::less<std::tuple<int, int, int> >; _Alloc = std::allocator<std::tuple<int, int, int> >; std::set<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree_const_iterator<std::tuple<int, int, int> >; std::set<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree_const_iterator<std::tuple<int, int, int> >; std::set<_Key, _Compare, _Alloc>::value_type = std::tuple<int, int, int>] insert(const_iterator __position, value_type&& __x) ^ /usr/include/c++/4.8/bits/stl_set.h:502:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/4.8/bits/stl_set.h:517:2: note: template<class _InputIterator> void std::set<_Key, _Compare, _Alloc>::insert(_InputIterator, _InputIterator) [with _InputIterator = _InputIterator; _Key = std::tuple<int, int, int>; _Compare = std::less<std::tuple<int, int, int> >; _Alloc = std::allocator<std::tuple<int, int, int> >] insert(_InputIterator __first, _InputIterator __last) ^ /usr/include/c++/4.8/bits/stl_set.h:517:2: note: template argument deduction/substitution failed: npath.cpp:23:35: note: candidate expects 2 arguments, 1 provided deleted.insert({x, y, tip}); ^ In file included from /usr/include/c++/4.8/set:61:0, from npath.cpp:3: /usr/include/c++/4.8/bits/stl_set.h:529:7: note: void std::set<_Key, _Compare, _Alloc>::insert(std::initializer_list<_Tp>) [with _Key = std::tuple<int, int, int>; _Compare = std::less<std::tuple<int, int, int> >; _Alloc = std::allocator<std::tuple<int, int, int> >] insert(initializer_list<value_type> __l) ^ /usr/include/c++/4.8/bits/stl_set.h:529:7: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::initializer_list<std::tuple<int, int, int> >' npath.cpp:39:45: error: no matching function for call to 'std::set<std::tuple<int, int, int> >::find(<brace-enclosed initializer list>)' if (deleted.find({i-1, j, 1}) == deleted.end()) { ^ npath.cpp:39:45: note: candidates are: In file included from /usr/include/c++/4.8/set:61:0, from npath.cpp:3: /usr/include/c++/4.8/bits/stl_set.h:662:7: note: std::set<_Key, _Compare, _Alloc>::iterator std::set<_Key, _Compare, _Alloc>::find(const key_type&) [with _Key = std::tuple<int, int, int>; _Compare = std::less<std::tuple<int, int, int> >; _Alloc = std::allocator<std::tuple<int, int, int> >; std::set<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree_const_iterator<std::tuple<int, int, int> >; std::set<_Key, _Compare, _Alloc>::key_type = std::tuple<int, int, int>] find(const key_type& __x) ^ /usr/include/c++/4.8/bits/stl_set.h:662:7: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const key_type& {aka const std::tuple<int, int, int>&}' /usr/include/c++/4.8/bits/stl_set.h:666:7: note: std::set<_Key, _Compare, _Alloc>::const_iterator std::set<_Key, _Compare, _Alloc>::find(const key_type&) const [with _Key = std::tuple<int, int, int>; _Compare = std::less<std::tuple<int, int, int> >; _Alloc = std::allocator<std::tuple<int, int, int> >; std::set<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree_const_iterator<std::tuple<int, int, int> >; std::set<_Key, _Compare, _Alloc>::key_type = std::tuple<int, int, int>] find(const key_type& __x) const ^ /usr/include/c++/4.8/bits/stl_set.h:666:7: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const key_type& {aka const std::tuple<int, int, int>&}' npath.cpp:47:45: error: no matching function for call to 'std::set<std::tuple<int, int, int> >::find(<brace-enclosed initializer list>)' if (deleted.find({i, j-1, 2}) == deleted.end()) { ^ npath.cpp:47:45: note: candidates are: In file included from /usr/include/c++/4.8/set:61:0, from npath.cpp:3: /usr/include/c++/4.8/bits/stl_set.h:662:7: note: std::set<_Key, _Compare, _Alloc>::iterator std::set<_Key, _Compare, _Alloc>::find(const key_type&) [with _Key = std::tuple<int, int, int>; _Compare = std::less<std::tuple<int, int, int> >; _Alloc = std::allocator<std::tuple<int, int, int> >; std::set<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree_const_iterator<std::tuple<int, int, int> >; std::set<_Key, _Compare, _Alloc>::key_type = std::tuple<int, int, int>] find(const key_type& __x) ^ /usr/include/c++/4.8/bits/stl_set.h:662:7: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const key_type& {aka const std::tuple<int, int, int>&}' /usr/include/c++/4.8/bits/stl_set.h:666:7: note: std::set<_Key, _Compare, _Alloc>::const_iterator std::set<_Key, _Compare, _Alloc>::find(const key_type&) const [with _Key = std::tuple<int, int, int>; _Compare = std::less<std::tuple<int, int, int> >; _Alloc = std::allocator<std::tuple<int, int, int> >; std::set<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree_const_iterator<std::tuple<int, int, int> >; std::set<_Key, _Compare, _Alloc>::key_type = std::tuple<int, int, int>] find(const key_type& __x) const ^ /usr/include/c++/4.8/bits/stl_set.h:666:7: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const key_type& {aka const std::tuple<int, int, int>&}' In file included from /usr/include/c++/4.8/set:60:0, from npath.cpp:3: /usr/include/c++/4.8/bits/stl_tree.h: In instantiation of 'struct std::_Rb_tree_node<std::tuple<int, int, int> >': /usr/include/c++/4.8/bits/stl_tree.h:1125:25: required from 'void std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_erase(std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Link_type) [with _Key = std::tuple<int, int, int>; _Val = std::tuple<int, int, int>; _KeyOfValue = std::_Identity<std::tuple<int, int, int> >; _Compare = std::less<std::tuple<int, int, int> >; _Alloc = std::allocator<std::tuple<int, int, int> >; std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Link_type = std::_Rb_tree_node<std::tuple<int, int, int> >*]' /usr/include/c++/4.8/bits/stl_tree.h:671:28: required from 'std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::~_Rb_tree() [with _Key = std::tuple<int, int, int>; _Val = std::tuple<int, int, int>; _KeyOfValue = std::_Identity<std::tuple<int, int, int> >; _Compare = std::less<std::tuple<int, int, int> >; _Alloc = std::allocator<std::tuple<int, int, int> >]' /usr/include/c++/4.8/bits/stl_set.h:90:11: required from here /usr/include/c++/4.8/bits/stl_tree.h:134:12: error: 'std::_Rb_tree_node<_Val>::_M_value_field' has incomplete type _Val _M_value_field; ^ 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 npath.cpp:1: /usr/include/c++/4.8/bits/stl_pair.h:83:11: error: declaration of 'class std::tuple<int, int, int>' class tuple; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema npath 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ă.