#4267
Se dau n
puncte în plan, nu neapărat distincte, fiecare punct fiind dat prin coordonatele sale (x, y)
, unde x
și y
sunt numere naturale. Spunem că două puncte (x, y)
și (i, j)
sunt simetrice dacă x = j
și y = i
. Să se determine numărul perechilor de puncte simetrice.
Folclorul informatic
Problema | PerechiPuncte | Operații I/O |
![]() |
---|---|---|---|
Limita timp | 0.7 secunde | Limita memorie |
Total: 128 MB
/
Stivă 64 MB
|
Id soluție | #56118009 | Utilizator | |
Fișier | perechipuncte.cpp | Dimensiune | 1.01 KB |
Data încărcării | 06 Februarie 2025, 15:10 | Scor / rezultat | Eroare de compilare |
perechipuncte.cpp:11:4: error: 'sizet' does not name a type sizet operator()(const pair<T1, T2> &p) const ^ perechipuncte.cpp:23:20: error: redefinition of 'int X' int n, x, y, X, Y, X, Y_, a, b, c, d; ^ perechipuncte.cpp:23:14: error: 'int X' previously declared here int n, x, y, X, Y, X, Y_, a, b, c, d; ^ In file included from /usr/include/c++/4.8/bits/hashtable.h:35:0, from /usr/include/c++/4.8/unordered_map:47, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:115, from perechipuncte.cpp:1: /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>, int, hash_pair>' perechipuncte.cpp:24:47: 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/istream:38, from /usr/include/c++/4.8/sstream:38, from /usr/include/c++/4.8/complex:45, from /usr/include/c++/4.8/ccomplex:38, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52, from perechipuncte.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>, int, hash_pair>' perechipuncte.cpp:24:47: 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 /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:115, from perechipuncte.cpp:1: /usr/include/c++/4.8/bits/unordered_map.h: In instantiation of 'class std::unordered_map<std::pair<int, int>, int, hash_pair>': perechipuncte.cpp:24:47: 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 ^ perechipuncte.cpp:24:47: error: no matching function for call to 'std::unordered_map<std::pair<int, int>, int, hash_pair>::unordered_map()' unordered_map<pair<int, int>, int, hash_pair> points; ^ perechipuncte.cpp:24:47: note: candidates are: In file included from /usr/include/c++/4.8/unordered_map:48:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:115, from perechipuncte.cpp:1: /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 = int; _Hash = hash_pair; _Pred = std::equal_to<std::pair<int, int> >; _Alloc = std::allocator<std::pair<const std::pair<int, int>, int> >] 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 = int; _Hash = hash_pair; _Pred = std::equal_to<std::pair<int, int> >; _Alloc = std::allocator<std::pair<const std::pair<int, int>, int> >] unordered_map(const unordered_map&) = default; ^ /usr/include/c++/4.8/bits/unordered_map.h:168:7: note: candidate expects 1 argument, 0 provided perechipuncte.cpp: In function 'int main()': perechipuncte.cpp:28:16: error: 'class std::basic_ostream<char>' has no member named 'sync_withstdio' cin.tie(0)->sync_withstdio(0);cout.tie(0); ^ perechipuncte.cpp:31:10: error: no match for 'operator[]' (operand types are 'std::unordered_map<std::pair<int, int>, int, hash_pair>' and 'std::pair<int, int>') points[mp(X, Y)] ++; ^ perechipuncte.cpp:32:10: error: no match for 'operator[]' (operand types are 'std::unordered_map<std::pair<int, int>, int, hash_pair>' and 'std::pair<int, int>') points[mp(X, Y)] ++; ^ perechipuncte.cpp:46:26: error: no match for 'operator[]' (operand types are 'std::unordered_map<std::pair<int, int>, int, hash_pair>' and 'std::pair<int, int>') simetrice += points[mp(Y, X)]; ^ perechipuncte.cpp:47:13: error: no match for 'operator[]' (operand types are 'std::unordered_map<std::pair<int, int>, int, hash_pair>' and 'std::pair<int, int>') points[mp(X, Y_)] ++; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema PerechiPuncte 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ă.