# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1073379 | 2024-08-24T13:48:14 Z | beaconmc | Pictionary (COCI18_pictionary) | C++14 | Compilation error |
0 ms | 0 KB |
#include <bits/stdc++.h> typedef long long ll; #define FOR(i,x,y) for(ll i=x; i<y; i++) #define FORNEG(i,x,y) for(ll i=x; i>y; i--) using namespace std; const ll maxn = 100005; unordered_set<vector<ll>> req[maxn]; unordered_set<ll> has[maxn]; unordered_map<ll,ll> opps; ll cmp[maxn]; ll find(ll a){ while (a != cmp[a]){ cmp[a] = cmp[cmp[a]]; a = cmp[a]; } return a; } unordered_map<vector<ll>, ll> ans; void unite(ll a, ll b, ll k){ if (find(a) == find(b)) return; ll A = find(a); ll B = find(b); if (req[B].size() > req[A].size()){ swap(A, B); } vector<vector<ll>> used; for (auto&i : req[B]){ if (has[A].count(i[0])){ ans[{i[0], i[1]}] = k; used.push_back(i); } } for (auto&i : used) req[B].erase(i); for (auto&i : used) reverse(i.begin(), i.end()); for (auto&i : used) req[A].erase(i); if (has[A].size() > has[B].size()) swap(has[A], has[B]); for (auto&i : has[A]){ has[B].insert(i); } if (req[A].size() > req[B].size()) swap(req[A], req[B]); for (auto&i : req[A]){ req[B].insert(i); } cmp[A] = B; } int main(){ FOR(i,0,maxn) cmp[i] = i; ll n,m,q; cin >> n >> m >> q; vector<vector<ll>> queries; FOR(i,0,q){ ll a,b; cin >> a >> b; queries.push_back({a,b}); req[b].insert({a, b}); req[a].insert({b,a}); } FOR(i,1,n+1) has[i].insert(i); FORNEG(i, m, 0){ ll cur = i; while (cur+i <= n){ unite(cur, cur+i, i); cur+=i; } } for (auto&i : queries){ if (ans.count(i)) cout << m-ans[i]+1 << "\n"; else{ reverse(i.begin(), i.end()); cout << m-ans[i]+1 << "\n"; } } }
Compilation message
pictionary.cpp:11:35: error: use of deleted function 'std::unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set() [with _Value = std::vector<long long int>; _Hash = std::hash<std::vector<long long int> >; _Pred = std::equal_to<std::vector<long long int> >; _Alloc = std::allocator<std::vector<long long int> >]' 11 | unordered_set<vector<ll>> req[maxn]; | ^ In file included from /usr/include/c++/10/unordered_set:47, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:118, from pictionary.cpp:1: /usr/include/c++/10/bits/unordered_set.h:135:7: note: 'std::unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set() [with _Value = std::vector<long long int>; _Hash = std::hash<std::vector<long long int> >; _Pred = std::equal_to<std::vector<long long int> >; _Alloc = std::allocator<std::vector<long long int> >]' is implicitly deleted because the default definition would be ill-formed: 135 | unordered_set() = default; | ^~~~~~~~~~~~~ /usr/include/c++/10/bits/unordered_set.h:135:7: error: use of deleted function 'std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::_Hashtable() [with _Key = std::vector<long long int>; _Value = std::vector<long long int>; _Alloc = std::allocator<std::vector<long long int> >; _ExtractKey = std::__detail::_Identity; _Equal = std::equal_to<std::vector<long long int> >; _H1 = std::hash<std::vector<long long 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, true, true>]' In file included from /usr/include/c++/10/unordered_map:46, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:117, from pictionary.cpp:1: /usr/include/c++/10/bits/hashtable.h:451:7: note: 'std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::_Hashtable() [with _Key = std::vector<long long int>; _Value = std::vector<long long int>; _Alloc = std::allocator<std::vector<long long int> >; _ExtractKey = std::__detail::_Identity; _Equal = std::equal_to<std::vector<long long int> >; _H1 = std::hash<std::vector<long long 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, true, true>]' is implicitly deleted because the default definition would be ill-formed: 451 | _Hashtable() = default; | ^~~~~~~~~~ /usr/include/c++/10/bits/hashtable.h:451:7: error: use of deleted function 'std::__detail::_Hashtable_base<_Key, _Value, _ExtractKey, _Equal, _H1, _H2, _Hash, _Traits>::_Hashtable_base() [with _Key = std::vector<long long int>; _Value = std::vector<long long int>; _ExtractKey = std::__detail::_Identity; _Equal = std::equal_to<std::vector<long long int> >; _H1 = std::hash<std::vector<long long int> >; _H2 = std::__detail::_Mod_range_hashing; _Hash = std::__detail::_Default_ranged_hash; _Traits = std::__detail::_Hashtable_traits<true, true, true>]' In file included from /usr/include/c++/10/bits/hashtable.h:35, from /usr/include/c++/10/unordered_map:46, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:117, from pictionary.cpp:1: /usr/include/c++/10/bits/hashtable_policy.h:1791:5: note: 'std::__detail::_Hashtable_base<_Key, _Value, _ExtractKey, _Equal, _H1, _H2, _Hash, _Traits>::_Hashtable_base() [with _Key = std::vector<long long int>; _Value = std::vector<long long int>; _ExtractKey = std::__detail::_Identity; _Equal = std::equal_to<std::vector<long long int> >; _H1 = std::hash<std::vector<long long int> >; _H2 = std::__detail::_Mod_range_hashing; _Hash = std::__detail::_Default_ranged_hash; _Traits = std::__detail::_Hashtable_traits<true, true, true>]' is implicitly deleted because the default definition would be ill-formed: 1791 | _Hashtable_base() = default; | ^~~~~~~~~~~~~~~ /usr/include/c++/10/bits/hashtable_policy.h:1791: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::vector<long long int>; _Value = std::vector<long long int>; _ExtractKey = std::__detail::_Identity; _H1 = std::hash<std::vector<long long int> >; _H2 = std::__detail::_Mod_range_hashing]' /usr/include/c++/10/bits/hashtable_policy.h:1368:7: note: 'std::__detail::_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, std::__detail::_Default_ranged_hash, true>::_Hash_code_base() [with _Key = std::vector<long long int>; _Value = std::vector<long long int>; _ExtractKey = std::__detail::_Identity; _H1 = std::hash<std::vector<long long int> >; _H2 = std::__detail::_Mod_range_hashing]' is implicitly deleted because the default definition would be ill-formed: 1368 | _Hash_code_base() = default; | ^~~~~~~~~~~~~~~ /usr/include/c++/10/bits/hashtable_policy.h:1368: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::vector<long long int> >]' /usr/include/c++/10/bits/hashtable_policy.h:1112:7: note: 'std::__detail::_Hashtable_ebo_helper<_Nm, _Tp, true>::_Hashtable_ebo_helper() [with int _Nm = 1; _Tp = std::hash<std::vector<long long int> >]' is implicitly deleted because the default definition would be ill-formed: 1112 | _Hashtable_ebo_helper() = default; | ^~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/10/bits/hashtable_policy.h:1112:7: error: use of deleted function 'std::hash<std::vector<long long int> >::hash()' In file included from /usr/include/c++/10/bits/basic_string.h:6787, from /usr/include/c++/10/string:55, from /usr/include/c++/10/bits/locale_classes.h:40, from /usr/include/c++/10/bits/ios_base.h:41, from /usr/include/c++/10/ios:42, from /usr/include/c++/10/istream:38, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from pictionary.cpp:1: /usr/include/c++/10/bits/functional_hash.h:101:12: note: 'std::hash<std::vector<long long int> >::hash()' is implicitly deleted because the default definition would be ill-formed: 101 | struct hash : __hash_enum<_Tp> | ^~~~ /usr/include/c++/10/bits/functional_hash.h:101:12: error: no matching function for call to 'std::__hash_enum<std::vector<long long int>, false>::__hash_enum()' /usr/include/c++/10/bits/functional_hash.h:82:7: note: candidate: 'std::__hash_enum<_Tp, <anonymous> >::__hash_enum(std::__hash_enum<_Tp, <anonymous> >&&) [with _Tp = std::vector<long long int>; bool <anonymous> = false]' 82 | __hash_enum(__hash_enum&&); | ^~~~~~~~~~~ /usr/include/c++/10/bits/functional_hash.h:82:7: note: candidate expects 1 argument, 0 provided /usr/include/c++/10/bits/functional_hash.h:101:12: error: 'std::__hash_enum<_Tp, <anonymous> >::~__hash_enum() [with _Tp = std::vector<long long int>; bool <anonymous> = false]' is private within this context 101 | struct hash : __hash_enum<_Tp> | ^~~~ /usr/include/c++/10/bits/functional_hash.h:83:7: note: declared private here 83 | ~__hash_enum(); | ^ In file included from /usr/include/c++/10/bits/hashtable.h:35, from /usr/include/c++/10/unordered_map:46, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:117, from pictionary.cpp:1: /usr/include/c++/10/bits/hashtable_policy.h:1112:7: error: use of deleted function 'std::hash<std::vector<long long int> >::~hash()' 1112 | _Hashtable_ebo_helper() = default; | ^~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/10/bits/basic_string.h:6787, from /usr/include/c++/10/string:55, from /usr/include/c++/10/bits/locale_classes.h:40, from /usr/include/c++/10/bits/ios_base.h:41, from /usr/include/c++/10/ios:42, from /usr/include/c++/10/istream:38, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from pictionary.cpp:1: /usr/include/c++/10/bits/functional_hash.h:101:12: note: 'std::hash<std::vector<long long int> >::~hash()' is implicitly deleted because the default definition would be ill-formed: 101 | struct hash : __hash_enum<_Tp> | ^~~~ /usr/include/c++/10/bits/functional_hash.h:101:12: error: 'std::__hash_enum<_Tp, <anonymous> >::~__hash_enum() [with _Tp = std::vector<long long int>; bool <anonymous> = false]' is private within this context /usr/include/c++/10/bits/functional_hash.h:83:7: note: declared private here 83 | ~__hash_enum(); | ^ In file included from /usr/include/c++/10/bits/hashtable.h:35, from /usr/include/c++/10/unordered_map:46, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:117, from pictionary.cpp:1: /usr/include/c++/10/bits/hashtable_policy.h:1368:7: error: use of deleted function 'std::__detail::_Hashtable_ebo_helper<1, std::hash<std::vector<long long int> >, true>::~_Hashtable_ebo_helper()' 1368 | _Hash_code_base() = default; | ^~~~~~~~~~~~~~~ /usr/include/c++/10/bits/hashtable_policy.h:1109:12: note: 'std::__detail::_Hashtable_ebo_helper<1, std::hash<std::vector<long long int> >, true>::~_Hashtable_ebo_helper()' is implicitly deleted because the default definition would be ill-formed: 1109 | struct _Hashtable_ebo_helper<_Nm, _Tp, true> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/10/bits/hashtable_policy.h:1109:12: error: use of deleted function 'std::hash<std::vector<long long int> >::~hash()' /usr/include/c++/10/bits/hashtable_policy.h:1791:5: error: use of deleted function 'std::__detail::_Hash_code_base<std::vector<long long int>, std::vector<long long int>, std::__detail::_Identity, std::hash<std::vector<long long int> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, true>::~_Hash_code_base()' 1791 | _Hashtable_base() = default; | ^~~~~~~~~~~~~~~ /usr/include/c++/10/bits/hashtable_policy.h:1341:12: note: 'std::__detail::_Hash_code_base<std::vector<long long int>, std::vector<long long int>, std::__detail::_Identity, std::hash<std::vector<long long 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: 1341 | struct _Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1342 | _Default_ranged_hash, true> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/10/bits/hashtable_policy.h:1341:12: error: use of deleted function 'std::__detail::_Hashtable_ebo_helper<1, std::hash<std::vector<long long int> >, true>::~_Hashtable_ebo_helper()' In file included from /usr/include/c++/10/unordered_map:46, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:117, from pictionary.cpp:1: /usr/include/c++/10/bits/hashtable.h:451:7: error: use of deleted function 'std::__detail::_Hashtable_base<std::vector<long long int>, std::vector<long long int>, std::__detail::_Identity, std::equal_to<std::vector<long long int> >, std::hash<std::vector<long long int> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Hashtable_traits<true, true, true> >::~_Hashtable_base()' 451 | _Hashtable() = default; | ^~~~~~~~~~ In file included from /usr/include/c++/10/bits/hashtable.h:35, from /usr/include/c++/10/unordered_map:46, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:117, from pictionary.cpp:1: /usr/include/c++/10/bits/hashtable_policy.h:1725:10: note: 'std::__detail::_Hashtable_base<std::vector<long long int>, std::vector<long long int>, std::__detail::_Identity, std::equal_to<std::vector<long long int> >, std::hash<std::vector<long long int> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Hashtable_traits<true, true, true> >::~_Hashtable_base()' is implicitly deleted because the default definition would be ill-formed: 1725 | struct _Hashtable_base | ^~~~~~~~~~~~~~~ /usr/include/c++/10/bits/hashtable_policy.h:1725:10: error: use of deleted function 'std::__detail::_Hash_code_base<std::vector<long long int>, std::vector<long long int>, std::__detail::_Identity, std::hash<std::vector<long long int> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, true>::~_Hash_code_base()' pictionary.cpp:26:31: error: use of deleted function 'std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map() [with _Key = std::vector<long long int>; _Tp = long long int; _Hash = std::hash<std::vector<long long int> >; _Pred = std::equal_to<std::vector<long long int> >; _Alloc = std::allocator<std::pair<const std::vector<long long int>, long long int> >]' 26 | unordered_map<vector<ll>, ll> ans; | ^~~ In file included from /usr/include/c++/10/unordered_map:47, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:117, from pictionary.cpp:1: /usr/include/c++/10/bits/unordered_map.h:141:7: note: 'std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map() [with _Key = std::vector<long long int>; _Tp = long long int; _Hash = std::hash<std::vector<long long int> >; _Pred = std::equal_to<std::vector<long long int> >; _Alloc = std::allocator<std::pair<const std::vector<long long int>, long long int> >]' is implicitly deleted because the default definition would be ill-formed: 141 | unordered_map() = default; | ^~~~~~~~~~~~~ /usr/include/c++/10/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::vector<long long int>; _Value = std::pair<const std::vector<long long int>, long long int>; _Alloc = std::allocator<std::pair<const std::vector<long long int>, long long int> >; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::vector<long long int> >; _H1 = std::hash<std::vector<long long 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++/10/unordered_map:46, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:117, from pictionary.cpp:1: /usr/include/c++/10/bits/hashtable.h:451:7: note: 'std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::_Hashtable() [with _Key = std::vector<long long int>; _Value = std::pair<const std::vector<long long int>, long long int>; _Alloc = std::allocator<std::pair<const std::vector<long long int>, long long int> >; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::vector<long long int> >; _H1 = std::hash<std::vector<long long 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: 451 | _Hashtable() = default; | ^~~~~~~~~~ /usr/include/c++/10/bits/hashtable.h:451:7: error: use of deleted function 'std::__detail::_Hashtable_base<_Key, _Value, _ExtractKey, _Equal, _H1, _H2, _Hash, _Traits>::_Hashtable_base() [with _Key = std::vector<long long int>; _Value = std::pair<const std::vector<long long int>, long long int>; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::vector<long long int> >; _H1 = std::hash<std::vector<long long 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++/10/bits/hashtable.h:35, from /usr/include/c++/10/unordered_map:46, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:117, from pictionary.cpp:1: /usr/include/c++/10/bits/hashtable_policy.h:1791:5: note: 'std::__detail::_Hashtable_base<_Key, _Value, _ExtractKey, _Equal, _H1, _H2, _Hash, _Traits>::_Hashtable_base() [with _Key = std::vector<long long int>; _Value = std::pair<const std::vector<long long int>, long long int>; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::vector<long long int> >; _H1 = std::hash<std::vector<long long 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: 1791 | _Hashtable_base() = default; | ^~~~~~~~~~~~~~~ /usr/include/c++/10/bits/hashtable_policy.h:1791: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::vector<long long int>; _Value = std::pair<const std::vector<long long int>, long long int>; _ExtractKey = std::__detail::_Select1st; _H1 = std::hash<std::vector<long long int> >; _H2 = std::__detail::_Mod_range_hashing]' /usr/include/c++/10/bits/hashtable_policy.h:1368:7: note: 'std::__detail::_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, std::__detail::_Default_ranged_hash, true>::_Hash_code_base() [with _Key = std::vector<long long int>; _Value = std::pair<const std::vector<long long int>, long long int>; _ExtractKey = std::__detail::_Select1st; _H1 = std::hash<std::vector<long long int> >; _H2 = std::__detail::_Mod_range_hashing]' is implicitly deleted because the default definition would be ill-formed: 1368 | _Hash_code_base() = default; | ^~~~~~~~~~~~~~~ /usr/include/c++/10/bits/hashtable_policy.h:1368: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::vector<long long int> >]' /usr/include/c++/10/bits/hashtable_policy.h:1368:7: error: use of deleted function 'std::__detail::_Hashtable_ebo_helper<1, std::hash<std::vector<long long int> >, true>::~_Hashtable_ebo_helper()' /usr/include/c++/10/bits/hashtable_policy.h:1791:5: error: use of deleted function 'std::__detail::_Hash_code_base<std::vector<long long int>, std::pair<const std::vector<long long int>, long long int>, std::__detail::_Select1st, std::hash<std::vector<long long int> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, true>::~_Hash_code_base()' 1791 | _Hashtable_base() = default