# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
340073 | emil_physmath | 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 <algorithm>
#include <iostream>
#include <cstring>
#include <vector>
#include <set>
using namespace std;
typedef double ldouble;
typedef long long llong;
typedef unsigned int uint;
vector<uint> sumup[1001];
int sum[1 << 20], bits[1 << 20];
bool ok[1 << 20];
bool IsSet(uint mask, uint i)
{
return mask & (1 << i);
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int n, m;
cin >> n >> m;
vector<int> a(n);
for (int& x: a)
cin >> x;
vector<int> b(m);
for (int& x: b)
cin >> x;
for (uint mask = 0; mask < (1 << m); ++mask)
{
int curSum = 0, curBits = 0;
for (int i = 0; i < m; ++i)
if (IsSet(mask, i))
{
++curBits;
curSum += b[i];
}
if (curSum <= 1000)
sumup[curSum].push_back(mask);
sum[mask] = curSum;
bits[mask] = curBits;
}
vector<uint> possLeft;
possLeft.push_back((1 << m) - 1);
for (int i = 0; i < n; ++i)
{
for (uint mask = 0; mask < (1 << m); ++mask)
ok[mask] = false;
for (uint left: possLeft)
{
/*if ((1 << bits[left]) < sumup[a[i]].size())
{
for(uint mask = left; mask; mask = (mask - 1) & left)
if (sum[mask] == a[i])
ok[left ^ mask] = true;
}
else
{*/
for (uint mask: sumup[a[i]])
if ((mask & left) == mask)
ok[left ^ mask] = true;
//}
}
possLeft.clear();
for (uint mask = 0; mask < (1 << m); ++mask)
if (ok[mask])
possLeft.push_back(mask);
}
// cerr << possLeft.size() << endl;
cout << (possLeft.size() ? "YES" : "NO");
}
Compilation message (stderr)
bank.cpp:1:1: error: 'include' does not name a type 1 | include <algorithm> | ^~~~~~~ In file included from /usr/include/c++/9/iosfwd:40, from /usr/include/c++/9/ios:38, from /usr/include/c++/9/ostream:38, from /usr/include/c++/9/iostream:39, from bank.cpp:2: /usr/include/c++/9/bits/postypes.h:98:11: error: 'ptrdiff_t' does not name a type 98 | typedef ptrdiff_t streamsize; // Signed integral type | ^~~~~~~~~ /usr/include/c++/9/bits/postypes.h:41:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; did you forget to '#include <cstddef>'? 40 | #include <cwchar> // For mbstate_t +++ |+#include <cstddef> 41 | In file included from /usr/include/c++/9/bits/exception_ptr.h:40, from /usr/include/c++/9/exception:143, from /usr/include/c++/9/ios:39, from /usr/include/c++/9/ostream:38, from /usr/include/c++/9/iostream:39, from bank.cpp:2: /usr/include/c++/9/new:125:50: error: declaration of 'operator new' as non-function 125 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^ /usr/include/c++/9/new:125:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 125 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~ In file included from /usr/include/wchar.h:35, from /usr/include/c++/9/cwchar:44, from /usr/include/c++/9/bits/postypes.h:40, from /usr/include/c++/9/iosfwd:40, from /usr/include/c++/9/ios:38, from /usr/include/c++/9/ostream:38, from /usr/include/c++/9/iostream:39, from bank.cpp:2: /usr/lib/gcc/x86_64-linux-gnu/9/include/stddef.h:209:23: note: 'size_t' declared here 209 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ In file included from /usr/include/c++/9/bits/exception_ptr.h:40, from /usr/include/c++/9/exception:143, from /usr/include/c++/9/ios:39, from /usr/include/c++/9/ostream:38, from /usr/include/c++/9/iostream:39, from bank.cpp:2: /usr/include/c++/9/new:126:41: error: attributes after parenthesized initializer ignored [-fpermissive] 126 | __attribute__((__externally_visible__)); | ^ /usr/include/c++/9/new:127:52: error: declaration of 'operator new []' as non-function 127 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^ /usr/include/c++/9/new:127:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 127 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~ In file included from /usr/include/wchar.h:35, from /usr/include/c++/9/cwchar:44, from /usr/include/c++/9/bits/postypes.h:40, from /usr/include/c++/9/iosfwd:40, from /usr/include/c++/9/ios:38, from /usr/include/c++/9/ostream:38, from /usr/include/c++/9/iostream:39, from bank.cpp:2: /usr/lib/gcc/x86_64-linux-gnu/9/include/stddef.h:209:23: note: 'size_t' declared here 209 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ In file included from /usr/include/c++/9/bits/exception_ptr.h:40, from /usr/include/c++/9/exception:143, from /usr/include/c++/9/ios:39, from /usr/include/c++/9/ostream:38, from /usr/include/c++/9/iostream:39, from bank.cpp:2: /usr/include/c++/9/new:128:41: error: attributes after parenthesized initializer ignored [-fpermissive] 128 | __attribute__((__externally_visible__)); | ^ /usr/include/c++/9/new:134:29: error: 'std::size_t' has not been declared 134 | void operator delete(void*, std::size_t) _GLIBCXX_USE_NOEXCEPT | ^~~ /usr/include/c++/9/new:136:31: error: 'std::size_t' has not been declared 136 | void operator delete[](void*, std::size_t) _GLIBCXX_USE_NOEXCEPT | ^~~ /usr/include/c++/9/new:139:44: error: declaration of 'operator new' as non-function 139 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~~ /usr/include/c++/9/new:139:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? In file included from /usr/include/wchar.h:35, from /usr/include/c++/9/cwchar:44, from /usr/include/c++/9/bits/postypes.h:40, from /usr/include/c++/9/iosfwd:40, from /usr/include/c++/9/ios:38, from /usr/include/c++/9/ostream:38, from /usr/include/c++/9/iostream:39, from bank.cpp:2: /usr/lib/gcc/x86_64-linux-gnu/9/include/stddef.h:209:23: note: 'size_t' declared here 209 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ In file included from /usr/include/c++/9/bits/exception_ptr.h:40, from /usr/include/c++/9/exception:143, from /usr/include/c++/9/ios:39, from /usr/include/c++/9/ostream:38, from /usr/include/c++/9/iostream:39, from bank.cpp:2: /usr/include/c++/9/new:139:52: error: expected primary-expression before 'const' 139 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~ /usr/include/c++/9/new:141:46: error: declaration of 'operator new []' as non-function 141 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~~ /usr/include/c++/9/new:141:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? In file included from /usr/include/wchar.h:35, from /usr/include/c++/9/cwchar:44, from /usr/include/c++/9/bits/postypes.h:40, from /usr/include/c++/9/iosfwd:40, from /usr/include/c++/9/ios:38, from /usr/include/c++/9/ostream:38, from /usr/include/c++/9/iostream:39, from bank.cpp:2: /usr/lib/gcc/x86_64-linux-gnu/9/include/stddef.h:209:23: note: 'size_t' declared here 209 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ In file included from /usr/include/c++/9/bits/exception_ptr.h:40, from /usr/include/c++/9/exception:143, from /usr/include/c++/9/ios:39, from /usr/include/c++/9/ostream:38, from /usr/include/c++/9/iostream:39, from bank.cpp:2: /usr/include/c++/9/new:141:54: error: expected primary-expression before 'const' 141 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~ /usr/include/c++/9/new:148:44: error: declaration of 'operator new' as non-function 148 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t) | ^~~~~~ /usr/include/c++/9/new:148:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? In file included from /usr/include/wchar.h:35, from /usr/include/c++/9/cwchar:44, from /usr/include/c++/9/bits/postypes.h:40, from /usr/include/c++/9/iosfwd:40, from /usr/include/c++/9/ios:38, from /usr/include/c++/9/ostream:38, from /usr/include/c++/9/iostream:39, from bank.cpp:2: /usr/lib/gcc/x86_64-linux-gnu/9/include/stddef.h:209:23: note: 'size_t' declared here 209 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ In file included from /usr/include/c++/9/bits/exception_ptr.h:40, from /usr/include/c++/9/exception:143, from /usr/include/c++/9/ios:39, from /usr/include/c++/9/ostream:38, from /usr/include/c++/9/iostream:39, from bank.cpp:2: /usr/include/c++/9/new:148:68: error: expected primary-expression before ')' token 148 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t) | ^ /usr/include/c++/9/new:149:41: error: attributes after parenthesized initializer ignored [-fpermissive] 149 | __attribute__((__externally_visible__)); | ^ /usr/include/c++/9/new:150:44: error: declaration of 'operator new' as non-function 150 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~~ /usr/include/c++/9/new:150:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? In file included from /usr/include/wchar.h:35, from /usr/include/c++/9/cwchar:44, from /usr/include/c++/9/bits/postypes.h:40, from /usr/include/c++/9/iosfwd:40, from /usr/include/c++/9/ios:38, from /usr/include/c++/9/ostream:38, from /usr/include/c++/9/iostream:39, from bank.cpp:2: /usr/lib/gcc/x86_64-linux-gnu/9/include/stddef.h:209:23: note: 'size_t' declared here 209 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ In file included from /usr/include/c++/9/bits/exception_ptr.h:40, from /usr/include/c++/9/exception:143, from /usr/include/c++/9/ios:39, from /usr/include/c++/9/ostream:38, from /usr/include/c++/9/iostream:39, from bank.cpp:2: /usr/include/c++/9/new:150:68: error: expected primary-expression before ',' token 150 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&) | ^ /usr/include/c++/9/new:150:70: error: expected primary-expression before 'const' 150 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~ /usr/include/c++/9/new:156:46: error: declaration of 'operator new []' as non-function 156 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t) | ^~~~~~ /usr/include/c++/9/new:156:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? In file included from /usr/include/wchar.h:35, from /usr/include/c++/9/cwchar:44, from /usr/include/c++/9/bits/postypes.h:40, from /usr/include/c++/9/iosfwd:40, from /usr/include/c++/9/ios:38, from /usr/include/c++/9/ostream:38, from /usr/include/c++/9/iostream:39, from bank.cpp:2: /usr/lib/gcc/x86_64-linux-gnu/9/include/stddef.h:209:23: note: 'size_t' declared here 209 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ In file included from /usr/include/c++/9/bits/exception_ptr.h:40, from /usr/include/c++/9/exception:143, from /usr/include/c++/9/ios:39, from /usr/include/c++/9/ostream:38, from /usr/include/c++/9/iostream:39, from bank.cpp:2: /usr/include/c++/9/new:156:70: error: expected primary-expression before ')' token 156 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t) | ^ /usr/include/c++/9/new:157:41: error: attributes after parenthesized initializer ignored [-fpermissive] 157 | __attribute__((__externally_visible__)); | ^ /usr/include/c++/9/new:158:46: error: declaration of 'operator new []' as non-function 158 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~~ /usr/include/c++/9/new:158:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? In file included from /usr/include/wchar.h:35, from /usr/include/c++/9/cwchar:44, from /usr/include/c++/9/bits/postypes.h:40, from /usr/include/c++/9/iosfwd:40, from /usr/include/c++/9/ios:38, from /usr/include/c++/9/ostream:38, from /usr/include/c++/9/iostream:39, from bank.cpp:2: /usr/lib/gcc/x86_64-linux-gnu/9/include/stddef.h:209:23: note: 'size_t' declared here 209 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ In file included from /usr/include/c++/9/bits/exception_ptr.h:40, from /usr/include/c++/9/exception:143, from /usr/include/c++/9/ios:39, from /usr/include/c++/9/ostream:38, from /usr/include/c++/9/iostream:39, from bank.cpp:2: /usr/include/c++/9/new:158:70: error: expected primary-expression before ',' token 158 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&) | ^ /usr/include/c++/9/new:158:72: error: expected primary-expression before 'const' 158 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~ /usr/include/c++/9/new:165:29: error: 'std::size_t' has not been declared 165 | void operator delete(void*, std::size_t, std::align_val_t) | ^~~ /usr/include/c++/9/new:167:31: error: 'std::size_t' has not been declared 167 | void operator delete[](void*, std::size_t, std::align_val_t) | ^~~ /usr/include/c++/9/new:173:51: error: declaration of 'operator new' as non-function 173 | _GLIBCXX_NODISCARD inline void* operator new(std::size_t, void* __p) _GLIBCXX_USE_NOEXCEPT | ^~~~~~ /usr/include/c++/9/new:173:51: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? In file included from /usr/include/wchar.h:35, from /usr/include/c++/9/cwchar:44, from /usr/include/c++/9/bits/postypes.h:40, from /usr/include/c++/9/iosfwd:40, from /usr/include/c++/9/ios:38, from /usr/include/c++/9/ostream:38, from /usr/include/c++/9/iostream:39, from bank.cpp:2: /usr/lib/gcc/x86_64-linux-gnu/9/include/stddef.h:209:23: note: 'size_t' declared here 209 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ In file included from /usr/include/c++/9/bits/exception_ptr.h:40, from /usr/include/c++/9/exception:143, from /usr/include/c++/9/ios:39, from /usr/include/c++/9/ostream:38, from /usr/include/c++/9/iostream:39, from bank.cpp:2: /usr/include/c++/9/new:173:59: error: expected primary-expression before 'void' 173 | _GLIBCXX_NODISCARD inline void* operator new(std::size_t, void* __p) _GLIBCXX_USE_NOEXCEPT | ^~~~ /usr/include/c++/9/new:175:53: error: declaration of 'operator new []' as non-function 175 | _GLIBCXX_NODISCARD inline void* operator new[](std::size_t, void* __p) _GLIBCXX_USE_NOEXCEPT | ^~~~~~ /usr/include/c++/9/new:175:53: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? In file included from /usr/include/wchar.h:35, from /usr/include/c++/9/cwchar:44, from /usr/include/c++/9/bits/postypes.h:40, from /usr/include/c++/9/iosfwd:40, from /usr/include/c++/9/ios:38, from /usr/include/c++/9/ostream:38, from /usr/include/c++/9/iostream:39, from bank.cpp:2: /usr/lib/gcc/x86_64-linux-gnu/9/include/stddef.h:209:23: note: 'size_t' declared here 209 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ In file included from /usr/include/c++/9/bits/exception_ptr.h:40, from /usr/include/c++/9/exception:143, from /usr/include/c++/9/ios:39, from /usr/include/c++/9/ostream:38, from /usr/include/c++/9/iostream:39, from bank.cpp:2: /usr/include/c++/9/new:175:61: error: expected primary-expression before 'void' 175 | _GLIBCXX_NODISCARD inline void* operator new[](std::size_t, void* __p) _GLIBCXX_USE_NOEXCEPT | ^~~~ In file included from /usr/include/c++/9/bits/move.h:55, from /usr/include/c++/9/bits/nested_exception.h:40, from /usr/include/c++/9/exception:144, from /usr/include/c++/9/ios:39, from /usr/include/c++/9/ostream:38, from /usr/include/c++/9/iostream:39, from bank.cpp:2: /usr/include/c++/9/type_traits:361:26: error: 'std::size_t' has not been declared 361 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/9/type_traits:362:25: error: '_Size' was not declared in this scope 362 | struct is_array<_Tp[_Size]> | ^~~~~ /usr/include/c++/9/type_traits:362:31: error: template argument 1 is invalid 362 | struct is_array<_Tp[_Size]> | ^ /usr/include/c++/9/type_traits:560:42: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'? 560 | struct __is_null_pointer_helper<std::nullptr_t> | ^~~~~~~~~ In file included from /usr/include/c++/9/bits/cxxabi_init_exception.h:38, from /usr/include/c++/9/bits/exception_ptr.h:38, from /usr/include/c++/9/exception:143, from /usr/include/c++/9/ios:39, from /usr/include/c++/9/ostream:38, from /usr/include/c++/9/iostream:39, from bank.cpp:2: /usr/lib/gcc/x86_64-linux-gnu/9/include/stddef.h:433:29: note: 'nullptr_t' declared here 433 | typedef decltype(nullptr) nullptr_t; |