Detalii evaluare #57316497

Rezumat problemă

Links

#3004

Se dau N puncte din plan prin coordonatele lor.
Se mai dau Q perechi de puncte, diferite de cele date inițial.

Să se verifice, pentru fiecare pereche de puncte (A , B) dintre cele Q, dacă există traseu care pornește din A și ajunge în B, prin deplasări cu pași de lungime 1 spre Nord, Vest, Sud, Est și evitând orice punct dintre cele N date inițial.

Detalii

Problema Links Operații I/O links.in/links.out
Limita timp 0.1 secunde Limita memorie Total: 128 MB / Stivă 128 MB
Id soluție #57316497 Utilizator robe antonia (robeantonia)
Fișier links.cpp Dimensiune 2.55 KB
Data încărcării 25 Martie 2025, 17:45 Scor / rezultat Eroare de compilare

Evaluare

Mesaj compilare

links.cpp:12:21: error: expected type-specifier before '(' token
     size_t operator (const pair<T1, T2> &p) const {

                     ^
In file included from /usr/include/c++/4.8/bits/hashtable.h:35:0,
                 from /usr/include/c++/4.8/unordered_map:47,
                 from links.cpp:3:
/usr/include/c++/4.8/bits/hashtable_policy.h: In instantiation of 'struct std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair>':
/usr/include/c++/4.8/type_traits:121:12:   recursively required from 'struct std::__and_<std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> >'
/usr/include/c++/4.8/type_traits:121:12:   required from 'struct std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> >'
/usr/include/c++/4.8/type_traits:127:38:   required from 'struct std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
/usr/include/c++/4.8/bits/unordered_map.h:99:66:   required from 'class std::unordered_map<std::pair<int, int>, std::pair<int, int>, hash_pair>'
links.cpp:22:62:   required from here
/usr/include/c++/4.8/bits/hashtable_policy.h:85:33: error: no match for call to '(const hash_pair) (const std::pair<int, int>&)'
  noexcept(declval<const _Hash&>()(declval<const _Key&>()))>
                                 ^
In file included from /usr/include/c++/4.8/bits/move.h:57:0,
                 from /usr/include/c++/4.8/bits/stl_pair.h:59,
                 from /usr/include/c++/4.8/bits/stl_algobase.h:64,
                 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 links.cpp:1:
/usr/include/c++/4.8/type_traits: In instantiation of 'struct std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >':
/usr/include/c++/4.8/bits/unordered_map.h:99:66:   required from 'class std::unordered_map<std::pair<int, int>, std::pair<int, int>, hash_pair>'
links.cpp:22:62:   required from here
/usr/include/c++/4.8/type_traits:127:38: error: 'value' is not a member of 'std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> >'
     : public integral_constant<bool, !_Pp::value>
                                      ^
In file included from /usr/include/c++/4.8/unordered_map:48:0,
                 from links.cpp:3:
/usr/include/c++/4.8/bits/unordered_map.h: In instantiation of 'class std::unordered_map<std::pair<int, int>, std::pair<int, int>, hash_pair>':
links.cpp:22:62:   required from here
/usr/include/c++/4.8/bits/unordered_map.h:99:66: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
       typedef __umap_hashtable<_Key, _Tp, _Hash, _Pred, _Alloc>  _Hashtable;
                                                                  ^
/usr/include/c++/4.8/bits/unordered_map.h:106:45: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
       typedef typename _Hashtable::key_type key_type;
                                             ^
/usr/include/c++/4.8/bits/unordered_map.h:107:47: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
       typedef typename _Hashtable::value_type value_type;
                                               ^
/usr/include/c++/4.8/bits/unordered_map.h:108:48: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
       typedef typename _Hashtable::mapped_type mapped_type;
                                                ^
/usr/include/c++/4.8/bits/unordered_map.h:109:43: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
       typedef typename _Hashtable::hasher hasher;
                                           ^
/usr/include/c++/4.8/bits/unordered_map.h:110:46: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
       typedef typename _Hashtable::key_equal key_equal;
                                              ^
/usr/include/c++/4.8/bits/unordered_map.h:111:51: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
       typedef typename _Hashtable::allocator_type allocator_type;
                                                   ^
/usr/include/c++/4.8/bits/unordered_map.h:120:46: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
       typedef typename _Hashtable::iterator  iterator;
                                              ^
/usr/include/c++/4.8/bits/unordered_map.h:121:51: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
       typedef typename _Hashtable::const_iterator const_iterator;
                                                   ^
/usr/include/c++/4.8/bits/unordered_map.h:122:51: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
       typedef typename _Hashtable::local_iterator local_iterator;
                                                   ^
/usr/include/c++/4.8/bits/unordered_map.h:123:57: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
       typedef typename _Hashtable::const_local_iterator const_local_iterator;
                                                         ^
/usr/include/c++/4.8/bits/unordered_map.h:124:47: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
       typedef typename _Hashtable::size_type  size_type;
                                               ^
/usr/include/c++/4.8/bits/unordered_map.h:125:52: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
       typedef typename _Hashtable::difference_type difference_type;
                                                    ^
/usr/include/c++/4.8/bits/unordered_map.h:212:7: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
       operator=(initializer_list<value_type> __l)
       ^
/usr/include/c++/4.8/bits/unordered_map.h:310:2: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
  emplace(_Args&&... __args)
  ^
/usr/include/c++/4.8/bits/unordered_map.h:362:7: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
       insert(const value_type& __x)
       ^
/usr/include/c++/4.8/bits/unordered_map.h:369:2: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
  insert(_Pair&& __x)
  ^
/usr/include/c++/4.8/bits/unordered_map.h:429:7: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
       insert(initializer_list<value_type> __l)
       ^
/usr/include/c++/4.8/bits/unordered_map.h:573:7: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
       equal_range(const key_type& __x)
       ^
/usr/include/c++/4.8/bits/unordered_map.h:577:7: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
       equal_range(const key_type& __x) const
       ^
/usr/include/c++/4.8/bits/unordered_map.h: In instantiation of 'class std::unordered_map<std::pair<int, int>, int, hash_pair>':
links.cpp:23:51:   required from here
/usr/include/c++/4.8/bits/unordered_map.h:99:66: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
       typedef __umap_hashtable<_Key, _Tp, _Hash, _Pred, _Alloc>  _Hashtable;
                                                                  ^
/usr/include/c++/4.8/bits/unordered_map.h:106:45: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
       typedef typename _Hashtable::key_type key_type;
                                             ^
/usr/include/c++/4.8/bits/unordered_map.h:107:47: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
       typedef typename _Hashtable::value_type value_type;
                                               ^
/usr/include/c++/4.8/bits/unordered_map.h:108:48: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
       typedef typename _Hashtable::mapped_type mapped_type;
                                                ^
/usr/include/c++/4.8/bits/unordered_map.h:109:43: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
       typedef typename _Hashtable::hasher hasher;
                                           ^
/usr/include/c++/4.8/bits/unordered_map.h:110:46: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
       typedef typename _Hashtable::key_equal key_equal;
                                              ^
/usr/include/c++/4.8/bits/unordered_map.h:111:51: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
       typedef typename _Hashtable::allocator_type allocator_type;
                                                   ^
/usr/include/c++/4.8/bits/unordered_map.h:120:46: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
       typedef typename _Hashtable::iterator  iterator;
                                              ^
/usr/include/c++/4.8/bits/unordered_map.h:121:51: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
       typedef typename _Hashtable::const_iterator const_iterator;
                                                   ^
/usr/include/c++/4.8/bits/unordered_map.h:122:51: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
       typedef typename _Hashtable::local_iterator local_iterator;
                                                   ^
/usr/include/c++/4.8/bits/unordered_map.h:123:57: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
       typedef typename _Hashtable::const_local_iterator const_local_iterator;
                                                         ^
/usr/include/c++/4.8/bits/unordered_map.h:124:47: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
       typedef typename _Hashtable::size_type  size_type;
                                               ^
/usr/include/c++/4.8/bits/unordered_map.h:125:52: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
       typedef typename _Hashtable::difference_type difference_type;
                                                    ^
/usr/include/c++/4.8/bits/unordered_map.h:212:7: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
       operator=(initializer_list<value_type> __l)
       ^
/usr/include/c++/4.8/bits/unordered_map.h:310:2: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
  emplace(_Args&&... __args)
  ^
/usr/include/c++/4.8/bits/unordered_map.h:362:7: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
       insert(const value_type& __x)
       ^
/usr/include/c++/4.8/bits/unordered_map.h:369:2: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
  insert(_Pair&& __x)
  ^
/usr/include/c++/4.8/bits/unordered_map.h:429:7: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
       insert(initializer_list<value_type> __l)
       ^
/usr/include/c++/4.8/bits/unordered_map.h:573:7: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
       equal_range(const key_type& __x)
       ^
/usr/include/c++/4.8/bits/unordered_map.h:577:7: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
       equal_range(const key_type& __x) const
       ^
links.cpp: In member function 'std::pair<int, int> UnionFind::find(std::pair<int, int>)':
links.cpp:28:19: error: no match for 'operator[]' (operand types are 'std::unordered_map<std::pair<int, int>, std::pair<int, int>, hash_pair>' and 'std::pair<int, int>')
         if (parent[p] != p) {

                   ^
links.cpp:29:19: error: no match for 'operator[]' (operand types are 'std::unordered_map<std::pair<int, int>, std::pair<int, int>, hash_pair>' and 'std::pair<int, int>')
             parent[p] = find(parent[p]);

                   ^
links.cpp:29:36: error: no match for 'operator[]' (operand types are 'std::unordered_map<std::pair<int, int>, std::pair<int, int>, hash_pair>' and 'std::pair<int, int>')
             parent[p] = find(parent[p]);

                                    ^
links.cpp:31:22: error: no match for 'operator[]' (operand types are 'std::unordered_map<std::pair<int, int>, std::pair<int, int>, hash_pair>' and 'std::pair<int, int>')
         return parent[p];

                      ^
links.cpp: In member function 'void UnionFind::unite(std::pair<int, int>, std::pair<int, int>)':
links.cpp:41:21: error: no match for 'operator[]' (operand types are 'std::unordered_map<std::pair<int, int>, int, hash_pair>' and 'std::pair<int, int>')
             if (rank[root1] > rank[root2]) {

                     ^
links.cpp:41:35: error: no match for 'operator[]' (operand types are 'std::unordered_map<std::pair<int, int>, int, hash_pair>' and 'std::pair<int, int>')
             if (rank[root1] > rank[root2]) {

                                   ^
links.cpp:42:23: error: no match for 'operator[]' (operand types are 'std::unordered_map<std::pair<int, int>, std::pair<int, int>, hash_pair>' and 'std::pair<int, int>')
                 parent[root2] = root1;

                       ^
links.cpp:43:28: error: no match for 'operator[]' (operand types are 'std::unordered_map<std::pair<int, int>, int, hash_pair>' and 'std::pair<int, int>')
             } else if (rank[root1] < rank[root2]) {

                            ^
links.cpp:43:42: error: no match for 'operator[]' (operand types are 'std::unordered_map<std::pair<int, int>, int, hash_pair>' and 'std::pair<int, int>')
             } else if (rank[root1] < rank[root2]) {

                                          ^
links.cpp:44:23: error: no match for 'operator[]' (operand types are 'std::unordered_map<std::pair<int, int>, std::pair<int, int>, hash_pair>' and 'std::pair<int, int>')
                 parent[root1] = root2;

                       ^
links.cpp:46:23: error: no match for 'operator[]' (operand types are 'std::unordered_map<std::pair<int, int>, std::pair<int, int>, hash_pair>' and 'std::pair<int, int>')
                 parent[root2] = root1;

                       ^
links.cpp:47:21: error: no match for 'operator[]' (operand types are 'std::unordered_map<std::pair<int, int>, int, hash_pair>' and 'std::pair<int, int>')
                 rank[root1]++;

                     ^
links.cpp: In member function 'void UnionFind::makeSet(std::pair<int, int>)':
links.cpp:54:15: error: no match for 'operator[]' (operand types are 'std::unordered_map<std::pair<int, int>, std::pair<int, int>, hash_pair>' and 'std::pair<int, int>')
         parent[p] = p;

               ^
links.cpp:55:13: error: no match for 'operator[]' (operand types are 'std::unordered_map<std::pair<int, int>, int, hash_pair>' and 'std::pair<int, int>')
         rank[p] = 0;

             ^
In file included from /usr/include/c++/4.8/unordered_map:48:0,
                 from links.cpp:3:
/usr/include/c++/4.8/bits/unordered_map.h: In instantiation of 'class std::unordered_map<std::pair<int, int>, bool, hash_pair>':
links.cpp:67:52:   required from here
/usr/include/c++/4.8/bits/unordered_map.h:99:66: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
       typedef __umap_hashtable<_Key, _Tp, _Hash, _Pred, _Alloc>  _Hashtable;
                                                                  ^
/usr/include/c++/4.8/bits/unordered_map.h:106:45: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
       typedef typename _Hashtable::key_type key_type;
                                             ^
/usr/include/c++/4.8/bits/unordered_map.h:107:47: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
       typedef typename _Hashtable::value_type value_type;
                                               ^
/usr/include/c++/4.8/bits/unordered_map.h:108:48: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
       typedef typename _Hashtable::mapped_type mapped_type;
                                                ^
/usr/include/c++/4.8/bits/unordered_map.h:109:43: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
       typedef typename _Hashtable::hasher hasher;
                                           ^
/usr/include/c++/4.8/bits/unordered_map.h:110:46: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
       typedef typename _Hashtable::key_equal key_equal;
                                              ^
/usr/include/c++/4.8/bits/unordered_map.h:111:51: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
       typedef typename _Hashtable::allocator_type allocator_type;
                                                   ^
/usr/include/c++/4.8/bits/unordered_map.h:120:46: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
       typedef typename _Hashtable::iterator  iterator;
                                              ^
/usr/include/c++/4.8/bits/unordered_map.h:121:51: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
       typedef typename _Hashtable::const_iterator const_iterator;
                                                   ^
/usr/include/c++/4.8/bits/unordered_map.h:122:51: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
       typedef typename _Hashtable::local_iterator local_iterator;
                                                   ^
/usr/include/c++/4.8/bits/unordered_map.h:123:57: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
       typedef typename _Hashtable::const_local_iterator const_local_iterator;
                                                         ^
/usr/include/c++/4.8/bits/unordered_map.h:124:47: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
       typedef typename _Hashtable::size_type  size_type;
                                               ^
/usr/include/c++/4.8/bits/unordered_map.h:125:52: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
       typedef typename _Hashtable::difference_type difference_type;
                                                    ^
/usr/include/c++/4.8/bits/unordered_map.h:212:7: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
       operator=(initializer_list<value_type> __l)
       ^
/usr/include/c++/4.8/bits/unordered_map.h:310:2: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
  emplace(_Args&&... __args)
  ^
/usr/include/c++/4.8/bits/unordered_map.h:362:7: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
       insert(const value_type& __x)
       ^
/usr/include/c++/4.8/bits/unordered_map.h:369:2: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
  insert(_Pair&& __x)
  ^
/usr/include/c++/4.8/bits/unordered_map.h:429:7: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
       insert(initializer_list<value_type> __l)
       ^
/usr/include/c++/4.8/bits/unordered_map.h:573:7: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
       equal_range(const key_type& __x)
       ^
/usr/include/c++/4.8/bits/unordered_map.h:577:7: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<hash_pair>, std::is_default_constructible<hash_pair>, std::is_copy_assignable<hash_pair>, std::__detail::__is_noexcept_hash<std::pair<int, int>, hash_pair> > >'
       equal_range(const key_type& __x) const
       ^
links.cpp: In function 'int main()':
links.cpp:67:52: error: no matching function for call to 'std::unordered_map<std::pair<int, int>, bool, hash_pair>::unordered_map()'
     unordered_map<pair<int, int>, bool, hash_pair> obstacles;

                                                    ^
links.cpp:67:52: note: candidates are:
In file included from /usr/include/c++/4.8/unordered_map:48:0,
                 from links.cpp:3:
/usr/include/c++/4.8/bits/unordered_map.h:171:7: note: std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>&&) [with _Key = std::pair<int, int>; _Tp = bool; _Hash = hash_pair; _Pred = std::equal_to<std::pair<int, int> >; _Alloc = std::allocator<std::pair<const std::pair<int, int>, bool> >]
       unordered_map(unordered_map&&) = default;
       ^
/usr/include/c++/4.8/bits/unordered_map.h:171:7: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/4.8/bits/unordered_map.h:168:7: note: std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(const std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>&) [with _Key = std::pair<int, int>; _Tp = bool; _Hash = hash_pair; _Pred = std::equal_to<std::pair<int, int> >; _Alloc = std::allocator<std::pair<const std::pair<int, int>, bool> >]
       unordered_map(const unordered_map&) = default;
       ^
/usr/include/c++/4.8/bits/unordered_map.h:168:7: note:   candidate expects 1 argument, 0 provided
links.cpp:73:18: error: no match for 'operator[]' (operand types are 'std::unordered_map<std::pair<int, int>, bool, hash_pair>' and '<brace-enclosed initializer list>')
         obstacles[{x, y}] = true;

                  ^
links.cpp:85:23: error: no match for 'operator[]' (operand types are 'std::unordered_map<std::pair<int, int>, bool, hash_pair>' and 'std::pair<int, int>')
         if (!obstacles[p1] && !obstacles[p2]) {

                       ^
links.cpp:85:41: error: no match for 'operator[]' (operand types are 'std::unordered_map<std::pair<int, int>, bool, hash_pair>' and 'std::pair<int, int>')
         if (!obstacles[p1] && !obstacles[p2]) {

                                         ^
links.cpp: In member function 'std::pair<int, int> UnionFind::find(std::pair<int, int>)':
links.cpp:32:5: warning: control reaches end of non-void function [-Wreturn-type]
     }

     ^

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