# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
280451 | 2020-08-22T19:25:40 Z | ElyesChaabouni | Ideal city (IOI12_city) | C++14 | Compilation error |
0 ms | 0 KB |
/*#pragma GCC optimize("O3")*/ #include<bits/stdc++.h> //#include <ext/pb_ds/assoc_container.hpp> //#include <ext/pb_ds/tree_policy.hpp> //#define ordered_set tree<int, null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update> #define eps 1e-9 #define MOD1 998244353 #define MOD2 1000000007 #define INV_10 299473306 #define INF 1000000000 #define PI 3.14159265358979323846 using namespace std; int inc[4][2]={{0, 1}, {0, -1}, {1, 0}, {-1, 0}}; int DistanceSum(int N, int *X, int *Y) { long long ans=0; for(int i = 0; i < N; i++) { //cout << i << ' ' << X[i] << ' ' << Y[i] << '\n'; unordered_map<pair<int, int>, int>m; for(int j = 0; j < N; j++) { if(j!=i) { m[make_pair(X[j], Y[j])]=j; } else { m[make_pair(X[j], Y[j])]=-1; } } int nb=1, idx=0; vector<pair<int, int> >bfs; bfs.push_back(make_pair(X[i], Y[i])); bool ok=1; while(bfs.size()!=N) { //cout << nb << '\n'; int l=bfs.size(); for(int j = idx; j < l; j++) { //cout << bfs[j].first << ' ' << bfs[j].second << '\n'; for(int k = 0; k < 4; k++) { int xx=bfs[j].first+inc[k][0], yy=bfs[j].second+inc[k][1]; if(m.count(make_pair(xx, yy)) && m[make_pair(xx, yy)]!=-1) { if(m[make_pair(xx, yy)] < i) { ans+=nb; ans%=1000000000; } m[make_pair(xx, yy)]=-1; bfs.push_back(make_pair(xx, yy)); } } } nb++; idx=l; } } //ans*=( 1000000000); ans%= 1000000000; return ans; }
Compilation message
city.cpp: In function 'int DistanceSum(int, int*, int*)': city.cpp:20:37: error: use of deleted function 'std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map() [with _Key = std::pair<int, int>; _Tp = int; _Hash = std::hash<std::pair<int, int> >; _Pred = std::equal_to<std::pair<int, int> >; _Alloc = std::allocator<std::pair<const std::pair<int, int>, int> >]' 20 | unordered_map<pair<int, int>, int>m; | ^ In file included from /usr/include/c++/9/unordered_map:47, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:117, from city.cpp:2: /usr/include/c++/9/bits/unordered_map.h:141:7: note: 'std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map() [with _Key = std::pair<int, int>; _Tp = int; _Hash = std::hash<std::pair<int, int> >; _Pred = std::equal_to<std::pair<int, int> >; _Alloc = std::allocator<std::pair<const std::pair<int, int>, int> >]' is implicitly deleted because the default definition would be ill-formed: 141 | unordered_map() = default; | ^~~~~~~~~~~~~ /usr/include/c++/9/bits/unordered_map.h:141:7: error: use of deleted function 'std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::_Hashtable() [with _Key = std::pair<int, int>; _Value = std::pair<const std::pair<int, int>, int>; _Alloc = std::allocator<std::pair<const std::pair<int, int>, int> >; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::pair<int, int> >; _H1 = std::hash<std::pair<int, int> >; _H2 = std::__detail::_Mod_range_hashing; _Hash = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<true, false, true>]' In file included from /usr/include/c++/9/unordered_map:46, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:117, from city.cpp:2: /usr/include/c++/9/bits/hashtable.h:414:7: note: 'std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::_Hashtable() [with _Key = std::pair<int, int>; _Value = std::pair<const std::pair<int, int>, int>; _Alloc = std::allocator<std::pair<const std::pair<int, int>, int> >; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::pair<int, int> >; _H1 = std::hash<std::pair<int, int> >; _H2 = std::__detail::_Mod_range_hashing; _Hash = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<true, false, true>]' is implicitly deleted because the default definition would be ill-formed: 414 | _Hashtable() = default; | ^~~~~~~~~~ /usr/include/c++/9/bits/hashtable.h:414:7: error: use of deleted function 'std::__detail::_Hashtable_base<_Key, _Value, _ExtractKey, _Equal, _H1, _H2, _Hash, _Traits>::_Hashtable_base() [with _Key = std::pair<int, int>; _Value = std::pair<const std::pair<int, int>, int>; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::pair<int, int> >; _H1 = std::hash<std::pair<int, int> >; _H2 = std::__detail::_Mod_range_hashing; _Hash = std::__detail::_Default_ranged_hash; _Traits = std::__detail::_Hashtable_traits<true, false, true>]' In file included from /usr/include/c++/9/bits/hashtable.h:35, from /usr/include/c++/9/unordered_map:46, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:117, from city.cpp:2: /usr/include/c++/9/bits/hashtable_policy.h:1822:5: note: 'std::__detail::_Hashtable_base<_Key, _Value, _ExtractKey, _Equal, _H1, _H2, _Hash, _Traits>::_Hashtable_base() [with _Key = std::pair<int, int>; _Value = std::pair<const std::pair<int, int>, int>; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::pair<int, int> >; _H1 = std::hash<std::pair<int, int> >; _H2 = std::__detail::_Mod_range_hashing; _Hash = std::__detail::_Default_ranged_hash; _Traits = std::__detail::_Hashtable_traits<true, false, true>]' is implicitly deleted because the default definition would be ill-formed: 1822 | _Hashtable_base() = default; | ^~~~~~~~~~~~~~~ /usr/include/c++/9/bits/hashtable_policy.h:1822:5: error: use of deleted function 'std::__detail::_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, std::__detail::_Default_ranged_hash, true>::_Hash_code_base() [with _Key = std::pair<int, int>; _Value = std::pair<const std::pair<int, int>, int>; _ExtractKey = std::__detail::_Select1st; _H1 = std::hash<std::pair<int, int> >; _H2 = std::__detail::_Mod_range_hashing]' /usr/include/c++/9/bits/hashtable_policy.h:1373:7: note: 'std::__detail::_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, std::__detail::_Default_ranged_hash, true>::_Hash_code_base() [with _Key = std::pair<int, int>; _Value = std::pair<const std::pair<int, int>, int>; _ExtractKey = std::__detail::_Select1st; _H1 = std::hash<std::pair<int, int> >; _H2 = std::__detail::_Mod_range_hashing]' is implicitly deleted because the default definition would be ill-formed: 1373 | _Hash_code_base() = default; | ^~~~~~~~~~~~~~~ /usr/include/c++/9/bits/hashtable_policy.h:1373:7: error: use of deleted function 'std::__detail::_Hashtable_ebo_helper<_Nm, _Tp, true>::_Hashtable_ebo_helper() [with int _Nm = 1; _Tp = std::hash<std::pair<int, int> >]' /usr/include/c++/9/bits/hashtable_policy.h:1096:7: note: 'std::__detail::_Hashtable_ebo_helper<_Nm, _Tp, true>::_Hashtable_ebo_helper() [with int _Nm = 1; _Tp = std::hash<std::pair<int, int> >]' is implicitly deleted because the default definition would be ill-formed: 1096 | _Hashtable_ebo_helper() = default; | ^~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/9/bits/hashtable_policy.h:1096:7: error: use of deleted function 'std::hash<std::pair<int, int> >::hash()' In file included from /usr/include/c++/9/bits/basic_string.h:6719, from /usr/include/c++/9/string:55, from /usr/include/c++/9/bits/locale_classes.h:40, from /usr/include/c++/9/bits/ios_base.h:41, from /usr/include/c++/9/ios:42, from /usr/include/c++/9/istream:38, from /usr/include/c++/9/sstream:38, from /usr/include/c++/9/complex:45, from /usr/include/c++/9/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54, from city.cpp:2: /usr/include/c++/9/bits/functional_hash.h:101:12: note: 'std::hash<std::pair<int, int> >::hash()' is implicitly deleted because the default definition would be ill-formed: 101 | struct hash : __hash_enum<_Tp> | ^~~~ /usr/include/c++/9/bits/functional_hash.h:101:12: error: no matching function for call to 'std::__hash_enum<std::pair<int, int>, false>::__hash_enum()' /usr/include/c++/9/bits/functional_hash.h:82:7: note: candidate: 'std::__hash_enum<_Tp, <anonymous> >::__hash_enum(std::__hash_enum<_Tp, <anonymous> >&&) [with _Tp = std::pair<int, int>; bool <anonymous> = false]' 82 | __hash_enum(__hash_enum&&); | ^~~~~~~~~~~ /usr/include/c++/9/bits/functional_hash.h:82:7: note: candidate expects 1 argument, 0 provided /usr/include/c++/9/bits/functional_hash.h:101:12: error: 'std::__hash_enum<_Tp, <anonymous> >::~__hash_enum() [with _Tp = std::pair<int, int>; bool <anonymous> = false]' is private within this context 101 | struct hash : __hash_enum<_Tp> | ^~~~ /usr/include/c++/9/bits/functional_hash.h:83:7: note: declared private here 83 | ~__hash_enum(); | ^ In file included from /usr/include/c++/9/bits/hashtable.h:35, from /usr/include/c++/9/unordered_map:46, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:117, from city.cpp:2: /usr/include/c++/9/bits/hashtable_policy.h:1096:7: error: use of deleted function 'std::hash<std::pair<int, int> >::~hash()' 1096 | _Hashtable_ebo_helper() = default; | ^~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/9/bits/basic_string.h:6719, from /usr/include/c++/9/string:55, from /usr/include/c++/9/bits/locale_classes.h:40, from /usr/include/c++/9/bits/ios_base.h:41, from /usr/include/c++/9/ios:42, from /usr/include/c++/9/istream:38, from /usr/include/c++/9/sstream:38, from /usr/include/c++/9/complex:45, from /usr/include/c++/9/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54, from city.cpp:2: /usr/include/c++/9/bits/functional_hash.h:101:12: note: 'std::hash<std::pair<int, int> >::~hash()' is implicitly deleted because the default definition would be ill-formed: 101 | struct hash : __hash_enum<_Tp> | ^~~~ /usr/include/c++/9/bits/functional_hash.h:101:12: error: 'std::__hash_enum<_Tp, <anonymous> >::~__hash_enum() [with _Tp = std::pair<int, int>; bool <anonymous> = false]' is private within this context /usr/include/c++/9/bits/functional_hash.h:83:7: note: declared private here 83 | ~__hash_enum(); | ^ In file included from /usr/include/c++/9/bits/hashtable.h:35, from /usr/include/c++/9/unordered_map:46, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:117, from city.cpp:2: /usr/include/c++/9/bits/hashtable_policy.h:1373:7: error: use of deleted function 'std::__detail::_Hashtable_ebo_helper<1, std::hash<std::pair<int, int> >, true>::~_Hashtable_ebo_helper()' 1373 | _Hash_code_base() = default; | ^~~~~~~~~~~~~~~ /usr/include/c++/9/bits/hashtable_policy.h:1093:12: note: 'std::__detail::_Hashtable_ebo_helper<1, std::hash<std::pair<int, int> >, true>::~_Hashtable_ebo_helper()' is implicitly deleted because the default definition would be ill-formed: 1093 | struct _Hashtable_ebo_helper<_Nm, _Tp, true> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/9/bits/hashtable_policy.h:1093:12: error: use of deleted function 'std::hash<std::pair<int, int> >::~hash()' /usr/include/c++/9/bits/hashtable_policy.h:1822:5: error: use of deleted function 'std::__detail::_Hash_code_base<std::pair<int, int>, std::pair<const std::pair<int, int>, int>, std::__detail::_Select1st, std::hash<std::pair<int, int> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, true>::~_Hash_code_base()' 1822 | _Hashtable_base() = default; | ^~~~~~~~~~~~~~~ /usr/include/c++/9/bits/hashtable_policy.h:1346:12: note: 'std::__detail::_Hash_code_base<std::pair<int, int>, std::pair<const std::pair<int, int>, int>, std::__detail::_Select1st, std::hash<std::pair<int, int> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, true>::~_Hash_code_base()' is implicitly deleted because the default definition would be ill-formed: 1346 | struct _Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1347 | _Default_ranged_hash, true> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/9/bits/hashtable_policy.h:1346:12: error: use of deleted function 'std::__detail::_Hashtable_ebo_helper<1, std::hash<std::pair<int, int> >, true>::~_Hashtable_ebo_helper()' In file included from /usr/include/c++/9/unordered_map:46, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:117, from city.cpp:2: /usr/include/c++/9/bits/hashtable.h:414:7: error: use of deleted function 'std::__detail::_Hashtable_base<std::pair<int, int>, std::pair<const std::pair<int, int>, int>, std::__detail::_Select1st, std::equal_to<std::pair<int, int> >, std::hash<std::pair<int, int> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Hashtable_traits<true, false, true> >::~_Hashtable_base()' 414 | _Hashtable() = default; | ^~~~~~~~~~ In file included from /usr/include/c++/9/bits/hashtable.h:35, from /usr/include/c++/9/unordered_map:46, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:117, from city.cpp:2: /usr/include/c++/9/bits/hashtable_policy.h:1770:10: note: 'std::__detail::_Hashtable_base<std::pair<int, int>, std::pair<const std::pair<int, int>, int>, std::__detail::_Select1st, std::equal_to<std::pair<int, int> >, std::hash<std::pair<int, int> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Hashtable_traits<true, false, true> >::~_Hashtable_base()' is implicitly deleted because the default definition would be ill-formed: 1770 | struct _Hashtable_base | ^~~~~~~~~~~~~~~ /usr/include/c++/9/bits/hashtable_policy.h:1770:10: error: use of deleted function 'std::__detail::_Hash_code_base<std::pair<int, int>, std::pair<const std::pair<int, int>, int>, std::__detail::_Select1st, std::hash<std::pair<int, int> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, true>::~_Hash_code_base()' city.cpp:36:19: warning: comparison of integer expressions of different signedness: 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare] 36 | while(bfs.size()!=N) | ~~~~~~~~~~^~~ city.cpp:35:8: warning: unused variable 'ok' [-Wunused-variable] 35 | bool ok=1; | ^~ In file included from /usr/include/c++/9/unordered_map:46, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:117, from city.cpp:2: /usr/include/c++/9/bits/hashtable.h: In instantiation of 'std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::~_Hashtable() [with _Key = std::pair<int, int>; _Value = std::pair<const std::pair<int, int>, int>; _Alloc = std::allocator<std::pair<const std::pair<int, int>, int> >; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::pair<int, int> >; _H1 = std::hash<std::pair<int, int> >; _H2 = std::__detail::_Mod_range_hashing; _Hash = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<true, false, true>]': /usr/include/c++/9/bits/unordered_map.h:102:11: required from here /usr/include/c++/9/bits/hashtable.h:1354:5: error: use of deleted function 'std::__detail::_Hashtable_base<std::pair<int, int>, std::pair<const std::pair<int, int>, int>, std::__detail::_Select1st, std::equal_to<std::pair<int, int> >, std::hash<std::pair<int, int> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Hashtable_traits<true, false, true> >::~_Hashtable_base()' 1354 | } | ^ In file included from /usr/include/c++/9/bits/hashtable.h:35, from /usr/include/c++/9/unordered_map:46, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:117, from city.cpp:2: /usr/include/c++/9/bits/hashtable_policy.h: In instantiation of 'std::__detail::_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, std::__detail::_Default_ranged_hash, true>::__hash_code std::__detail::_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, std::__detail::_Default_ranged_hash, true>::_M_hash_code(const _Key&) const [with _Key = std::pair<int, int>; _Value = std::pair<const std::pair<int, int>, int>; _ExtractKey = std::__detail::_Select1st; _H1 = std::hash<std::pair<int, int> >; _H2 = std::__detail::_Mod_range_hashing; std::__detail::_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, std::__detail::_Default_ranged_hash, true>::__hash_code = long unsigned int]': /usr/include/c++/9/bits/hashtable_policy.h:720:19: required from 'std::__detail::_Map_base<_Key, _Pair, _Alloc, std::__detail::_Select1st, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits, true>::mapped_type& std::__detail::_Map_base<_Key, _Pair, _Alloc, std::__detail::_Select1st, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits, true>::operator[](std::__detail::_Map_base<_Key, _Pair, _Alloc, std::__detail::_Select1st, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits, true>::key_type&&) [with _Key = std::pair<int, int>; _Pair = std::pair<const std::pair<int, int>, int>; _Alloc = std::allocator<std::pair<const std::pair<int, int>, int> >; _Equal = std::equal_to<std::pair<int, int> >; _H1 = std::hash<std::pair<int, int> >; _H2 = std::__detail::_Mod_range_hashing; _Hash = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<true, false, true>; std::__detail::_Map_base<_Key, _Pair, _Alloc, std::__detail::_Select1st, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits, true>::mapped_type = int; std::__detail::_Map_base<_Key, _Pair, _Alloc, std::__detail::_Select1st, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits, true>::key_type = std::pair<int, int>]' /usr/include/c++/9/bits/unordered_map.h:989:20: required from 'std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::mapped_type& std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::key_type&&) [with _Key = std::pair<int, int>; _Tp = int; _Hash = std::hash<std::pair<int, int> >; _Pred = std::equal_to<std::pair<int, int> >; _Alloc = std::allocator<std::pair<const std::pair<int, int>, int> >; std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::mapped_type = int; std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::key_type = std::pair<int, int>]' city.cpp:25:28: required from here /usr/include/c++/9/bits/hashtable_policy.h:1382:16: error: static assertion failed: hash function must be invocable with an argument of key type 1382 | static_assert(__is_invocable<const _H1&, const _Key&>{}, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/9/bits/hashtable_policy.h:1384:16: error: no match for call to '(const std::hash<std::pair<int, int> >) (const std::pair<int, int>&)' 1384 | return _M_h1()(__k); | ~~~~~~~^~~~~