# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
607626 | sushant52 | Bank (IZhO14_bank) | C++17 | Compilation error | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/////////////////////////////////////////////////////////////////////////////////////////////////////
#include <bits/stdc++.h>
using namespace std;
///////////////////////////////////////////////////////////////////////////////////////////////////////
#define MOD 1000000009
#define BIG 100000000000000000
#define PB push_back
#define MP make_pair
#define inn(x) \
long long x; \
cin >> x;
#define all(x) (x).begin(), (x).end()
#pragma GCC optimize("O2")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx2")
#define spp << " "
#define int long long
const int mod = 5;
int powmod(int a, int b)
{
int res = 1;
a %= mod;
assert(b >= 0);
for (; b; b >>= 1)
{
if (b & 1)
res = res * a % mod;
a = a * a % mod;
}
return res;
}
// #define endl "\n"
// struct comparator
// {
// bool operator()(const pair<int,pair<int,int> > p1 , const pair<int,pair<int,int> > p2)
// {
// return (p1.first>p2.first || p1.second.first<p2.second.first);
// }
// };
// int not_prime[100001]={0};
// int arr[100001]={0};
// void seive()
// {
// not_prime[0]=not_prime[1]=1;
// for (int i = 2; i * i <= 100000; i++)
// {
// if(!not_prime[i])
// {
// for(int j = i * i; j <= 100000; j += i)
// not_prime[j] = 1;
// }
// }
// }
// void kprime()
// {
// arr[0]=0;arr[1]=0;arr[2]=1;arr[3]=1;
// for(int i=4;i<100001;++i)
// {
// int temp=i;
// for(auto x:prime)
// {
// if(x*x>temp)
// break;
// if(temp%x==0)
// ++arr[i];
// while(temp%x==0)
// temp/=x;
// }
// if(temp>1)
// ++arr[i];
// }
// }
int n, m;
vector<int> req;
vector<int> nums;
unordered_map<pair<int, int>, bool> dp;
bool recurse(int i, int cur, int mask)
{
if (i >= req.size())
return true;
if (dp.find({cur, mask}) != dp.end())
return dp[{cur, mask}];
if (cur == 0)
return (dp[{cur, mask}] = recurse(i + 1, i + 1 < req.size() ? req[i + 1] : 0, mask));
if (cur < 0)
return false;
bool flag = false;
for (int j = 0; j < m; ++j)
{
if (mask & (1 << j))
flag = flag || recurse(i, cur - nums[j], mask ^ (1 << j));
if (flag)
break;
}
return (dp[{cur, mask}] = flag);
}
void solve()
{
cin >> n >> m;
for (int i = 0; i < n; ++i)
{
int x;
cin >> x;
req.emplace_back(x);
}
for (int i = 0; i < m; ++i)
{
int x;
cin >> x;
nums.emplace_back(x);
}
cout << (recurse(0, req[0], (1 << m) - 1) ? "YES" : "NO");
return;
}
int32_t main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
// inn(t);
// while (t--)
solve();
}
Compilation message (stderr)
bank.cpp:81:37: error: use of deleted function 'std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map() [with _Key = std::pair<long long int, long long int>; _Tp = bool; _Hash = std::hash<std::pair<long long int, long long int> >; _Pred = std::equal_to<std::pair<long long int, long long int> >; _Alloc = std::allocator<std::pair<const std::pair<long long int, long long int>, bool> >]' 81 | unordered_map<pair<int, int>, bool> 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 bank.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, long long int>; _Tp = bool; _Hash = std::hash<std::pair<long long int, long long int> >; _Pred = std::equal_to<std::pair<long long int, long long int> >; _Alloc = std::allocator<std::pair<const std::pair<long long int, long long int>, bool> >]' 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, long long int>; _Value = std::pair<const std::pair<long long int, long long int>, bool>; _Alloc = std::allocator<std::pair<const std::pair<long long int, long long int>, bool> >; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::pair<long long int, long long int> >; _H1 = std::hash<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 bank.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, long long int>; _Value = std::pair<const std::pair<long long int, long long int>, bool>; _Alloc = std::allocator<std::pair<const std::pair<long long int, long long int>, bool> >; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::pair<long long int, long long int> >; _H1 = std::hash<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, long long int>; _Value = std::pair<const std::pair<long long int, long long int>, bool>; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::pair<long long int, long long int> >; _H1 = std::hash<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 bank.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, long long int>; _Value = std::pair<const std::pair<long long int, long long int>, bool>; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::pair<long long int, long long int> >; _H1 = std::hash<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, long long int>; _Value = std::pair<const std::pair<long long int, long long int>, bool>; _ExtractKey = std::__detail::_Select1st; _H1 = std::hash<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, long long int>; _Value = std::pair<const std::pair<long long int, long long int>, bool>; _ExtractKey = std::__detail::_Select1st; _H1 = std::hash<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, 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, 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, long long int> >::hash()' In file included from /usr/include/c++/10/string_view:42, from /usr/include/c++/10/bits/basic_string.h:48, 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 bank.cpp:2: /usr/include/c++/10/bits/functional_hash.h:101:12: note: 'std::hash<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, 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, 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, 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 bank.cpp:2: /usr/include/c++/10/bits/hashtable_policy.h:1112:7: error: use of deleted function 'std::hash<std::pair<long long int, long long int> >::~hash()' 1112 | _Hashtable_ebo_helper() = default; | ^~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/10/string_view:42, from /usr/include/c++/10/bits/basic_string.h:48, 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 bank.cpp:2: /usr/include/c++/10/bits/functional_hash.h:101:12: note: 'std::hash<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, 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 bank.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, 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, 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, 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, long long int>, std::pair<const std::pair<long long int, long long int>, bool>, std::__detail::_Select1st, std::hash<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, long long int>, std::pair<const std::pair<long long int, long long int>, bool>, std::__detail::_Select1st, std::hash<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, 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 bank.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, long long int>, std::pair<const std::pair<long long int, long long int>, bool>, std::__detail::_Select1st, std::equal_to<std::pair<long long int, long long int> >, std::hash<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 bank.cpp:2: /usr/include/c++/10/bits/hashtable_policy.h:1725:10: note: 'std::__detail::_Hashtable_base<std::pair<long long int, long long int>, std::pair<const std::pair<long long int, long long int>, bool>, std::__detail::_Select1st, std::equal_to<std::pair<long long int, long long int> >, std::hash<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, long long int>, std::pair<const std::pair<long long int, long long int>, bool>, std::__detail::_Select1st, std::hash<std::pair<long long int, long long int> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, true>::~_Hash_code_base()' bank.cpp: In function 'bool recurse(long long int, long long int, long long int)': bank.cpp:85:8: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare] 85 | if (i >= req.size()) | ~~^~~~~~~~~~~~~ bank.cpp:90:50: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare] 90 | return (dp[{cur, mask}] = recurse(i + 1, i + 1 < req.size() ? req[i + 1] : 0, mask)); | ~~~~~~^~~~~~~~~~~~ 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 bank.cpp:2: /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, long long int>; _Value = std::pair<const std::pair<long long int, long long int>, bool>; _ExtractKey = std::__detail::_Select1st; _H1 = std::hash<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:1452:46: required from 'std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::iterator std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::find(const key_type&) [with _Key = std::pair<long long int, long long int>; _Value = std::pair<const std::pair<long long int, long long int>, bool>; _Alloc = std::allocator<std::pair<const std::pair<long long int, long long int>, bool> >; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::pair<long long int, long long int> >; _H1 = std::hash<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>::iterator = std::__detail::_Hashtable_base<std::pair<long long int, long long int>, std::pair<const std::pair<long long int, long long int>, bool>, std::__detail::_Select1st, std::equal_to<std::pair<long long int, long long int> >, std::hash<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> >::iterator; std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::key_type = std::pair<long long int, long long int>]' /usr/include/c++/10/bits/unordered_map.h:920:25: required from 'std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::iterator std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::find(const key_type&) [with _Key = std::pair<long long int, long long int