Submission #831538

# Submission time Handle Problem Language Result Execution time Memory
831538 2023-08-20T10:16:43 Z MrDeboo Catfish Farm (IOI22_fish) C++17
Compilation error
0 ms 0 KB
#include "fish.h"
#include "bits/stdc++.h"
#define int long long
using namespace std;
unordered_map<pair<int,pair<int,int>>,int>dp;
map<int,int>vct[200000];
vector<int>v[200000];
int N;
int slv(int a,int b,int c){
    if(a==N)return 0;
    if(dp.count({a,{b,c}}))return dp[{a,{b,c}}];
    // cerr<<a<<' '<<b<<endl;
    int mx=0;
    int tot=0;
    for(auto &i:v[a]){
        if(i<=b&&vct[a].count(i))tot-=vct[a][i];
        if(i>max(b,c)&&vct[a-1].count(i))tot+=vct[a-1][i];
        if(vct[a+1].count(i))tot+=vct[a+1][i];
        mx=max(mx,slv(a+1,i,b)+tot);
    }
    return dp[{a,{b,c}}]=mx;
}
long long max_weights(int32_t n, int32_t m, std::vector<int32_t> x, std::vector<int32_t> y, std::vector<int32_t> w) {
    N=n;
    for(int i=0;i<=n;i++)v[i].push_back(0);
    for(int i=0;i<m;i++){
        vct[x[i]][y[i]+1]=w[i];
        if(x[i])v[x[i]-1].push_back(y[i]+1);
        v[x[i]].push_back(y[i]+1);
        v[x[i]+1].push_back(y[i]+1);
    }
    for(int i=0;i<=n;i++)sort(v[i].begin(),v[i].end());
    for(int i=0;i<=n;i++)v[i].resize(unique(v[i].begin(),v[i].end())-v[i].begin());
    return slv(0,0,0);
}

Compilation message

fish.cpp:5:43: error: use of deleted function 'std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map() [with _Key = std::pair<long long int, std::pair<long long int, long long int> >; _Tp = long long int; _Hash = std::hash<std::pair<long long int, std::pair<long long int, long long int> > >; _Pred = std::equal_to<std::pair<long long int, std::pair<long long int, long long int> > >; _Alloc = std::allocator<std::pair<const std::pair<long long int, std::pair<long long int, long long int> >, long long int> >]'
    5 | unordered_map<pair<int,pair<int,int>>,int>dp;
      |                                           ^~
In file included from /usr/include/c++/10/unordered_map:47,
                 from /usr/include/c++/10/functional:61,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from fish.cpp:2:
/usr/include/c++/10/bits/unordered_map.h:141:7: note: 'std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map() [with _Key = std::pair<long long int, std::pair<long long int, long long int> >; _Tp = long long int; _Hash = std::hash<std::pair<long long int, std::pair<long long int, long long int> > >; _Pred = std::equal_to<std::pair<long long int, std::pair<long long int, long long int> > >; _Alloc = std::allocator<std::pair<const std::pair<long long int, std::pair<long long int, 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::pair<long long int, std::pair<long long int, long long int> >; _Value = std::pair<const std::pair<long long int, std::pair<long long int, long long int> >, long long int>; _Alloc = std::allocator<std::pair<const std::pair<long long int, std::pair<long long int, long long int> >, long long int> >; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::pair<long long int, std::pair<long long int, long long int> > >; _H1 = std::hash<std::pair<long long int, std::pair<long long int, 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/c++/10/functional:61,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from fish.cpp:2:
/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::pair<long long int, std::pair<long long int, long long int> >; _Value = std::pair<const std::pair<long long int, std::pair<long long int, long long int> >, long long int>; _Alloc = std::allocator<std::pair<const std::pair<long long int, std::pair<long long int, long long int> >, long long int> >; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::pair<long long int, std::pair<long long int, long long int> > >; _H1 = std::hash<std::pair<long long int, std::pair<long long int, 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::pair<long long int, std::pair<long long int, long long int> >; _Value = std::pair<const std::pair<long long int, std::pair<long long int, long long int> >, long long int>; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::pair<long long int, std::pair<long long int, long long int> > >; _H1 = std::hash<std::pair<long long int, std::pair<long long int, 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/c++/10/functional:61,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from fish.cpp:2:
/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::pair<long long int, std::pair<long long int, long long int> >; _Value = std::pair<const std::pair<long long int, std::pair<long long int, long long int> >, long long int>; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::pair<long long int, std::pair<long long int, long long int> > >; _H1 = std::hash<std::pair<long long int, std::pair<long long int, 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::pair<long long int, std::pair<long long int, long long int> >; _Value = std::pair<const std::pair<long long int, std::pair<long long int, long long int> >, long long int>; _ExtractKey = std::__detail::_Select1st; _H1 = std::hash<std::pair<long long int, std::pair<long long int, 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::pair<long long int, std::pair<long long int, long long int> >; _Value = std::pair<const std::pair<long long int, std::pair<long long int, long long int> >, long long int>; _ExtractKey = std::__detail::_Select1st; _H1 = std::hash<std::pair<long long int, std::pair<long long int, 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::pair<long long int, std::pair<long long int, 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::pair<long long int, std::pair<long long int, 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::pair<long long int, std::pair<long long int, long long int> > >::hash()'
In file included from /usr/include/c++/10/bits/stl_bvector.h:61,
                 from /usr/include/c++/10/vector:68,
                 from fish.h:1,
                 from fish.cpp:1:
/usr/include/c++/10/bits/functional_hash.h:101:12: note: 'std::hash<std::pair<long long int, std::pair<long long int, 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::pair<long long int, std::pair<long long int, 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::pair<long long int, std::pair<long long int, 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::pair<long long int, std::pair<long long int, 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/c++/10/functional:61,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from fish.cpp:2:
/usr/include/c++/10/bits/hashtable_policy.h:1112:7: error: use of deleted function 'std::hash<std::pair<long long int, std::pair<long long int, long long int> > >::~hash()'
 1112 |       _Hashtable_ebo_helper() = default;
      |       ^~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/10/bits/stl_bvector.h:61,
                 from /usr/include/c++/10/vector:68,
                 from fish.h:1,
                 from fish.cpp:1:
/usr/include/c++/10/bits/functional_hash.h:101:12: note: 'std::hash<std::pair<long long int, std::pair<long long int, 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::pair<long long int, std::pair<long long int, 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/c++/10/functional:61,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from fish.cpp:2:
/usr/include/c++/10/bits/hashtable_policy.h:1368:7: error: use of deleted function 'std::__detail::_Hashtable_ebo_helper<1, std::hash<std::pair<long long int, std::pair<long long int, 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::pair<long long int, std::pair<long long int, 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::pair<long long int, std::pair<long long int, 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::pair<long long int, std::pair<long long int, long long int> >, std::pair<const std::pair<long long int, std::pair<long long int, long long int> >, long long int>, std::__detail::_Select1st, std::hash<std::pair<long long int, std::pair<long long int, 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::pair<long long int, std::pair<long long int, long long int> >, std::pair<const std::pair<long long int, std::pair<long long int, long long int> >, long long int>, std::__detail::_Select1st, std::hash<std::pair<long long int, std::pair<long long int, 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::pair<long long int, std::pair<long long int, long long int> > >, true>::~_Hashtable_ebo_helper()'
In file included from /usr/include/c++/10/unordered_map:46,
                 from /usr/include/c++/10/functional:61,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from fish.cpp:2:
/usr/include/c++/10/bits/hashtable.h:451:7: error: use of deleted function 'std::__detail::_Hashtable_base<std::pair<long long int, std::pair<long long int, long long int> >, std::pair<const std::pair<long long int, std::pair<long long int, long long int> >, long long int>, std::__detail::_Select1st, std::equal_to<std::pair<long long int, std::pair<long long int, long long int> > >, std::hash<std::pair<long long int, std::pair<long long int, long long int> > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Hashtable_traits<true, false, 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/c++/10/functional:61,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from fish.cpp:2:
/usr/include/c++/10/bits/hashtable_policy.h:1725:10: note: 'std::__detail::_Hashtable_base<std::pair<long long int, std::pair<long long int, long long int> >, std::pair<const std::pair<long long int, std::pair<long long int, long long int> >, long long int>, std::__detail::_Select1st, std::equal_to<std::pair<long long int, std::pair<long long int, long long int> > >, std::hash<std::pair<long long int, std::pair<long long int, long long 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:
 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::pair<long long int, std::pair<long long int, long long int> >, std::pair<const std::pair<long long int, std::pair<long long int, long long int> >, long long int>, std::__detail::_Select1st, std::hash<std::pair<long long int, std::pair<long long int, long long int> > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, true>::~_Hash_code_base()'
/usr/include/c++/10/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<long long int, std::pair<long long int, long long int> >; _Value = std::pair<const std::pair<long long int, std::pair<long long int, long long int> >, long long int>; _ExtractKey = std::__detail::_Select1st; _H1 = std::hash<std::pair<long long int, std::pair<long long int, long long 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++/10/bits/hashtable.h:1484:46:   required from 'std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::size_type std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::count(const key_type&) const [with _Key = std::pair<long long int, std::pair<long long int, long long int> >; _Value = std::pair<const std::pair<long long int, std::pair<long long int, long long int> >, long long int>; _Alloc = std::allocator<std::pair<const std::pair<long long int, std::pair<long long int, long long int> >, long long int> >; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::pair<long long int, std::pair<long long int, long long int> > >; _H1 = std::hash<std::pair<long long int, std::pair<long long int, 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>; std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::size_type = long unsigned int; std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::key_type = std::pair<long long int, std::pair<long long int, long long int> >]'
/usr/include/c++/10/bits/unordered_map.h:938:26:   required from 'std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::size_type std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::count(const key_type&) const [with _Key = std::pair<long long int, std::pair<long long int, long long int> >; _Tp = long long int; _Hash = std::hash<std::pair<long long int, std::pair<long long int, long long int> > >; _Pred = std::equal_to<std::pair<long long int, std::pair<long long int, long long int> > >; _Alloc = std::allocator<std::pair<const std::pair<long long int, std::pair<long long int, long long int> >, long long int> >; std::unordered_map<_Key, _Tp, _Hash, _Pred, _Allo